Message ID | 20210129194318.2125748-1-ndesaulniers@google.com (mailing list archive) |
---|---|
Headers | show |
Series | Kbuild: DWARF v5 support | expand |
On Fri, Jan 29, 2021 at 8:43 PM Nick Desaulniers <ndesaulniers@google.com> wrote: > > DWARF v5 is the latest standard of the DWARF debug info format. > > DWARF5 wins significantly in terms of size and especially so when mixed > with compression (CONFIG_DEBUG_INFO_COMPRESSED). > > Link: http://www.dwarfstd.org/doc/DWARF5.pdf > > Patch 1 is a cleanup that lays the ground work and isn't DWARF > v5 specific. > Patch 2 implements Kconfig and Kbuild support for DWARFv5. > Thanks for v6 - I queued it up in my custom patch-series. - Sedat - > Changes from v5: > * Drop previous patch 1, it has been accepted into kbuild: > https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git/commit/?h=kbuild&id=3f4d8ce271c7082be75bacbcbd2048aa78ce2b44 > * Trying to set -Wa,-gdwarf-4 in the earlier patch was the source of > additional complexity. Drop it that part of the patch. We can revisit > clang without the integrated assembler setting -Wa,-gdwarf-4 later. > That is a separate problem from generally supporting DWARF v5. > * Rework the final patch for clang without the integrated assembler. > -Wa,-gdwarf-5 is required for DWARF5 in that case otherwise GAS will > not accept the assembler directives clang produces from C code when > generating asm. > > Changes from v4: > * drop set -e from script as per Nathan. > * add dependency on !CONFIG_DEBUG_INFO_BTF for DWARF v5 as per Sedat. > * Move LLVM_IAS=1 complexity from patch 2 to patch 3 as per Arvind and > Masahiro. Sorry it took me a few tries to understand the point (I > might still not), but it looks much cleaner this way. Sorry Nathan, I > did not carry forward your previous reviews as a result, but I would > appreciate if you could look again. > * Add Nathan's reviewed by tag to patch 1. > * Reword commit message for patch 3 to mention LLVM_IAS=1 and -gdwarf-5 > binutils addition later, and BTF issue. > * I still happen to see a pahole related error spew for the combination > of: > * LLVM=1 > * LLVM_IAS=1 > * CONFIG_DEBUG_INFO_DWARF4 > * CONFIG_DEBUG_INFO_BTF > Though they're non-fatal to the build. I'm not sure yet why removing > any one of the above prevents the warning spew. Maybe we'll need a v6. > > Changes from v3: > > Changes as per Arvind: > * only add -Wa,-gdwarf-5 for (LLVM=1|CC=clang)+LLVM_IAS=0 builds. > * add -gdwarf-5 to Kconfig shell script. > * only run Kconfig shell script for Clang. > > Apologies to Sedat and Nathan; I appreciate previous testing/review, but > I did no carry forward your Tested-by and Reviewed-by tags, as the > patches have changed too much IMO. > > Changes from v2: > * Drop two of the earlier patches that have been accepted already. > * Add measurements with GCC 10.2 to commit message. > * Update help text as per Arvind with help from Caroline. > * Improve case/wording between DWARF Versions as per Masahiro. > > Changes from the RFC: > * split patch in 3 patch series, include Fangrui's patch, too. > * prefer `DWARF vX` format, as per Fangrui. > * use spaces between assignment in Makefile as per Masahiro. > * simplify setting dwarf-version-y as per Masahiro. > * indent `prompt` in Kconfig change as per Masahiro. > * remove explicit default in Kconfig as per Masahiro. > * add comments to test_dwarf5_support.sh. > * change echo in test_dwarf5_support.sh as per Masahiro. > * remove -u from test_dwarf5_support.sh as per Masahiro. > * add a -gdwarf-5 cc-option check to Kconfig as per Jakub. > > Nick Desaulniers (2): > Kbuild: make DWARF version a choice > Kbuild: implement support for DWARF v5 > > Makefile | 16 ++++++++++-- > include/asm-generic/vmlinux.lds.h | 6 ++++- > lib/Kconfig.debug | 41 ++++++++++++++++++++++++++----- > scripts/test_dwarf5_support.sh | 8 ++++++ > 4 files changed, 62 insertions(+), 9 deletions(-) > create mode 100755 scripts/test_dwarf5_support.sh > > -- > 2.30.0.365.g02bc693789-goog >
On Fri, Jan 29, 2021 at 8:43 PM Nick Desaulniers <ndesaulniers@google.com> wrote: > > DWARF v5 is the latest standard of the DWARF debug info format. > > DWARF5 wins significantly in terms of size and especially so when mixed > with compression (CONFIG_DEBUG_INFO_COMPRESSED). > > Link: http://www.dwarfstd.org/doc/DWARF5.pdf > > Patch 1 is a cleanup that lays the ground work and isn't DWARF > v5 specific. > Patch 2 implements Kconfig and Kbuild support for DWARFv5. > When you will do a v7... Can you look also at places where we have hardcoded DWARF-2 handling... For example: arch/x86/purgatory/Makefile:AFLAGS_REMOVE_setup-x86_$(BITS).o += -Wa,-gdwarf-2 arch/x86/purgatory/Makefile:AFLAGS_REMOVE_entry64.o += -Wa,-gdwarf-2 - Sedat - > Changes from v5: > * Drop previous patch 1, it has been accepted into kbuild: > https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git/commit/?h=kbuild&id=3f4d8ce271c7082be75bacbcbd2048aa78ce2b44 > * Trying to set -Wa,-gdwarf-4 in the earlier patch was the source of > additional complexity. Drop it that part of the patch. We can revisit > clang without the integrated assembler setting -Wa,-gdwarf-4 later. > That is a separate problem from generally supporting DWARF v5. > * Rework the final patch for clang without the integrated assembler. > -Wa,-gdwarf-5 is required for DWARF5 in that case otherwise GAS will > not accept the assembler directives clang produces from C code when > generating asm. > > Changes from v4: > * drop set -e from script as per Nathan. > * add dependency on !CONFIG_DEBUG_INFO_BTF for DWARF v5 as per Sedat. > * Move LLVM_IAS=1 complexity from patch 2 to patch 3 as per Arvind and > Masahiro. Sorry it took me a few tries to understand the point (I > might still not), but it looks much cleaner this way. Sorry Nathan, I > did not carry forward your previous reviews as a result, but I would > appreciate if you could look again. > * Add Nathan's reviewed by tag to patch 1. > * Reword commit message for patch 3 to mention LLVM_IAS=1 and -gdwarf-5 > binutils addition later, and BTF issue. > * I still happen to see a pahole related error spew for the combination > of: > * LLVM=1 > * LLVM_IAS=1 > * CONFIG_DEBUG_INFO_DWARF4 > * CONFIG_DEBUG_INFO_BTF > Though they're non-fatal to the build. I'm not sure yet why removing > any one of the above prevents the warning spew. Maybe we'll need a v6. > > Changes from v3: > > Changes as per Arvind: > * only add -Wa,-gdwarf-5 for (LLVM=1|CC=clang)+LLVM_IAS=0 builds. > * add -gdwarf-5 to Kconfig shell script. > * only run Kconfig shell script for Clang. > > Apologies to Sedat and Nathan; I appreciate previous testing/review, but > I did no carry forward your Tested-by and Reviewed-by tags, as the > patches have changed too much IMO. > > Changes from v2: > * Drop two of the earlier patches that have been accepted already. > * Add measurements with GCC 10.2 to commit message. > * Update help text as per Arvind with help from Caroline. > * Improve case/wording between DWARF Versions as per Masahiro. > > Changes from the RFC: > * split patch in 3 patch series, include Fangrui's patch, too. > * prefer `DWARF vX` format, as per Fangrui. > * use spaces between assignment in Makefile as per Masahiro. > * simplify setting dwarf-version-y as per Masahiro. > * indent `prompt` in Kconfig change as per Masahiro. > * remove explicit default in Kconfig as per Masahiro. > * add comments to test_dwarf5_support.sh. > * change echo in test_dwarf5_support.sh as per Masahiro. > * remove -u from test_dwarf5_support.sh as per Masahiro. > * add a -gdwarf-5 cc-option check to Kconfig as per Jakub. > > Nick Desaulniers (2): > Kbuild: make DWARF version a choice > Kbuild: implement support for DWARF v5 > > Makefile | 16 ++++++++++-- > include/asm-generic/vmlinux.lds.h | 6 ++++- > lib/Kconfig.debug | 41 ++++++++++++++++++++++++++----- > scripts/test_dwarf5_support.sh | 8 ++++++ > 4 files changed, 62 insertions(+), 9 deletions(-) > create mode 100755 scripts/test_dwarf5_support.sh > > -- > 2.30.0.365.g02bc693789-goog >
On Fri, Jan 29, 2021 at 4:08 PM Sedat Dilek <sedat.dilek@gmail.com> wrote: > > On Fri, Jan 29, 2021 at 8:43 PM Nick Desaulniers > <ndesaulniers@google.com> wrote: > > > > DWARF v5 is the latest standard of the DWARF debug info format. > > > > DWARF5 wins significantly in terms of size and especially so when mixed > > with compression (CONFIG_DEBUG_INFO_COMPRESSED). > > > > Link: http://www.dwarfstd.org/doc/DWARF5.pdf > > > > Patch 1 is a cleanup that lays the ground work and isn't DWARF > > v5 specific. > > Patch 2 implements Kconfig and Kbuild support for DWARFv5. > > > > When you will do a v7... > > Can you look also at places where we have hardcoded DWARF-2 handling... Ah, sorry, I just saw this now, after sending v7. Can we wait to purge DWARF v2 until after we have DWARF v5? In fact, if they are orthogonal like I suspect, why don't you send some patches and I will help you test them?
On Fri, Jan 29, 2021 at 4:46 PM 'Nick Desaulniers' via Clang Built Linux <clang-built-linux@googlegroups.com> wrote: > > On Fri, Jan 29, 2021 at 4:08 PM Sedat Dilek <sedat.dilek@gmail.com> wrote: > > > > On Fri, Jan 29, 2021 at 8:43 PM Nick Desaulniers > > <ndesaulniers@google.com> wrote: > > > > > > DWARF v5 is the latest standard of the DWARF debug info format. > > > > > > DWARF5 wins significantly in terms of size and especially so when mixed > > > with compression (CONFIG_DEBUG_INFO_COMPRESSED). > > > > > > Link: http://www.dwarfstd.org/doc/DWARF5.pdf > > > > > > Patch 1 is a cleanup that lays the ground work and isn't DWARF > > > v5 specific. > > > Patch 2 implements Kconfig and Kbuild support for DWARFv5. > > > > > > > When you will do a v7... > > > > Can you look also at places where we have hardcoded DWARF-2 handling... > > Ah, sorry, I just saw this now, after sending v7. Can we wait to > purge DWARF v2 until after we have DWARF v5? > > In fact, if they are orthogonal like I suspect, why don't you send > some patches and I will help you test them? > -- > Thanks, > ~Nick Desaulniers Basically the distinction is just between DWARF v2 .debug_line and DWARF v5 .debug_line . (-gdwarf-4 adds an extra maximum_operations_per_instruction (constant 1) compared with -gdwarf-2 but that can mostly be ignored). Refinement among -gdwarf-[234] just clarifies things and is not going to affect debugging experience in any case. So I agree with Nick that it can be done separately. Note: such clarification can make things a bit ugly because binutils before 2020 does not recognize -gdwarf-[345].