Re: How do I prevent a function from being optimized out?
Re: How do I prevent a function from being optimized out?
- Subject: Re: How do I prevent a function from being optimized out?
- From: Jerry Pendergraft <email@hidden>
- Date: Wed, 13 Apr 2005 17:12:45 -0500 (CDT)
Seems like if you provide an object file to the link that provides
the malloc() entry point (with proper signature), then the linker would
never bother to search the standard lib for it. Of course gcc has its own
ideas especially concering malloc ;^)
On Wed, 13 Apr 2005, Andrew Gallatin wrote:
>
> Ben writes:
> > I don't know, but the obvious(?) question I have is, "why?"
> >
>
> I was hoping nobdy would ask ;)
>
> Because we need to override malloc, and the only way we can figure out
> to do it is to
>
> - force a flat namespace using DYLD_FORCE_FLAT_NAMESPACE
> - link applications with -multiply_defined -u foo_hack()
> - add foo_hack() into scalable_malloc.c along with the hooks we need
> - include the scalable_malloc.o object in our lib.
>
> As I understand it (I didn't come up with it) this forces the rtld to
> load our scalable_malloc.o rather than the one from libc, since the first
> thing it does is to go looking for foo_hack().
>
> Drew
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden