This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Dynamically wrap non dynamic symbol


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]