Does the LD --wrap feature work for library internal references?

Sebastian Huber sebastian.huber@embedded-brains.de
Fri Jan 4 19:45:00 GMT 2019


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ld-wrap.tar.gz
Type: application/x-compressed-tar
Size: 750 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20190104/ef63b6d1/attachment.bin>


More information about the Binutils mailing list