Re: [PATCH] Kbuild: implement support for DWARF5
From: Nick Desaulniers
Date: Tue Nov 03 2020 - 17:27:19 EST
On Wed, Oct 21, 2020 at 6:44 PM Fangrui Song <maskray@xxxxxxxxxx> wrote:
>
> On 2020-10-21, 'Nick Desaulniers' via Clang Built Linux wrote:
> >DWARF5 is the latest standard of the DWARF debug info format.
> >
> >Feature detection of DWARF5 is onerous, especially given that we've
> >removed $(AS), so we must query $(CC) for DWARF5 assembler directive
> >support. Further -gdwarf-X where X is an unsupported value doesn't
> >produce an error in $(CC). GNU `as` only recently gained support for
> >specifying -gdwarf-5.
> >
> >The DWARF version of a binary can be validated with:
>
> To be more correct: this is just the version number of the .debug_info section.
> Other sections can use different version numbers.
> (For example, GNU as still does not support version 5 .debug_line)
How do you recommend we validate that then?
>
> >$ llvm-dwarfdump vmlinux | head -n 5 | grep version
> >or
> >$ readelf --debug-dump=info vmlinux 2>/dev/null | grep Version
> >diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> >index cd14444bf600..0382808ef9fe 100644
> >--- a/include/asm-generic/vmlinux.lds.h
> >+++ b/include/asm-generic/vmlinux.lds.h
> >@@ -828,7 +828,11 @@
> > .debug_types 0 : { *(.debug_types) } \
> > /* DWARF 5 */ \
> > .debug_macro 0 : { *(.debug_macro) } \
> >- .debug_addr 0 : { *(.debug_addr) }
> >+ .debug_addr 0 : { *(.debug_addr) } \
> >+ .debug_line_str 0 : { *(.debug_line_str) } \
> >+ .debug_loclists 0 : { *(.debug_loclists) } \
> >+ .debug_rnglists 0 : { *(.debug_rnglists) } \
> >+ .debug_str_offsets 0 : { *(.debug_str_offsets) }
>
> Consider adding .debug_names for the accelerator table.
> It is the DWARF v5 version of .debug_pub{names,types} (which are mentioned
> a few lines above).
I hadn't seen that section produced in my limited testing. Being a
fan of TDD, I kind of would like to see the linker warn on orphan
section placement, then add it to the list, as I did with the above.
Do you have more info on when or how .debug_pub* can be produced?
Thanks for the rest of the feedback, I'll incorporate it into v2.
--
Thanks,
~Nick Desaulniers