Linker question
Nick Clifton
nickc@redhat.com
Thu Oct 2 15:30:00 GMT 2008
Hi Alpar,
> I'm not sure if this info is already present on the mailing list.
> I'd like to know if it is possible to determine at the linking phase whether
> a function has been referred to through function pointer.
Yes and no. As Ramana has mentioned it is possible to tell whether a
function is referenced from somewhere else in the code by looking at the
relocations in the object files. It is not always possible to tell
whether this is a function call or an assignment to a function pointer
however. (It depends upon the target as to whether this distinction can
be made).
Also the linker cannot determine run-time control flow behaviour, so it
is possible that the address of a function is taken in a piece of code
that is never executed, making it appear that the function is referenced
when in fact it never is.
Cheers
Nick
More information about the Binutils
mailing list