Re: How do I prevent a function from being optimized out?
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com User-agent: Microsoft-Entourage/10.1.4.030702.0 If you have control over the application, a much better solution is mach_override. <http://www.rentzsch.com/mach_override/> If you need to override malloc in programs you cannot link against, you will have to wait for Tiger (unless you don't care when the override occurs, then look at mach_inject on the same site). -Brian Dantes
From: Andrew Gallatin <gallatin@cs.duke.edu> Date: Wed, 13 Apr 2005 17:50:06 -0400 (EDT) To: Ben <bench@silentmedia.com> Cc: darwin-dev@lists.apple.com Subject: Re: How do I prevent a function from being optimized out?
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 (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/brian%40things.org
This email sent to brian@things.org
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Brian Dantes