Does the LD --wrap feature work for library internal references?
Sebastian Huber
sebastian.huber@embedded-brains.de
Sat Jan 5 18:51:00 GMT 2019
More information about the Binutils mailing list
Sat Jan 5 18:51:00 GMT 2019
- Previous message (by thread): Does the LD --wrap feature work for library internal references?
- Next message (by thread): Does the LD --wrap feature work for library internal references?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
----- Am 4. Jan 2019 um 20:45 schrieb Sebastian Huber sebastian.huber@embedded-brains.de: > Hello Nick, > > ----- Am 4. Jan 2019 um 15:27 schrieb Nick Clifton nickc@redhat.com: > >> Hi Sebastian, >> >>> I don't use link-time optimization. I am sure the functions ether_input() and >>> ether_output() are present in the executable. >> >> OK, but my guess is that the compiler has already done something clever >> so that those symbols are never referenced, and hence wrapping the symbols >> has no effect. (You could look in the object file and see if the symbols >> are used in one or more relocations...) >> >> Alternatively maybe there really is a bug in the linker's wrapping code. >> But I have no idea what it might be, or why this particular situation is >> causing problems. If you do think that it is a linker bug though, please >> could you put together a small test case to demonstrate the problem ? >> Ideally using assembler source files rather than C/C++ sources, so that >> we do not have to worry about compiler optimizations. > > attached is a self-contained example with Makefile and C code. It seems the > reference via function pointers is the problem. I slightly modified the test program. With a main() function like this: int main(void) { func gg; gg = f(); (*gg)(); g(); return 0; } I get this output: __wrap_f f g __wrap_g g The f() function returns a function pointer to g(). The indirect (*gg)() call is not wrapped, the direct g() call is wrapped. Is this a bug or a feature?
- Previous message (by thread): Does the LD --wrap feature work for library internal references?
- Next message (by thread): Does the LD --wrap feature work for library internal references?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list