[PATCH] as: Automatically enable DWARF5 support

Fangrui Song i@maskray.me
Sun Jan 17 18:56:05 GMT 2021


On 2021-01-17, H.J. Lu wrote:
>On Sat, Jan 16, 2021 at 10:11 PM Fangrui Song <i@maskray.me> wrote:
>>
>> On 2021-01-16, H.J. Lu via Binutils wrote:
>> >Currently
>> >
>> >$ as -o x.o x.s
>> >
>> >fails when x.s contains DWARF5 info.  Add a .dwarf_level directive to
>> >set the DWARF level and GCC can emit ".dwarf_level 5" when generating
>> >DWARF5 info so that
>> >
>> >$ gcc -S -g -c x.c
>> >$ gcc -c x.s
>> >
>> >works.
>>
>> The problem is file number 0 in .file and .loc directives.  An alternative
>> design is to detect number 0 and upgrade to DWARF v5 line tables automatically.
>>
>> If we decide to add a new directive, .dwarf_version is better than .dwarf_level .
>> The DWARF specifications don't use the term "level".
>
>How about this patch to automatically enable DWARF5 support?
>
>-- 
>H.J.

Thanks! I created a patch for LLVM integrated assembler:
https://reviews.llvm.org/D94882 to bring attention to debug info folks.


Some nitpicks:

> "fails when x.s contains DWARF5 info."

This can be elaborated: it is .file 0 or .loc 0.

as -gdwarf-4 x.s upon .file 0 probably deserves a test.  On LLVM side, making
it error requires additional complexity so I am going to ignore the diagnostic.
It is perfectly fine for as to error if it does not add much complexity.


More information about the Binutils mailing list