public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* Can LD_PRELOAD set different symbol definitions for shared objects and executable?
@ 2021-05-25  2:35 Fengkai Sun
  2021-05-25  8:41 ` Florian Weimer
  0 siblings, 1 reply; 4+ messages in thread
From: Fengkai Sun @ 2021-05-25  2:35 UTC (permalink / raw)
  To: libc-help

Hi list,

I've done some research on elf/rtld.c, and found that the dynamic linker
only handles the preload list in dl_main, that is, there is no other way to
change it later.

Does that mean there is no way to give different symbol definitions to
shared objects and executable?

For example, if I set LD_PRELOAD="./mymalloc.so", then all references to
malloc will be interposed. There is no way to specify a custom allocator
only for shared objects(maybe I can make a difference in the source code of
custom malloc, but that's off topic).

I wonder if there is any way to do this, or if I missed out some
fundamental ideas.


Best,
Fengkai

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-25 17:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25  2:35 Can LD_PRELOAD set different symbol definitions for shared objects and executable? Fengkai Sun
2021-05-25  8:41 ` Florian Weimer
2021-05-25 16:03   ` Fengkai Sun
2021-05-25 17:50     ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).