This is the mail archive of the binutils@sourceware.cygnus.com 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]

Re: finding the file of a local symbol in BFD



>    How portable is this information?  Is there any way to determine the
>    compilation unit to which a local symbol belongs that works regardless
>    of the underlying object file format?
> 
> More or less.  However, at least at present, BFD only uses the
> BSF_FILE flag for ELF symbols.

So the information provided by BFD is actually not portable to other
object file formats at all.

> The a.out linker will create an N_TEXT symbol for each object file.
> You may be able to use that to identify local symbols accurately,
> although offhand I'm not sure how you can tell a file symbol from
> other symbols.  Except that they typically have a `.' in them, I
> suppose.

How can I tell whether an a.out symbol is an N_TEXT symbol when I'm
accessing the a.out file via BFD?  If BFD doesn't indicate an N_TEXT
symbol by setting BSF_FILE, how can I recognize such a symbol?

> The COFF compiler should generate a .file pseudo-op, which the
> assembler will turn into a C_FILE symbol and the linker will
> preserve.  You can use to identify local symbols correctly.

It sounds to me like the various formats all have something resembling
STT_FILE symbols, but I need to use a different method to recognize
such symbols for each format.  What I meant by "can I do this
portably" was "can I write a single bit of code that will work for all
existing formats"; and the answer is "No".  :)

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