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]

wrap function and its caller in the same object file with ld ?


Hi everybody !

I'm designing a debug tool in order to trace functions given by the user in
parameters.
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,

Best regards


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