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]

Re: Linker question


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



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