How to sort mixed DWARF32 and DWARF64 .debug_*

Cary Coutant ccoutant@gmail.com
Tue Nov 17 16:37:05 GMT 2020


I replied in the gABI group...

>> It seems that they are intermixable by design, but that the
>> design is incomplete. I read this as saying "we don't care
>> if you mix this content, but the linkers might, and that's
>> not our problem". I think you're right that we could just
>> reject such a link, but it's also clear that the end user
>> won't understand these subtleties, and will simply blame
>> the component that issues the error. That's fine if the
>> number of cases is small, but at some point, it does become
>> a linking problem that wants solving.

I think that the DWARF spec made a mistake in not specifying
DW_FORM_sec_offset and DW_FORM_ref_addr to be address-sized values
rather than dependent on DWARF-32 vs. DWARF-64. That would blow up all
DWARF attributes of form DW_FORM_sec_offset, but that can be mitigated
by using DW_FORM_strx, DW_FORM_loclistx, and DW_FORM_rnglistx wherever
possible. DW_FORM_ref_addr should be pretty rare.

I would move to fix this in DWARF 6.

Until that's available, though, it looks like we still need a fix....

> SHT_DWARF64    19

I'd prefer not to add a new section type, but I have an alternate
suggestion: Use a new section flag, say SHF_LARGE, that would tell the
linker that these section contributions should be placed after all
other contributions. X86 already has such a flag, SHF_X86_64_LARGE,
and PA-RISC and Itanium have the opposite -- SHF_PARISC_SHORT and
SHF_IA_64_SHORT.

-cary


More information about the Binutils mailing list