[Dwarf-Discuss] About DW_AT_external
Wed Jul 28 16:52:56 GMT 2010
P J P wrote:
> --- On Wed, 28/7/10, Robinson, Paul T (NonStop) <paul.t.robinson at hp.com>
>> The standard consistently says "visible outside of its containing
>> compilation unit" when talking about DW_AT_external.
> Irrespective of where the variable/function is defined?
> Ex.: say an application uses standard library functions/C++ classes like
> malloc, strncpy, strcmp, operator>>, operator<< etc.
> The dwarf DIE of such symbols in the application object file will have
> DW_AT_external set, I guess, right?
C is a bit confusing in how it defines keywords. The "extern" keyword
does not mean that the symbol is externally visible -- it means that
the symbol is defined elsewhere as a global (i.e. externally visible)
symbol. In C, external symbols are defined at file scope without
either the "extern" or "static" keywords.
The DIE for "malloc" should have DW_AT_external where it is defined,
not in places the symbol is referenced.
> Is there a way to know whether the function is defined in the same
> compilation unit or is there because of linking with the other compilation
DIEs for non-defining declarations should have the DW_AT_declaration
Michael Eager eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
More information about the Dwarf-discuss