This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Split Stacks proposal


Mathieu Lacage <mathieu.lacage@sophia.inria.fr> writes:

> On Fri, 2009-02-27 at 08:54 -0800, Ian Lance Taylor wrote:
>
>> > It would be totally awesome to do this if you could provide an option to
>> > delegate to a user-provided function the allocation and deallocation of
>> > the stack blobs needed by threads.
>> 
>> Yes, this would be a goal.
>
> The main reason I asked about this is that it is not obvious to me how
> this could be done: yes, you can call any function from your
> compiler-generated code but, what would the user need to do to change
> which address is called ?
>
> 1) specify a function name for allocation on the command-line during
> compilation and link statically into every binary an object file which
> contains the specified symbol ? This would allow you to have one
> allocation function per generated binary (shared library or executable)
> which might not be very desirable from a user-perspective.
>
> 2) generate code which uses a well-known name, calls this symbol through
> the PLT (on ELF systems), and, relies on the ELF loader to resolve that
> symbol in each binary to a single user-provided function. The libc could
> provide its own default implementation which is overridden either with
> LD_PRELOAD or by linking the function into the main executable.

I would use option 2.

There could also be a hook function, along the lines of
std::set_terminate.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]