wrap function and its caller in the same object file with ld ?
Mon Apr 7 09:42:00 GMT 2008
Hi everybody !
I'm designing a debug tool in order to trace functions given by the user in
For this, I use the powerful linker ld and its wrap option (-wrap). So, for
each function call, we call the wrap function containing printf() for
arguments and result and the call for the real function. It's very
convenient because we don't modify source files in this way : we just add
some code apart and, for debugging, it's very useful.
It works perfectly except when the function to trace is in the same object
that the caller to this function.
In fact, this is not abnormal because linkage is the last step before to
obtain the executable and its aim is to solve undefined references to
functions. Consequently, when a function and its caller are in the same
object, the reference is not undefined !
That's why I would like to know if it's possible to undefine function calls
for a particular function in object files in order to wrap this function.
Or maybe there is another way to do this ?
Thank you for your help,
More information about the Binutils