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

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


On 04/01/2019 14:49, Nick Clifton wrote:
> Hi Sebastian,
>
>>> Is it possible that the _bsd_ether_output function has been inlined into
>> It is not inlined, but its only reference is done via a function pointer assignment here:
>> ifp->if_output = ether_output;
>> ifp->if_input = ether_input;
>> Does the wrap feature work for function pointer assignments?
> Hmmm, interesting.  Is the ether_input function also only referenced
> in this way ?  (Because you said that the ether_input function was being
> wrapped, yes ?)

Sorry, for the confusion. Both ether_output() and ether_input() are only 
referenced by function pointer assignments and both are not wrapped. I 
can wrap the function ether_ifattach() (this is the function assigning 
the function pointers).

>
> Generally speaking function pointer assignment should be subject to
> linker wrapping, but there are still some possible explanations for
> this behaviour.  For example, is the if_output function pointer ever
> used in the code ?  If not, then the compiler might be dropping the
> initialization of the if_output field, since it is never needed.

I don't use link-time optimization. I am sure the functions 
ether_input() and ether_output() are present in the executable.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the Binutils mailing list