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


On Thu, Oct 2, 2008 at 9:59 AM, palparni <palparni@gmail.com> wrote:
>
> Hi,
>
> 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.
> If it is, could you give me some ideas on how to do this. I'd need to use
> this in the emulation file of a microcontroller.

Well , the information is present in the ELF symtab if you are using
ELF as your object file format

The assignment to the function pointer of a function will create a
data relocation for the function at either the data section where the
initialization happens or in the code section if the function pointer
is set up in a function inside code. So all you do when you do the
final relocs is to see if the DEF of this symbol refers to a function
or an object. The information whether the symbol is a function or an
object is IIRC in the symbol type in the elf symbol table.


cheers
Ramana




> Thanks,
> Alpar
> --
> View this message in context: http://www.nabble.com/Linker-question-tp19775703p19775703.html
> Sent from the Sourceware - binutils list mailing list archive at Nabble.com.
>
>



-- 
Ramana Radhakrishnan


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