How to sort mixed DWARF32 and DWARF64 .debug_*

Fangrui Song i@maskray.me
Fri Nov 13 19:34:33 GMT 2020


> >This would work for any section types that come in 32-bit and 64-bit flavours...
>
> https://lists.llvm.org/pipermail/llvm-dev/2020-November/146557.html
> raised the section type idea: we could assign a dedicated section type for
> DWARF64 .debug_* sections. The thread also raised ideas about using sh_info.
>
> The section type idea actually looks quite good to me. There are some features we will need:
>
> * we might need to ask on generic-abi whether
>    Solaris/HP-UX/... folks are happy with a dedicated section type, if not
>    then perhaps we could use SHT_GNU_*
> * we need a way in linker scripts to match input sections by type. AFAIK
>    there is no existing mechanism.
>
> If we invent a keyword (say, TYPE) to match sections by type, we could use
>    .debug_info     0 : { *(TYPE (SHT_PROGBITS) .debug_info${RELOCATING+ .gnu.linkonce.wi.*}) }
>    .debug_info     0 : { *(TYPE (SHT_GNU_DWARF64) .debug_info) }
>
> or
>
>    .debug_info     0 : { *(TYPE (SHT_PROGBITS) .debug_info${RELOCATING+ .gnu.linkonce.wi.*} TYPE (SHT_GNU_DWARF64) .debug_info) }
>

Apologies that the examples need correction:

.debug_info     0 : { *(TYPE (SHT_PROGBITS) .debug_info${RELOCATING+
.gnu.linkonce.wi.*}) *(TYPE (SHT_GNU_DWARF64) .debug_info) }

We need two input section descriptions because one does not impose an
ordering. I do not add SHT_GNU_DWARF64 for .gnu.linkonce.wi.*
because I think .gnu.linkonce.wi.* is a legacy which is not relevant
in this century:)


More information about the Binutils mailing list