Dynamically wrap non dynamic symbol
Christian Gagneraud
chgans@gmail.com
Thu Sep 21 00:28:00 GMT 2017
Hi there,
I am trying to wrap function calls, at runtime, in a dynamic way and
without having to modify the original binary.
Basically i have a function "void *install_hook(const char
*symbol_name, void *replacement)" that replace the function associated
with the symbol "symbol_name" with the function pointer "replacement",
and returns the original function pointer.
Using dl_iterate_phdr it is possible to install wrapper around dynamic
symbols, but i would like to do the same for symbols that are local to
the executable.
Objects are compiled with "gcc -fPIC" and executable is generate with "ld -pie".
I thought that "ld -pie" will make all the local symbols show up in
the dynamic program section header, but it doesn't.
Is this even possible to install wrapper around local symbols?
If so would you have any information to share?
Thanks,
Chris
More information about the Binutils
mailing list