Thu Mar 24 16:34:27 GMT 2005
> For a definition, we can just put in the DW_AT_low_pc
> attribute, and insert the address into the dwarf info.
> But for a declaration, the symbol might not
> end up getting defined in the a.out. I wonder if we
> could add "weak" references to the linker name
> in a declaraction, and hence put either "0" or the address
> into the declaration die. Then the debugger can
> always look the address up in the symbol table if it wants to.
If I understand you, you're talking about referencing the symbol name via
DW_AT_low_pc, and then marking the symbol as weak so that it would use the
value 0 if not encountered in any other objects in the linked executable.
We tried doing that for a different situation, and the results were
unpleasant. If the symbol appears anywhere in a library, Gnu ld prefers the
"strong" version from the library over the weak version. As a result, you
end up with routines being pulled into the executable when they aren't needed
for execution, but simply are referenced by Dwarf.
We concluded that to do this, we needed an indication on the reference itself
(as opposed to the symbol) that meant something like:
This reference never should imply that the referenced symbol should be
included in the application. But if it ends up in the application for
some other reason (e.g. it was in an explicitly-named object file, there
was a normal reference that did require it, etc.), reference it. And if
not, just reference 0.
And that no such indication existed.
But, hey, if you find a way to do what you're talking about without having to
change ld, I'd sure like to hear about it. :)
Concurrent Computer Corporation
More information about the Dwarf-discuss