[PATCH] as: Automatically enable DWARF5 support
H.J. Lu
hjl.tools@gmail.com
Sun Jan 17 19:26:10 GMT 2021
On Sun, Jan 17, 2021 at 10:56 AM Fangrui Song <i@maskray.me> wrote:
>
> 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.
Like
---
Currently
$ as -o x.o x.s
fails when x.s contains DWARF5 ".file 0" or ".loc 0" directives. Update
assembler to automatically enable DWARF5 support so that
$ gcc -S -g -c x.c
$ gcc -c x.s
works.
---
> as -gdwarf-4 x.s upon .file 0 probably deserves a test. On LLVM side, making
I updated the patch to test -gdwarf-3 with ".file 0" in
https://gitlab.com/x86-binutils/binutils-gdb/-/commit/a1da4f25964b54317071fd27fd9121c187f2a79a
Since readelf doesn't support ".loc 0", I have a followup patch:
https://gitlab.com/x86-binutils/binutils-gdb/-/commit/edde4bf8d2c35d94a0567e8bd3c5d3d4b1233010
> 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.
--
H.J.
More information about the Binutils
mailing list