This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
finding the file of a local symbol in BFD
- To: binutils AT sourceware.cygnus dot com
- Subject: finding the file of a local symbol in BFD
- From: Jim Blandy <jimb AT cygnus dot com>
- Date: Mon, 13 Sep 1999 17:58:21 -0500 (EST)
In an ELF symbol table, all local symbols (e.g., C static things) come
at the beginning of the symbol table. As I understand it, all the
local symbols from a given compilation unit come in a clump, preceded
by an STT_FILE symbol whose name is the name of the source file for
that compilation unit. So, given this information, you can discover
which compilation unit a symbol is local to, and thus you can reliably
distinguish between local symbols with the same name.
Is this correct?
In BFD, STT_FILE symbols have the BSF_FILE flag associated with them.
Does BFD guarantee to preserve the order of the symbols? That is,
will the symbols as I retrieve them from BFD still appear ordered by
compilation unit and preceded by a BSF_FILE symbol?
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?