> I would expect the linker to start by processing the pubnames/pubtypes > sections, and then if it wants to look through the CUs as well it already > knows which ones it can skip. > > The presence or absence of an attribute seems like a fragile way to > determine whether or not particular debug info is sufficiently reliable. If > a consumer wants to make decisions based on changing behavior in different > versions of a producer, it could look at the DW_AT_producer string.
In the context of Tom's original suggestion to add .gdb_index, I suggested fixing the problems with .debug_pubnames and using the producer string to distinguish. Tom had several objections to the use of the producer string for that: http://sourceware.org/ml/archer/2009-q4/msg00065.html I'm simply trying to do something that's fairly simple and that works. These attributes are GNU extensions, and I do not intend to propose these as part of the DWARF 5 standard -- they're stopgap measures until we have a better plan for accelerated lookup tables. Starting with the pubnames sections then going back and reading the debug_info sections would require an extra table and a lookup for each CU to see if it's already been covered by a pubnames section. Building the .gdb_index in gold is still too slow, but these attributes help make it a bit faster than it was without them. Are these two attributes a showstopper issue for you? > Hmm. Looking at the code, it seems that the pubtypes entries for these > types will point to the main CU, but with the offset in the type_unit, so a > consumer trying to follow the pointer will find garbage. If you want to > have a pubtypes entry, it needs to point to a type skeleton to avoid > crashing standard-conforming consumers. Yes, I understand that's broken, but there are no consumers at this point that make any use of that offset. Would it be acceptable if we just put 0 there? (Given that I expect .debug_pub* to go away soon, I don't think it's worth the trouble of filling in the offset with anything more meaningful.) -cary