Can LD_PRELOAD set different symbol definitions for shared objects and executable?
Fengkai Sun
qcloud1014@gmail.com
Tue May 25 02:35:20 GMT 2021
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
More information about the Libc-help
mailing list