DWARF v5 is the latest standard of the DWARF debug info format.
DWARF5 wins significantly in terms of size when mixed with compression
(CONFIG_DEBUG_INFO_COMPRESSED).
Link: http://www.dwarfstd.org/doc/DWARF5.pdf
Patch 1 is a cleanup from Masahiro and isn't DWARF v5 specific.
Patch 2 is a cleanup that lays the ground work and isn't DWARF
v5 specific.
Patch 3 implements Kconfig and Kbuild support for DWARFv5.
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.
*** BLURB HERE ***
Masahiro Yamada (1):
Remove $(cc-option,-gdwarf-4) dependency from CONFIG_DEBUG_INFO_DWARF4
Nick Desaulniers (2):
Kbuild: make DWARF version a choice
Kbuild: implement support for DWARF v5
Makefile | 13 +++++++---
include/asm-generic/vmlinux.lds.h | 6 ++++-
lib/Kconfig.debug | 42 +++++++++++++++++++++++++------
scripts/test_dwarf5_support.sh | 8 ++++++
4 files changed, 57 insertions(+), 12 deletions(-)
create mode 100755 scripts/test_dwarf5_support.sh
--
2.30.0.284.gd98b1dd5eaa7-goog
From: Masahiro Yamada <[email protected]>
The -gdwarf-4 flag is supported by GCC 4.5+, and also by Clang.
You can see it at https://godbolt.org/z/6ed1oW
For gcc 4.5.3 pane, line 37: .value 0x4
For clang 10.0.1 pane, line 117: .short 4
Given Documentation/process/changes.rst stating GCC 4.9 is the minimal
version, this cc-option is unneeded.
Note
----
CONFIG_DEBUG_INFO_DWARF4 controls the DWARF version only for C files.
As you can see in the top Makefile, -gdwarf-4 is only passed to CFLAGS.
ifdef CONFIG_DEBUG_INFO_DWARF4
DEBUG_CFLAGS += -gdwarf-4
endif
This flag is used when compiling *.c files.
On the other hand, the assembler is always given -gdwarf-2.
KBUILD_AFLAGS += -Wa,-gdwarf-2
Hence, the debug info that comes from *.S files is always DWARF v2.
This is simply because GAS supported only -gdwarf-2 for a long time.
Recently, GAS gained the support for --dwarf-[3|4|5] options. [1]
And, also we have Clang integrated assembler. So, the debug info
for *.S files might be improved if we want.
In my understanding, the current code is intentional, not a bug.
[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=31bf18645d98b4d3d7357353be840e320649a67d
Reviewed-by: Nick Desaulniers <[email protected]>
Reviewed-by: Nathan Chancellor <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
---
lib/Kconfig.debug | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 78361f0abe3a..dd7d8d35b2a5 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -258,7 +258,6 @@ config DEBUG_INFO_SPLIT
config DEBUG_INFO_DWARF4
bool "Generate dwarf4 debuginfo"
- depends on $(cc-option,-gdwarf-4)
help
Generate dwarf4 debug info. This requires recent versions
of gcc and gdb. It makes the debug information larger.
--
2.30.0.284.gd98b1dd5eaa7-goog
DWARF v5 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.
The DWARF version of a binary can be validated with:
$ llvm-dwarfdump vmlinux | head -n 4 | grep version
or
$ readelf --debug-dump=info vmlinux 2>/dev/null | grep Version
DWARF5 wins significantly in terms of size when mixed with compression
(CONFIG_DEBUG_INFO_COMPRESSED).
363M vmlinux.clang12.dwarf5.compressed
434M vmlinux.clang12.dwarf4.compressed
439M vmlinux.clang12.dwarf2.compressed
457M vmlinux.clang12.dwarf5
536M vmlinux.clang12.dwarf4
548M vmlinux.clang12.dwarf2
515M vmlinux.gcc10.2.dwarf5.compressed
599M vmlinux.gcc10.2.dwarf4.compressed
624M vmlinux.gcc10.2.dwarf2.compressed
630M vmlinux.gcc10.2.dwarf5
765M vmlinux.gcc10.2.dwarf4
809M vmlinux.gcc10.2.dwarf2
Though the quality of debug info is harder to quantify; size is not a
proxy for quality.
Jakub notes:
All [GCC] 5.1 - 6.x did was start accepting -gdwarf-5 as experimental
option that enabled some small DWARF subset (initially only a few
DW_LANG_* codes newly added to DWARF5 drafts). Only GCC 7 (released
after DWARF 5 has been finalized) started emitting DWARF5 section
headers and got most of the DWARF5 changes in...
Version check GCC so that we don't need to worry about the difference in
command line args between GNU readelf and llvm-readelf/llvm-dwarfdump to
validate the DWARF Version in the assembler feature detection script.
GNU `as` only recently gained support for specifying -gdwarf-5, so when
compiling with Clang but without Clang's integrated assembler
(LLVM_IAS=1 is not set), explicitly add -Wa,-gdwarf-5 to DEBUG_CFLAGS.
Disabled for now if CONFIG_DEBUG_INFO_BTF is set; pahole doesn't yet
recognize the new additions to the DWARF debug info. Thanks to Sedat for
the report.
Link: http://www.dwarfstd.org/doc/DWARF5.pdf
Reported-by: Sedat Dilek <[email protected]>
Suggested-by: Arvind Sankar <[email protected]>
Suggested-by: Caroline Tice <[email protected]>
Suggested-by: Fangrui Song <[email protected]>
Suggested-by: Jakub Jelinek <[email protected]>
Suggested-by: Masahiro Yamada <[email protected]>
Suggested-by: Nathan Chancellor <[email protected]>
Signed-off-by: Nick Desaulniers <[email protected]>
---
Makefile | 6 ++++++
include/asm-generic/vmlinux.lds.h | 6 +++++-
lib/Kconfig.debug | 18 ++++++++++++++++++
scripts/test_dwarf5_support.sh | 8 ++++++++
4 files changed, 37 insertions(+), 1 deletion(-)
create mode 100755 scripts/test_dwarf5_support.sh
diff --git a/Makefile b/Makefile
index 4eb3bf7ee974..1dcea03861ef 100644
--- a/Makefile
+++ b/Makefile
@@ -828,10 +828,16 @@ endif
dwarf-version-$(CONFIG_DEBUG_INFO_DWARF2) := 2
dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
+dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5
DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y)
# Binutils 2.35+ required for -gdwarf-4+ support.
dwarf-aflag := $(call as-option,-Wa$(comma)-gdwarf-$(dwarf-version-y))
KBUILD_AFLAGS += $(dwarf-aflag)
+ifdef CONFIG_CC_IS_CLANG
+ifneq ($(LLVM_IAS),1)
+DEBUG_CFLAGS += $(dwarf-aflag)
+endif
+endif
ifdef CONFIG_DEBUG_INFO_REDUCED
DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 49944f00d2b3..37dc4110875e 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -843,7 +843,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) }
/* Stabs debugging sections. */
#define STABS_DEBUG \
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index e80770fac4f0..658f32ec0c05 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -273,6 +273,24 @@ config DEBUG_INFO_DWARF4
It makes the debug information larger, but it significantly
improves the success of resolving variables in gdb on optimized code.
+config DEBUG_INFO_DWARF5
+ bool "Generate DWARF Version 5 debuginfo"
+ depends on GCC_VERSION >= 50000 || CC_IS_CLANG
+ depends on CC_IS_GCC || $(success,$(srctree)/scripts/test_dwarf5_support.sh $(CC) $(CLANG_FLAGS))
+ depends on !DEBUG_INFO_BTF
+ help
+ Generate DWARF v5 debug info. Requires binutils 2.35, gcc 5.0+ (gcc
+ 5.0+ accepts the -gdwarf-5 flag but only had partial support for some
+ draft features until 7.0), and gdb 8.0+.
+
+ Changes to the structure of debug info in Version 5 allow for around
+ 15-18% savings in resulting image and debug info section sizes as
+ compared to DWARF Version 4. DWARF Version 5 standardizes previous
+ extensions such as accelerators for symbol indexing and the format
+ for fission (.dwo/.dwp) files. Users may not want to select this
+ config if they rely on tooling that has not yet been updated to
+ support DWARF Version 5.
+
endchoice # "DWARF version"
config DEBUG_INFO_BTF
diff --git a/scripts/test_dwarf5_support.sh b/scripts/test_dwarf5_support.sh
new file mode 100755
index 000000000000..1a00484d0b2e
--- /dev/null
+++ b/scripts/test_dwarf5_support.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+# Test that assembler accepts -gdwarf-5 and .file 0 directives, which were bugs
+# in binutils < 2.35.
+# https://sourceware.org/bugzilla/show_bug.cgi?id=25612
+# https://sourceware.org/bugzilla/show_bug.cgi?id=25614
+echo '.file 0 "filename"' | $* -gdwarf-5 -Wa,-gdwarf-5 -c -x assembler -o /dev/null -
--
2.30.0.284.gd98b1dd5eaa7-goog
Modifies CONFIG_DEBUG_INFO_DWARF4 to be a member of a choice. Adds an
explicit CONFIG_DEBUG_INFO_DWARF2, which is the default. Does so in a
way that's forward compatible with existing configs, and makes adding
future versions more straightforward.
Suggested-by: Arvind Sankar <[email protected]>
Suggested-by: Fangrui Song <[email protected]>
Suggested-by: Masahiro Yamada <[email protected]>
Signed-off-by: Nick Desaulniers <[email protected]>
---
Makefile | 13 ++++++-------
lib/Kconfig.debug | 21 ++++++++++++++++-----
2 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile
index d49c3f39ceb4..4eb3bf7ee974 100644
--- a/Makefile
+++ b/Makefile
@@ -826,13 +826,12 @@ else
DEBUG_CFLAGS += -g
endif
-ifneq ($(LLVM_IAS),1)
-KBUILD_AFLAGS += -Wa,-gdwarf-2
-endif
-
-ifdef CONFIG_DEBUG_INFO_DWARF4
-DEBUG_CFLAGS += -gdwarf-4
-endif
+dwarf-version-$(CONFIG_DEBUG_INFO_DWARF2) := 2
+dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
+DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y)
+# Binutils 2.35+ required for -gdwarf-4+ support.
+dwarf-aflag := $(call as-option,-Wa$(comma)-gdwarf-$(dwarf-version-y))
+KBUILD_AFLAGS += $(dwarf-aflag)
ifdef CONFIG_DEBUG_INFO_REDUCED
DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index dd7d8d35b2a5..e80770fac4f0 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -256,13 +256,24 @@ config DEBUG_INFO_SPLIT
to know about the .dwo files and include them.
Incompatible with older versions of ccache.
+choice
+ prompt "DWARF version"
+ help
+ Which version of DWARF debug info to emit.
+
+config DEBUG_INFO_DWARF2
+ bool "Generate DWARF Version 2 debuginfo"
+ help
+ Generate DWARF v2 debug info.
+
config DEBUG_INFO_DWARF4
- bool "Generate dwarf4 debuginfo"
+ bool "Generate DWARF Version 4 debuginfo"
help
- Generate dwarf4 debug info. This requires recent versions
- of gcc and gdb. It makes the debug information larger.
- But it significantly improves the success of resolving
- variables in gdb on optimized code.
+ Generate DWARF v4 debug info. This requires gcc 4.5+ and gdb 7.0+.
+ It makes the debug information larger, but it significantly
+ improves the success of resolving variables in gdb on optimized code.
+
+endchoice # "DWARF version"
config DEBUG_INFO_BTF
bool "Generate BTF typeinfo"
--
2.30.0.284.gd98b1dd5eaa7-goog
On Fri, Jan 15, 2021 at 10:06 PM Nick Desaulniers
<[email protected]> wrote:
>
> Modifies CONFIG_DEBUG_INFO_DWARF4 to be a member of a choice. Adds an
> explicit CONFIG_DEBUG_INFO_DWARF2, which is the default. Does so in a
> way that's forward compatible with existing configs, and makes adding
> future versions more straightforward.
>
> Suggested-by: Arvind Sankar <[email protected]>
> Suggested-by: Fangrui Song <[email protected]>
> Suggested-by: Masahiro Yamada <[email protected]>
> Signed-off-by: Nick Desaulniers <[email protected]>
> ---
> Makefile | 13 ++++++-------
> lib/Kconfig.debug | 21 ++++++++++++++++-----
> 2 files changed, 22 insertions(+), 12 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index d49c3f39ceb4..4eb3bf7ee974 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -826,13 +826,12 @@ else
> DEBUG_CFLAGS += -g
> endif
>
> -ifneq ($(LLVM_IAS),1)
> -KBUILD_AFLAGS += -Wa,-gdwarf-2
> -endif
> -
> -ifdef CONFIG_DEBUG_INFO_DWARF4
> -DEBUG_CFLAGS += -gdwarf-4
> -endif
> +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF2) := 2
> +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
> +DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y)
> +# Binutils 2.35+ required for -gdwarf-4+ support.
> +dwarf-aflag := $(call as-option,-Wa$(comma)-gdwarf-$(dwarf-version-y))
> +KBUILD_AFLAGS += $(dwarf-aflag)
>
> ifdef CONFIG_DEBUG_INFO_REDUCED
> DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index dd7d8d35b2a5..e80770fac4f0 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -256,13 +256,24 @@ config DEBUG_INFO_SPLIT
> to know about the .dwo files and include them.
> Incompatible with older versions of ccache.
>
> +choice
> + prompt "DWARF version"
Here you use "DWARF version" so keep this for v2 and v4.
> + help
> + Which version of DWARF debug info to emit.
> +
> +config DEBUG_INFO_DWARF2
> + bool "Generate DWARF Version 2 debuginfo"
s/DWARF Version/DWARF version
> + help
> + Generate DWARF v2 debug info.
> +
> config DEBUG_INFO_DWARF4
> - bool "Generate dwarf4 debuginfo"
> + bool "Generate DWARF Version 4 debuginfo"
Same here: s/DWARF Version/DWARF version
- Sedat -
> help
> - Generate dwarf4 debug info. This requires recent versions
> - of gcc and gdb. It makes the debug information larger.
> - But it significantly improves the success of resolving
> - variables in gdb on optimized code.
> + Generate DWARF v4 debug info. This requires gcc 4.5+ and gdb 7.0+.
> + It makes the debug information larger, but it significantly
> + improves the success of resolving variables in gdb on optimized code.
> +
> +endchoice # "DWARF version"
>
> config DEBUG_INFO_BTF
> bool "Generate BTF typeinfo"
> --
> 2.30.0.284.gd98b1dd5eaa7-goog
>
On Fri, Jan 15, 2021 at 10:06 PM Nick Desaulniers
<[email protected]> wrote:
>
> DWARF v5 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.
>
> The DWARF version of a binary can be validated with:
> $ llvm-dwarfdump vmlinux | head -n 4 | grep version
> or
> $ readelf --debug-dump=info vmlinux 2>/dev/null | grep Version
>
> DWARF5 wins significantly in terms of size when mixed with compression
> (CONFIG_DEBUG_INFO_COMPRESSED).
>
> 363M vmlinux.clang12.dwarf5.compressed
> 434M vmlinux.clang12.dwarf4.compressed
> 439M vmlinux.clang12.dwarf2.compressed
> 457M vmlinux.clang12.dwarf5
> 536M vmlinux.clang12.dwarf4
> 548M vmlinux.clang12.dwarf2
>
> 515M vmlinux.gcc10.2.dwarf5.compressed
> 599M vmlinux.gcc10.2.dwarf4.compressed
> 624M vmlinux.gcc10.2.dwarf2.compressed
> 630M vmlinux.gcc10.2.dwarf5
> 765M vmlinux.gcc10.2.dwarf4
> 809M vmlinux.gcc10.2.dwarf2
>
> Though the quality of debug info is harder to quantify; size is not a
> proxy for quality.
>
> Jakub notes:
> All [GCC] 5.1 - 6.x did was start accepting -gdwarf-5 as experimental
> option that enabled some small DWARF subset (initially only a few
> DW_LANG_* codes newly added to DWARF5 drafts). Only GCC 7 (released
> after DWARF 5 has been finalized) started emitting DWARF5 section
> headers and got most of the DWARF5 changes in...
>
> Version check GCC so that we don't need to worry about the difference in
> command line args between GNU readelf and llvm-readelf/llvm-dwarfdump to
> validate the DWARF Version in the assembler feature detection script.
>
> GNU `as` only recently gained support for specifying -gdwarf-5, so when
> compiling with Clang but without Clang's integrated assembler
> (LLVM_IAS=1 is not set), explicitly add -Wa,-gdwarf-5 to DEBUG_CFLAGS.
>
> Disabled for now if CONFIG_DEBUG_INFO_BTF is set; pahole doesn't yet
> recognize the new additions to the DWARF debug info. Thanks to Sedat for
> the report.
>
> Link: http://www.dwarfstd.org/doc/DWARF5.pdf
> Reported-by: Sedat Dilek <[email protected]>
> Suggested-by: Arvind Sankar <[email protected]>
> Suggested-by: Caroline Tice <[email protected]>
> Suggested-by: Fangrui Song <[email protected]>
> Suggested-by: Jakub Jelinek <[email protected]>
> Suggested-by: Masahiro Yamada <[email protected]>
> Suggested-by: Nathan Chancellor <[email protected]>
> Signed-off-by: Nick Desaulniers <[email protected]>
> ---
> Makefile | 6 ++++++
> include/asm-generic/vmlinux.lds.h | 6 +++++-
> lib/Kconfig.debug | 18 ++++++++++++++++++
> scripts/test_dwarf5_support.sh | 8 ++++++++
> 4 files changed, 37 insertions(+), 1 deletion(-)
> create mode 100755 scripts/test_dwarf5_support.sh
>
> diff --git a/Makefile b/Makefile
> index 4eb3bf7ee974..1dcea03861ef 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -828,10 +828,16 @@ endif
>
> dwarf-version-$(CONFIG_DEBUG_INFO_DWARF2) := 2
> dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
> +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5
> DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y)
> # Binutils 2.35+ required for -gdwarf-4+ support.
> dwarf-aflag := $(call as-option,-Wa$(comma)-gdwarf-$(dwarf-version-y))
> KBUILD_AFLAGS += $(dwarf-aflag)
> +ifdef CONFIG_CC_IS_CLANG
> +ifneq ($(LLVM_IAS),1)
> +DEBUG_CFLAGS += $(dwarf-aflag)
> +endif
> +endif
>
> ifdef CONFIG_DEBUG_INFO_REDUCED
> DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 49944f00d2b3..37dc4110875e 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -843,7 +843,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) }
>
> /* Stabs debugging sections. */
> #define STABS_DEBUG \
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index e80770fac4f0..658f32ec0c05 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -273,6 +273,24 @@ config DEBUG_INFO_DWARF4
> It makes the debug information larger, but it significantly
> improves the success of resolving variables in gdb on optimized code.
>
> +config DEBUG_INFO_DWARF5
> + bool "Generate DWARF Version 5 debuginfo"
> + depends on GCC_VERSION >= 50000 || CC_IS_CLANG
> + depends on CC_IS_GCC || $(success,$(srctree)/scripts/test_dwarf5_support.sh $(CC) $(CLANG_FLAGS))
Better keep GCC depends in one line:
+ depends on CC_IS_GCC && GCC_VERSION >= 50000 || CC_IS_CLANG
+ depends on $(success,$(srctree)/scripts/test_dwarf5_support.sh
$(CC) $(CLANG_FLAGS))
As said in the other patch:
Use consistently: s/DWARF Version/DWARF version/g
- Sedat -
> + depends on !DEBUG_INFO_BTF
> + help
> + Generate DWARF v5 debug info. Requires binutils 2.35, gcc 5.0+ (gcc
> + 5.0+ accepts the -gdwarf-5 flag but only had partial support for some
> + draft features until 7.0), and gdb 8.0+.
> +
> + Changes to the structure of debug info in Version 5 allow for around
> + 15-18% savings in resulting image and debug info section sizes as
> + compared to DWARF Version 4. DWARF Version 5 standardizes previous
> + extensions such as accelerators for symbol indexing and the format
> + for fission (.dwo/.dwp) files. Users may not want to select this
> + config if they rely on tooling that has not yet been updated to
> + support DWARF Version 5.
> +
> endchoice # "DWARF version"
>
> config DEBUG_INFO_BTF
> diff --git a/scripts/test_dwarf5_support.sh b/scripts/test_dwarf5_support.sh
> new file mode 100755
> index 000000000000..1a00484d0b2e
> --- /dev/null
> +++ b/scripts/test_dwarf5_support.sh
> @@ -0,0 +1,8 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0
> +
> +# Test that assembler accepts -gdwarf-5 and .file 0 directives, which were bugs
> +# in binutils < 2.35.
> +# https://sourceware.org/bugzilla/show_bug.cgi?id=25612
> +# https://sourceware.org/bugzilla/show_bug.cgi?id=25614
> +echo '.file 0 "filename"' | $* -gdwarf-5 -Wa,-gdwarf-5 -c -x assembler -o /dev/null -
> --
> 2.30.0.284.gd98b1dd5eaa7-goog
>
On Fri, Jan 15, 2021 at 10:06 PM Nick Desaulniers
<[email protected]> wrote:
>
> From: Masahiro Yamada <[email protected]>
>
> The -gdwarf-4 flag is supported by GCC 4.5+, and also by Clang.
>
> You can see it at https://godbolt.org/z/6ed1oW
>
> For gcc 4.5.3 pane, line 37: .value 0x4
> For clang 10.0.1 pane, line 117: .short 4
>
> Given Documentation/process/changes.rst stating GCC 4.9 is the minimal
> version, this cc-option is unneeded.
>
> Note
> ----
>
> CONFIG_DEBUG_INFO_DWARF4 controls the DWARF version only for C files.
>
> As you can see in the top Makefile, -gdwarf-4 is only passed to CFLAGS.
>
> ifdef CONFIG_DEBUG_INFO_DWARF4
> DEBUG_CFLAGS += -gdwarf-4
> endif
>
> This flag is used when compiling *.c files.
>
> On the other hand, the assembler is always given -gdwarf-2.
>
> KBUILD_AFLAGS += -Wa,-gdwarf-2
>
> Hence, the debug info that comes from *.S files is always DWARF v2.
> This is simply because GAS supported only -gdwarf-2 for a long time.
>
> Recently, GAS gained the support for --dwarf-[3|4|5] options. [1]
> And, also we have Clang integrated assembler. So, the debug info
> for *.S files might be improved if we want.
>
> In my understanding, the current code is intentional, not a bug.
>
> [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=31bf18645d98b4d3d7357353be840e320649a67d
>
> Reviewed-by: Nick Desaulniers <[email protected]>
> Reviewed-by: Nathan Chancellor <[email protected]>
> Signed-off-by: Masahiro Yamada <[email protected]>
Subject misses a "kbuild:" label like in all other patches.
You have:
"Remove $(cc-option,-gdwarf-4) dependency from CONFIG_DEBUG_INFO_DWARF4"
- Sedat -
> ---
> lib/Kconfig.debug | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 78361f0abe3a..dd7d8d35b2a5 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -258,7 +258,6 @@ config DEBUG_INFO_SPLIT
>
> config DEBUG_INFO_DWARF4
> bool "Generate dwarf4 debuginfo"
> - depends on $(cc-option,-gdwarf-4)
> help
> Generate dwarf4 debug info. This requires recent versions
> of gcc and gdb. It makes the debug information larger.
> --
> 2.30.0.284.gd98b1dd5eaa7-goog
>
On Fri, Jan 15, 2021 at 1:46 PM Sedat Dilek <[email protected]> wrote:
>
> On Fri, Jan 15, 2021 at 10:06 PM Nick Desaulniers
> <[email protected]> wrote:
> >
> > DWARF v5 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.
> >
> > The DWARF version of a binary can be validated with:
> > $ llvm-dwarfdump vmlinux | head -n 4 | grep version
> > or
> > $ readelf --debug-dump=info vmlinux 2>/dev/null | grep Version
> >
> > DWARF5 wins significantly in terms of size when mixed with compression
> > (CONFIG_DEBUG_INFO_COMPRESSED).
> >
> > 363M vmlinux.clang12.dwarf5.compressed
> > 434M vmlinux.clang12.dwarf4.compressed
> > 439M vmlinux.clang12.dwarf2.compressed
> > 457M vmlinux.clang12.dwarf5
> > 536M vmlinux.clang12.dwarf4
> > 548M vmlinux.clang12.dwarf2
> >
> > 515M vmlinux.gcc10.2.dwarf5.compressed
> > 599M vmlinux.gcc10.2.dwarf4.compressed
> > 624M vmlinux.gcc10.2.dwarf2.compressed
> > 630M vmlinux.gcc10.2.dwarf5
> > 765M vmlinux.gcc10.2.dwarf4
> > 809M vmlinux.gcc10.2.dwarf2
> >
> > Though the quality of debug info is harder to quantify; size is not a
> > proxy for quality.
> >
> > Jakub notes:
> > All [GCC] 5.1 - 6.x did was start accepting -gdwarf-5 as experimental
> > option that enabled some small DWARF subset (initially only a few
> > DW_LANG_* codes newly added to DWARF5 drafts). Only GCC 7 (released
> > after DWARF 5 has been finalized) started emitting DWARF5 section
> > headers and got most of the DWARF5 changes in...
> >
> > Version check GCC so that we don't need to worry about the difference in
> > command line args between GNU readelf and llvm-readelf/llvm-dwarfdump to
> > validate the DWARF Version in the assembler feature detection script.
> >
> > GNU `as` only recently gained support for specifying -gdwarf-5, so when
> > compiling with Clang but without Clang's integrated assembler
> > (LLVM_IAS=1 is not set), explicitly add -Wa,-gdwarf-5 to DEBUG_CFLAGS.
> >
> > Disabled for now if CONFIG_DEBUG_INFO_BTF is set; pahole doesn't yet
> > recognize the new additions to the DWARF debug info. Thanks to Sedat for
> > the report.
> >
> > Link: http://www.dwarfstd.org/doc/DWARF5.pdf
> > Reported-by: Sedat Dilek <[email protected]>
> > Suggested-by: Arvind Sankar <[email protected]>
> > Suggested-by: Caroline Tice <[email protected]>
> > Suggested-by: Fangrui Song <[email protected]>
> > Suggested-by: Jakub Jelinek <[email protected]>
> > Suggested-by: Masahiro Yamada <[email protected]>
> > Suggested-by: Nathan Chancellor <[email protected]>
> > Signed-off-by: Nick Desaulniers <[email protected]>
> > ---
> > Makefile | 6 ++++++
> > include/asm-generic/vmlinux.lds.h | 6 +++++-
> > lib/Kconfig.debug | 18 ++++++++++++++++++
> > scripts/test_dwarf5_support.sh | 8 ++++++++
> > 4 files changed, 37 insertions(+), 1 deletion(-)
> > create mode 100755 scripts/test_dwarf5_support.sh
> >
> > diff --git a/Makefile b/Makefile
> > index 4eb3bf7ee974..1dcea03861ef 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -828,10 +828,16 @@ endif
> >
> > dwarf-version-$(CONFIG_DEBUG_INFO_DWARF2) := 2
> > dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
> > +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5
> > DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y)
> > # Binutils 2.35+ required for -gdwarf-4+ support.
> > dwarf-aflag := $(call as-option,-Wa$(comma)-gdwarf-$(dwarf-version-y))
> > KBUILD_AFLAGS += $(dwarf-aflag)
> > +ifdef CONFIG_CC_IS_CLANG
> > +ifneq ($(LLVM_IAS),1)
> > +DEBUG_CFLAGS += $(dwarf-aflag)
> > +endif
> > +endif
> >
> > ifdef CONFIG_DEBUG_INFO_REDUCED
> > DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
> > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> > index 49944f00d2b3..37dc4110875e 100644
> > --- a/include/asm-generic/vmlinux.lds.h
> > +++ b/include/asm-generic/vmlinux.lds.h
> > @@ -843,7 +843,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) }
> >
> > /* Stabs debugging sections. */
> > #define STABS_DEBUG \
> > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > index e80770fac4f0..658f32ec0c05 100644
> > --- a/lib/Kconfig.debug
> > +++ b/lib/Kconfig.debug
> > @@ -273,6 +273,24 @@ config DEBUG_INFO_DWARF4
> > It makes the debug information larger, but it significantly
> > improves the success of resolving variables in gdb on optimized code.
> >
> > +config DEBUG_INFO_DWARF5
> > + bool "Generate DWARF Version 5 debuginfo"
> > + depends on GCC_VERSION >= 50000 || CC_IS_CLANG
> > + depends on CC_IS_GCC || $(success,$(srctree)/scripts/test_dwarf5_support.sh $(CC) $(CLANG_FLAGS))
>
> Better keep GCC depends in one line:
>
> + depends on CC_IS_GCC && GCC_VERSION >= 50000 || CC_IS_CLANG
> + depends on $(success,$(srctree)/scripts/test_dwarf5_support.sh
> $(CC) $(CLANG_FLAGS))
It's intentional, if a bit obtuse:
We don't want to check the assembler support for -Wa,-gdwarf-5 via
compiler driver when CC=gcc; instead, we'll rely on how GCC was
configured as per Arvind.
>
> As said in the other patch:
>
> Use consistently: s/DWARF Version/DWARF version/g
Ah right, and I forget your point about kbuild/Kbuild. Will wait for
more feedback then send a v6 next week. Thanks as always for the
feedback.
>
> - Sedat -
>
> > + depends on !DEBUG_INFO_BTF
> > + help
> > + Generate DWARF v5 debug info. Requires binutils 2.35, gcc 5.0+ (gcc
> > + 5.0+ accepts the -gdwarf-5 flag but only had partial support for some
> > + draft features until 7.0), and gdb 8.0+.
> > +
> > + Changes to the structure of debug info in Version 5 allow for around
> > + 15-18% savings in resulting image and debug info section sizes as
> > + compared to DWARF Version 4. DWARF Version 5 standardizes previous
> > + extensions such as accelerators for symbol indexing and the format
> > + for fission (.dwo/.dwp) files. Users may not want to select this
> > + config if they rely on tooling that has not yet been updated to
> > + support DWARF Version 5.
> > +
> > endchoice # "DWARF version"
> >
> > config DEBUG_INFO_BTF
> > diff --git a/scripts/test_dwarf5_support.sh b/scripts/test_dwarf5_support.sh
> > new file mode 100755
> > index 000000000000..1a00484d0b2e
> > --- /dev/null
> > +++ b/scripts/test_dwarf5_support.sh
> > @@ -0,0 +1,8 @@
> > +#!/bin/sh
> > +# SPDX-License-Identifier: GPL-2.0
> > +
> > +# Test that assembler accepts -gdwarf-5 and .file 0 directives, which were bugs
> > +# in binutils < 2.35.
> > +# https://sourceware.org/bugzilla/show_bug.cgi?id=25612
> > +# https://sourceware.org/bugzilla/show_bug.cgi?id=25614
> > +echo '.file 0 "filename"' | $* -gdwarf-5 -Wa,-gdwarf-5 -c -x assembler -o /dev/null -
> > --
> > 2.30.0.284.gd98b1dd5eaa7-goog
> >
--
Thanks,
~Nick Desaulniers
On Fri, Jan 15, 2021 at 1:48 PM Sedat Dilek <[email protected]> wrote:
>
> On Fri, Jan 15, 2021 at 10:06 PM Nick Desaulniers
> <[email protected]> wrote:
> >
> > From: Masahiro Yamada <[email protected]>
> >
> > The -gdwarf-4 flag is supported by GCC 4.5+, and also by Clang.
> >
> > You can see it at https://godbolt.org/z/6ed1oW
> >
> > For gcc 4.5.3 pane, line 37: .value 0x4
> > For clang 10.0.1 pane, line 117: .short 4
> >
> > Given Documentation/process/changes.rst stating GCC 4.9 is the minimal
> > version, this cc-option is unneeded.
> >
> > Note
> > ----
> >
> > CONFIG_DEBUG_INFO_DWARF4 controls the DWARF version only for C files.
> >
> > As you can see in the top Makefile, -gdwarf-4 is only passed to CFLAGS.
> >
> > ifdef CONFIG_DEBUG_INFO_DWARF4
> > DEBUG_CFLAGS += -gdwarf-4
> > endif
> >
> > This flag is used when compiling *.c files.
> >
> > On the other hand, the assembler is always given -gdwarf-2.
> >
> > KBUILD_AFLAGS += -Wa,-gdwarf-2
> >
> > Hence, the debug info that comes from *.S files is always DWARF v2.
> > This is simply because GAS supported only -gdwarf-2 for a long time.
> >
> > Recently, GAS gained the support for --dwarf-[3|4|5] options. [1]
> > And, also we have Clang integrated assembler. So, the debug info
> > for *.S files might be improved if we want.
> >
> > In my understanding, the current code is intentional, not a bug.
> >
> > [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=31bf18645d98b4d3d7357353be840e320649a67d
> >
> > Reviewed-by: Nick Desaulniers <[email protected]>
> > Reviewed-by: Nathan Chancellor <[email protected]>
> > Signed-off-by: Masahiro Yamada <[email protected]>
>
> Subject misses a "kbuild:" label like in all other patches.
> You have:
> "Remove $(cc-option,-gdwarf-4) dependency from CONFIG_DEBUG_INFO_DWARF4"
Ack, I wonder how that happened? Ah well, will fix in v6; thanks for
the feedback.
>
> - Sedat -
>
> > ---
> > lib/Kconfig.debug | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > index 78361f0abe3a..dd7d8d35b2a5 100644
> > --- a/lib/Kconfig.debug
> > +++ b/lib/Kconfig.debug
> > @@ -258,7 +258,6 @@ config DEBUG_INFO_SPLIT
> >
> > config DEBUG_INFO_DWARF4
> > bool "Generate dwarf4 debuginfo"
> > - depends on $(cc-option,-gdwarf-4)
> > help
> > Generate dwarf4 debug info. This requires recent versions
> > of gcc and gdb. It makes the debug information larger.
> > --
> > 2.30.0.284.gd98b1dd5eaa7-goog
> >
--
Thanks,
~Nick Desaulniers
On Fri, Jan 15, 2021 at 10:06 PM Nick Desaulniers
<[email protected]> wrote:
>
> DWARF v5 is the latest standard of the DWARF debug info format.
>
> DWARF5 wins significantly in terms of size when mixed with compression
> (CONFIG_DEBUG_INFO_COMPRESSED).
>
> Link: http://www.dwarfstd.org/doc/DWARF5.pdf
>
> Patch 1 is a cleanup from Masahiro and isn't DWARF v5 specific.
> Patch 2 is a cleanup that lays the ground work and isn't DWARF
> v5 specific.
> Patch 3 implements Kconfig and Kbuild support for DWARFv5.
>
> 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.
>
En plus, I encountered breakage with GCC v10.2.1 and LLVM=1 and
CONFIG_DEBUG_INFO_DWARF4.
So might be good to add a "depends on !DEBUG_INFO_BTF" in this combination.
I had some other small nits commented in the single patches.
As requested in your previous patch-series, feel free to add my:
Tested-by: Sedat Dilek <[email protected]>
- Sedat -
> 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.
>
> *** BLURB HERE ***
>
> Masahiro Yamada (1):
> Remove $(cc-option,-gdwarf-4) dependency from CONFIG_DEBUG_INFO_DWARF4
>
> Nick Desaulniers (2):
> Kbuild: make DWARF version a choice
> Kbuild: implement support for DWARF v5
>
> Makefile | 13 +++++++---
> include/asm-generic/vmlinux.lds.h | 6 ++++-
> lib/Kconfig.debug | 42 +++++++++++++++++++++++++------
> scripts/test_dwarf5_support.sh | 8 ++++++
> 4 files changed, 57 insertions(+), 12 deletions(-)
> create mode 100755 scripts/test_dwarf5_support.sh
>
> --
> 2.30.0.284.gd98b1dd5eaa7-goog
>
On Fri, Jan 15, 2021 at 10:49 PM Nick Desaulniers
<[email protected]> wrote:
>
> On Fri, Jan 15, 2021 at 1:46 PM Sedat Dilek <[email protected]> wrote:
> >
> > On Fri, Jan 15, 2021 at 10:06 PM Nick Desaulniers
> > <[email protected]> wrote:
> > >
> > > DWARF v5 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.
> > >
> > > The DWARF version of a binary can be validated with:
> > > $ llvm-dwarfdump vmlinux | head -n 4 | grep version
> > > or
> > > $ readelf --debug-dump=info vmlinux 2>/dev/null | grep Version
> > >
> > > DWARF5 wins significantly in terms of size when mixed with compression
> > > (CONFIG_DEBUG_INFO_COMPRESSED).
> > >
> > > 363M vmlinux.clang12.dwarf5.compressed
> > > 434M vmlinux.clang12.dwarf4.compressed
> > > 439M vmlinux.clang12.dwarf2.compressed
> > > 457M vmlinux.clang12.dwarf5
> > > 536M vmlinux.clang12.dwarf4
> > > 548M vmlinux.clang12.dwarf2
> > >
> > > 515M vmlinux.gcc10.2.dwarf5.compressed
> > > 599M vmlinux.gcc10.2.dwarf4.compressed
> > > 624M vmlinux.gcc10.2.dwarf2.compressed
> > > 630M vmlinux.gcc10.2.dwarf5
> > > 765M vmlinux.gcc10.2.dwarf4
> > > 809M vmlinux.gcc10.2.dwarf2
> > >
> > > Though the quality of debug info is harder to quantify; size is not a
> > > proxy for quality.
> > >
> > > Jakub notes:
> > > All [GCC] 5.1 - 6.x did was start accepting -gdwarf-5 as experimental
> > > option that enabled some small DWARF subset (initially only a few
> > > DW_LANG_* codes newly added to DWARF5 drafts). Only GCC 7 (released
> > > after DWARF 5 has been finalized) started emitting DWARF5 section
> > > headers and got most of the DWARF5 changes in...
> > >
> > > Version check GCC so that we don't need to worry about the difference in
> > > command line args between GNU readelf and llvm-readelf/llvm-dwarfdump to
> > > validate the DWARF Version in the assembler feature detection script.
> > >
> > > GNU `as` only recently gained support for specifying -gdwarf-5, so when
> > > compiling with Clang but without Clang's integrated assembler
> > > (LLVM_IAS=1 is not set), explicitly add -Wa,-gdwarf-5 to DEBUG_CFLAGS.
> > >
> > > Disabled for now if CONFIG_DEBUG_INFO_BTF is set; pahole doesn't yet
> > > recognize the new additions to the DWARF debug info. Thanks to Sedat for
> > > the report.
> > >
> > > Link: http://www.dwarfstd.org/doc/DWARF5.pdf
> > > Reported-by: Sedat Dilek <[email protected]>
> > > Suggested-by: Arvind Sankar <[email protected]>
> > > Suggested-by: Caroline Tice <[email protected]>
> > > Suggested-by: Fangrui Song <[email protected]>
> > > Suggested-by: Jakub Jelinek <[email protected]>
> > > Suggested-by: Masahiro Yamada <[email protected]>
> > > Suggested-by: Nathan Chancellor <[email protected]>
> > > Signed-off-by: Nick Desaulniers <[email protected]>
> > > ---
> > > Makefile | 6 ++++++
> > > include/asm-generic/vmlinux.lds.h | 6 +++++-
> > > lib/Kconfig.debug | 18 ++++++++++++++++++
> > > scripts/test_dwarf5_support.sh | 8 ++++++++
> > > 4 files changed, 37 insertions(+), 1 deletion(-)
> > > create mode 100755 scripts/test_dwarf5_support.sh
> > >
> > > diff --git a/Makefile b/Makefile
> > > index 4eb3bf7ee974..1dcea03861ef 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -828,10 +828,16 @@ endif
> > >
> > > dwarf-version-$(CONFIG_DEBUG_INFO_DWARF2) := 2
> > > dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
> > > +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5
> > > DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y)
> > > # Binutils 2.35+ required for -gdwarf-4+ support.
> > > dwarf-aflag := $(call as-option,-Wa$(comma)-gdwarf-$(dwarf-version-y))
> > > KBUILD_AFLAGS += $(dwarf-aflag)
> > > +ifdef CONFIG_CC_IS_CLANG
> > > +ifneq ($(LLVM_IAS),1)
> > > +DEBUG_CFLAGS += $(dwarf-aflag)
> > > +endif
> > > +endif
> > >
> > > ifdef CONFIG_DEBUG_INFO_REDUCED
> > > DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
> > > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> > > index 49944f00d2b3..37dc4110875e 100644
> > > --- a/include/asm-generic/vmlinux.lds.h
> > > +++ b/include/asm-generic/vmlinux.lds.h
> > > @@ -843,7 +843,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) }
> > >
> > > /* Stabs debugging sections. */
> > > #define STABS_DEBUG \
> > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > > index e80770fac4f0..658f32ec0c05 100644
> > > --- a/lib/Kconfig.debug
> > > +++ b/lib/Kconfig.debug
> > > @@ -273,6 +273,24 @@ config DEBUG_INFO_DWARF4
> > > It makes the debug information larger, but it significantly
> > > improves the success of resolving variables in gdb on optimized code.
> > >
> > > +config DEBUG_INFO_DWARF5
> > > + bool "Generate DWARF Version 5 debuginfo"
> > > + depends on GCC_VERSION >= 50000 || CC_IS_CLANG
> > > + depends on CC_IS_GCC || $(success,$(srctree)/scripts/test_dwarf5_support.sh $(CC) $(CLANG_FLAGS))
> >
> > Better keep GCC depends in one line:
> >
> > + depends on CC_IS_GCC && GCC_VERSION >= 50000 || CC_IS_CLANG
> > + depends on $(success,$(srctree)/scripts/test_dwarf5_support.sh
> > $(CC) $(CLANG_FLAGS))
>
> It's intentional, if a bit obtuse:
> We don't want to check the assembler support for -Wa,-gdwarf-5 via
> compiler driver when CC=gcc; instead, we'll rely on how GCC was
> configured as per Arvind.
>
Hmm, OK.
I have not tested my diff in diverse setup/combination of compiler and
"bin"utils.
So, I did not want to have a different behaviour.
Can you comment on this intentional setting in v6?
Thanks.
- Sedat -
> >
> > As said in the other patch:
> >
> > Use consistently: s/DWARF Version/DWARF version/g
>
> Ah right, and I forget your point about kbuild/Kbuild. Will wait for
> more feedback then send a v6 next week. Thanks as always for the
> feedback.
>
> >
> > - Sedat -
> >
> > > + depends on !DEBUG_INFO_BTF
> > > + help
> > > + Generate DWARF v5 debug info. Requires binutils 2.35, gcc 5.0+ (gcc
> > > + 5.0+ accepts the -gdwarf-5 flag but only had partial support for some
> > > + draft features until 7.0), and gdb 8.0+.
> > > +
> > > + Changes to the structure of debug info in Version 5 allow for around
> > > + 15-18% savings in resulting image and debug info section sizes as
> > > + compared to DWARF Version 4. DWARF Version 5 standardizes previous
> > > + extensions such as accelerators for symbol indexing and the format
> > > + for fission (.dwo/.dwp) files. Users may not want to select this
> > > + config if they rely on tooling that has not yet been updated to
> > > + support DWARF Version 5.
> > > +
> > > endchoice # "DWARF version"
> > >
> > > config DEBUG_INFO_BTF
> > > diff --git a/scripts/test_dwarf5_support.sh b/scripts/test_dwarf5_support.sh
> > > new file mode 100755
> > > index 000000000000..1a00484d0b2e
> > > --- /dev/null
> > > +++ b/scripts/test_dwarf5_support.sh
> > > @@ -0,0 +1,8 @@
> > > +#!/bin/sh
> > > +# SPDX-License-Identifier: GPL-2.0
> > > +
> > > +# Test that assembler accepts -gdwarf-5 and .file 0 directives, which were bugs
> > > +# in binutils < 2.35.
> > > +# https://sourceware.org/bugzilla/show_bug.cgi?id=25612
> > > +# https://sourceware.org/bugzilla/show_bug.cgi?id=25614
> > > +echo '.file 0 "filename"' | $* -gdwarf-5 -Wa,-gdwarf-5 -c -x assembler -o /dev/null -
> > > --
> > > 2.30.0.284.gd98b1dd5eaa7-goog
> > >
>
>
>
> --
> Thanks,
> ~Nick Desaulniers
On 2021-01-15, Nick Desaulniers wrote:
>From: Masahiro Yamada <[email protected]>
>
>The -gdwarf-4 flag is supported by GCC 4.5+, and also by Clang.
>
>You can see it at https://godbolt.org/z/6ed1oW
>
> For gcc 4.5.3 pane, line 37: .value 0x4
> For clang 10.0.1 pane, line 117: .short 4
>
>Given Documentation/process/changes.rst stating GCC 4.9 is the minimal
>version, this cc-option is unneeded.
>
>Note
>----
>
>CONFIG_DEBUG_INFO_DWARF4 controls the DWARF version only for C files.
>
>As you can see in the top Makefile, -gdwarf-4 is only passed to CFLAGS.
>
> ifdef CONFIG_DEBUG_INFO_DWARF4
> DEBUG_CFLAGS += -gdwarf-4
> endif
>
>This flag is used when compiling *.c files.
>
>On the other hand, the assembler is always given -gdwarf-2.
>
> KBUILD_AFLAGS += -Wa,-gdwarf-2
>
>Hence, the debug info that comes from *.S files is always DWARF v2.
>This is simply because GAS supported only -gdwarf-2 for a long time.
>
>Recently, GAS gained the support for --dwarf-[3|4|5] options. [1]
The gas commit description has a typo. The supported options are -gdwarf-[345] or --gdwarf-[345].
-gdwarf2 and --gdwarf2 are kept for compatibility.
Looks good otherwise.
>And, also we have Clang integrated assembler. So, the debug info
>for *.S files might be improved if we want.
>
>In my understanding, the current code is intentional, not a bug.
>
>[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=31bf18645d98b4d3d7357353be840e320649a67d
>
>Reviewed-by: Nick Desaulniers <[email protected]>
>Reviewed-by: Nathan Chancellor <[email protected]>
>Signed-off-by: Masahiro Yamada <[email protected]>
>---
> lib/Kconfig.debug | 1 -
> 1 file changed, 1 deletion(-)
>
>diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
>index 78361f0abe3a..dd7d8d35b2a5 100644
>--- a/lib/Kconfig.debug
>+++ b/lib/Kconfig.debug
>@@ -258,7 +258,6 @@ config DEBUG_INFO_SPLIT
>
> config DEBUG_INFO_DWARF4
> bool "Generate dwarf4 debuginfo"
>- depends on $(cc-option,-gdwarf-4)
> help
> Generate dwarf4 debug info. This requires recent versions
> of gcc and gdb. It makes the debug information larger.
>--
>2.30.0.284.gd98b1dd5eaa7-goog
>
On Fri, Jan 15, 2021 at 11:00 PM Fangrui Song <[email protected]> wrote:
>
> On 2021-01-15, Nick Desaulniers wrote:
> >From: Masahiro Yamada <[email protected]>
> >
> >The -gdwarf-4 flag is supported by GCC 4.5+, and also by Clang.
> >
> >You can see it at https://godbolt.org/z/6ed1oW
> >
> > For gcc 4.5.3 pane, line 37: .value 0x4
> > For clang 10.0.1 pane, line 117: .short 4
> >
> >Given Documentation/process/changes.rst stating GCC 4.9 is the minimal
> >version, this cc-option is unneeded.
> >
> >Note
> >----
> >
> >CONFIG_DEBUG_INFO_DWARF4 controls the DWARF version only for C files.
> >
> >As you can see in the top Makefile, -gdwarf-4 is only passed to CFLAGS.
> >
> > ifdef CONFIG_DEBUG_INFO_DWARF4
> > DEBUG_CFLAGS += -gdwarf-4
> > endif
> >
> >This flag is used when compiling *.c files.
> >
> >On the other hand, the assembler is always given -gdwarf-2.
> >
> > KBUILD_AFLAGS += -Wa,-gdwarf-2
> >
> >Hence, the debug info that comes from *.S files is always DWARF v2.
> >This is simply because GAS supported only -gdwarf-2 for a long time.
> >
> >Recently, GAS gained the support for --dwarf-[3|4|5] options. [1]
>
> The gas commit description has a typo. The supported options are -gdwarf-[345] or --gdwarf-[345].
> -gdwarf2 and --gdwarf2 are kept for compatibility.
>
> Looks good otherwise.
>
Good catch Fangrui.
Yesterday, I wondered - after a cut-n-paste from the patch's changelog
- why I did not see anything --dwarfX related in my logs.
- Sedat -
> >And, also we have Clang integrated assembler. So, the debug info
> >for *.S files might be improved if we want.
> >
> >In my understanding, the current code is intentional, not a bug.
> >
> >[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=31bf18645d98b4d3d7357353be840e320649a67d
> >
> >Reviewed-by: Nick Desaulniers <[email protected]>
> >Reviewed-by: Nathan Chancellor <[email protected]>
> >Signed-off-by: Masahiro Yamada <[email protected]>
> >---
> > lib/Kconfig.debug | 1 -
> > 1 file changed, 1 deletion(-)
> >
> >diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> >index 78361f0abe3a..dd7d8d35b2a5 100644
> >--- a/lib/Kconfig.debug
> >+++ b/lib/Kconfig.debug
> >@@ -258,7 +258,6 @@ config DEBUG_INFO_SPLIT
> >
> > config DEBUG_INFO_DWARF4
> > bool "Generate dwarf4 debuginfo"
> >- depends on $(cc-option,-gdwarf-4)
> > help
> > Generate dwarf4 debug info. This requires recent versions
> > of gcc and gdb. It makes the debug information larger.
> >--
> >2.30.0.284.gd98b1dd5eaa7-goog
> >
On 2021-01-15, Sedat Dilek wrote:
>On Fri, Jan 15, 2021 at 10:06 PM Nick Desaulniers
><[email protected]> wrote:
>>
>> Modifies CONFIG_DEBUG_INFO_DWARF4 to be a member of a choice. Adds an
>> explicit CONFIG_DEBUG_INFO_DWARF2, which is the default. Does so in a
>> way that's forward compatible with existing configs, and makes adding
>> future versions more straightforward.
>>
>> Suggested-by: Arvind Sankar <[email protected]>
>> Suggested-by: Fangrui Song <[email protected]>
>> Suggested-by: Masahiro Yamada <[email protected]>
>> Signed-off-by: Nick Desaulniers <[email protected]>
>> ---
>> Makefile | 13 ++++++-------
>> lib/Kconfig.debug | 21 ++++++++++++++++-----
>> 2 files changed, 22 insertions(+), 12 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index d49c3f39ceb4..4eb3bf7ee974 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -826,13 +826,12 @@ else
>> DEBUG_CFLAGS += -g
>> endif
>>
>> -ifneq ($(LLVM_IAS),1)
>> -KBUILD_AFLAGS += -Wa,-gdwarf-2
>> -endif
>> -
>> -ifdef CONFIG_DEBUG_INFO_DWARF4
>> -DEBUG_CFLAGS += -gdwarf-4
>> -endif
>> +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF2) := 2
>> +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
>> +DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y)
>> +# Binutils 2.35+ required for -gdwarf-4+ support.
>> +dwarf-aflag := $(call as-option,-Wa$(comma)-gdwarf-$(dwarf-version-y))
>> +KBUILD_AFLAGS += $(dwarf-aflag)
>>
>> ifdef CONFIG_DEBUG_INFO_REDUCED
>> DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
>> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
>> index dd7d8d35b2a5..e80770fac4f0 100644
>> --- a/lib/Kconfig.debug
>> +++ b/lib/Kconfig.debug
>> @@ -256,13 +256,24 @@ config DEBUG_INFO_SPLIT
>> to know about the .dwo files and include them.
>> Incompatible with older versions of ccache.
>>
>> +choice
>> + prompt "DWARF version"
>
>Here you use "DWARF version" so keep this for v2 and v4.
>
>> + help
>> + Which version of DWARF debug info to emit.
>> +
>> +config DEBUG_INFO_DWARF2
>> + bool "Generate DWARF Version 2 debuginfo"
>
>s/DWARF Version/DWARF version
>
>> + help
>> + Generate DWARF v2 debug info.
>> +
>> config DEBUG_INFO_DWARF4
>> - bool "Generate dwarf4 debuginfo"
>> + bool "Generate DWARF Version 4 debuginfo"
>
>Same here: s/DWARF Version/DWARF version
DWARF Version 2 is fine and preferable.
I have checked DWARF Version 2/3/4/5 specifications.
"DWARF Version 2" is the official way that version is referred to...
>
>- Sedat -
>
>> help
>> - Generate dwarf4 debug info. This requires recent versions
>> - of gcc and gdb. It makes the debug information larger.
>> - But it significantly improves the success of resolving
>> - variables in gdb on optimized code.
>> + Generate DWARF v4 debug info. This requires gcc 4.5+ and gdb 7.0+.
>> + It makes the debug information larger, but it significantly
>> + improves the success of resolving variables in gdb on optimized code.
>> +
>> +endchoice # "DWARF version"
>>
>> config DEBUG_INFO_BTF
>> bool "Generate BTF typeinfo"
>> --
>> 2.30.0.284.gd98b1dd5eaa7-goog
>>
On 1/15/21 1:53 PM, Sedat Dilek wrote:
> On Fri, Jan 15, 2021 at 10:06 PM Nick Desaulniers
> <[email protected]> wrote:
>>
>> DWARF v5 is the latest standard of the DWARF debug info format.
>>
>> DWARF5 wins significantly in terms of size when mixed with compression
>> (CONFIG_DEBUG_INFO_COMPRESSED).
>>
>> Link: http://www.dwarfstd.org/doc/DWARF5.pdf
>>
>> Patch 1 is a cleanup from Masahiro and isn't DWARF v5 specific.
>> Patch 2 is a cleanup that lays the ground work and isn't DWARF
>> v5 specific.
>> Patch 3 implements Kconfig and Kbuild support for DWARFv5.
>>
>> 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.
>>
>
> En plus, I encountered breakage with GCC v10.2.1 and LLVM=1 and
> CONFIG_DEBUG_INFO_DWARF4.
> So might be good to add a "depends on !DEBUG_INFO_BTF" in this combination.
I suggested not to add !DEBUG_INFO_BTF to CONFIG_DEBUG_INFO_DWARF4.
It is not there before and adding this may suddenly break some users.
If certain combination of gcc/llvm does not work for
CONFIG_DEBUG_INFO_DWARF4 with pahole, this is a bug bpf community
should fix.
>
> I had some other small nits commented in the single patches.
>
> As requested in your previous patch-series, feel free to add my:
>
> Tested-by: Sedat Dilek <[email protected]>
>
> - Sedat -
>
>> 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.
>>
>> *** BLURB HERE ***
>>
>> Masahiro Yamada (1):
>> Remove $(cc-option,-gdwarf-4) dependency from CONFIG_DEBUG_INFO_DWARF4
>>
>> Nick Desaulniers (2):
>> Kbuild: make DWARF version a choice
>> Kbuild: implement support for DWARF v5
>>
>> Makefile | 13 +++++++---
>> include/asm-generic/vmlinux.lds.h | 6 ++++-
>> lib/Kconfig.debug | 42 +++++++++++++++++++++++++------
>> scripts/test_dwarf5_support.sh | 8 ++++++
>> 4 files changed, 57 insertions(+), 12 deletions(-)
>> create mode 100755 scripts/test_dwarf5_support.sh
>>
>> --
>> 2.30.0.284.gd98b1dd5eaa7-goog
>>
On Fri, Jan 15, 2021 at 3:24 PM Yonghong Song <[email protected]> wrote:
>
>
>
> On 1/15/21 1:53 PM, Sedat Dilek wrote:
> > En plus, I encountered breakage with GCC v10.2.1 and LLVM=1 and
> > CONFIG_DEBUG_INFO_DWARF4.
> > So might be good to add a "depends on !DEBUG_INFO_BTF" in this combination.
Can you privately send me your configs that repro? Maybe I can isolate
it to a set of configs?
>
> I suggested not to add !DEBUG_INFO_BTF to CONFIG_DEBUG_INFO_DWARF4.
> It is not there before and adding this may suddenly break some users.
>
> If certain combination of gcc/llvm does not work for
> CONFIG_DEBUG_INFO_DWARF4 with pahole, this is a bug bpf community
> should fix.
Is there a place I should report bugs?
>
> >
> > I had some other small nits commented in the single patches.
> >
> > As requested in your previous patch-series, feel free to add my:
> >
> > Tested-by: Sedat Dilek <[email protected]>
Yeah, I'll keep it if v6 is just commit message changes.
--
Thanks,
~Nick Desaulniers
On 1/15/21 3:34 PM, Nick Desaulniers wrote:
> On Fri, Jan 15, 2021 at 3:24 PM Yonghong Song <[email protected]> wrote:
>>
>>
>>
>> On 1/15/21 1:53 PM, Sedat Dilek wrote:
>>> En plus, I encountered breakage with GCC v10.2.1 and LLVM=1 and
>>> CONFIG_DEBUG_INFO_DWARF4.
>>> So might be good to add a "depends on !DEBUG_INFO_BTF" in this combination.
>
> Can you privately send me your configs that repro? Maybe I can isolate
> it to a set of configs?
>
>>
>> I suggested not to add !DEBUG_INFO_BTF to CONFIG_DEBUG_INFO_DWARF4.
>> It is not there before and adding this may suddenly break some users.
>>
>> If certain combination of gcc/llvm does not work for
>> CONFIG_DEBUG_INFO_DWARF4 with pahole, this is a bug bpf community
>> should fix.
>
> Is there a place I should report bugs?
You can send bug report to Arnaldo Carvalho de Melo <[email protected]>,
[email protected] and [email protected].
>
>>
>>>
>>> I had some other small nits commented in the single patches.
>>>
>>> As requested in your previous patch-series, feel free to add my:
>>>
>>> Tested-by: Sedat Dilek <[email protected]>
>
> Yeah, I'll keep it if v6 is just commit message changes.
>
On Fri, Jan 15, 2021 at 3:34 PM Nick Desaulniers
<[email protected]> wrote:
>
> On Fri, Jan 15, 2021 at 3:24 PM Yonghong Song <[email protected]> wrote:
> >
> >
> >
> > On 1/15/21 1:53 PM, Sedat Dilek wrote:
> > > En plus, I encountered breakage with GCC v10.2.1 and LLVM=1 and
> > > CONFIG_DEBUG_INFO_DWARF4.
> > > So might be good to add a "depends on !DEBUG_INFO_BTF" in this combination.
>
> Can you privately send me your configs that repro? Maybe I can isolate
> it to a set of configs?
Why privately? To reproduce and fix the issue we (BPF and pahole
community) would need the config as well.
>
> >
> > I suggested not to add !DEBUG_INFO_BTF to CONFIG_DEBUG_INFO_DWARF4.
> > It is not there before and adding this may suddenly break some users.
> >
> > If certain combination of gcc/llvm does not work for
> > CONFIG_DEBUG_INFO_DWARF4 with pahole, this is a bug bpf community
> > should fix.
>
> Is there a place I should report bugs?
[email protected] (BPF in general) and [email protected]
(pahole, which seems to be emitting these warnings and having problems
with DWARF5).
>
> >
> > >
> > > I had some other small nits commented in the single patches.
> > >
> > > As requested in your previous patch-series, feel free to add my:
> > >
> > > Tested-by: Sedat Dilek <[email protected]>
>
> Yeah, I'll keep it if v6 is just commit message changes.
>
> --
> Thanks,
> ~Nick Desaulniers
On Sat, Jan 16, 2021 at 6:51 AM Nick Desaulniers
<[email protected]> wrote:
>
> On Fri, Jan 15, 2021 at 1:48 PM Sedat Dilek <[email protected]> wrote:
> >
> > On Fri, Jan 15, 2021 at 10:06 PM Nick Desaulniers
> > <[email protected]> wrote:
> > >
> > > From: Masahiro Yamada <[email protected]>
> > >
> > > The -gdwarf-4 flag is supported by GCC 4.5+, and also by Clang.
> > >
> > > You can see it at https://godbolt.org/z/6ed1oW
> > >
> > > For gcc 4.5.3 pane, line 37: .value 0x4
> > > For clang 10.0.1 pane, line 117: .short 4
> > >
> > > Given Documentation/process/changes.rst stating GCC 4.9 is the minimal
> > > version, this cc-option is unneeded.
> > >
> > > Note
> > > ----
> > >
> > > CONFIG_DEBUG_INFO_DWARF4 controls the DWARF version only for C files.
> > >
> > > As you can see in the top Makefile, -gdwarf-4 is only passed to CFLAGS.
> > >
> > > ifdef CONFIG_DEBUG_INFO_DWARF4
> > > DEBUG_CFLAGS += -gdwarf-4
> > > endif
> > >
> > > This flag is used when compiling *.c files.
> > >
> > > On the other hand, the assembler is always given -gdwarf-2.
> > >
> > > KBUILD_AFLAGS += -Wa,-gdwarf-2
> > >
> > > Hence, the debug info that comes from *.S files is always DWARF v2.
> > > This is simply because GAS supported only -gdwarf-2 for a long time.
> > >
> > > Recently, GAS gained the support for --dwarf-[3|4|5] options. [1]
> > > And, also we have Clang integrated assembler. So, the debug info
> > > for *.S files might be improved if we want.
> > >
> > > In my understanding, the current code is intentional, not a bug.
> > >
> > > [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=31bf18645d98b4d3d7357353be840e320649a67d
> > >
> > > Reviewed-by: Nick Desaulniers <[email protected]>
> > > Reviewed-by: Nathan Chancellor <[email protected]>
> > > Signed-off-by: Masahiro Yamada <[email protected]>
> >
> > Subject misses a "kbuild:" label like in all other patches.
> > You have:
> > "Remove $(cc-option,-gdwarf-4) dependency from CONFIG_DEBUG_INFO_DWARF4"
>
> Ack, I wonder how that happened? Ah well, will fix in v6; thanks for
> the feedback.
I will apply this in my tree,
adding "kbuild:" and fixing the typo pointed out by Fangrui.
You do not need to resend this one.
> >
> > - Sedat -
> >
> > > ---
> > > lib/Kconfig.debug | 1 -
> > > 1 file changed, 1 deletion(-)
> > >
> > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > > index 78361f0abe3a..dd7d8d35b2a5 100644
> > > --- a/lib/Kconfig.debug
> > > +++ b/lib/Kconfig.debug
> > > @@ -258,7 +258,6 @@ config DEBUG_INFO_SPLIT
> > >
> > > config DEBUG_INFO_DWARF4
> > > bool "Generate dwarf4 debuginfo"
> > > - depends on $(cc-option,-gdwarf-4)
> > > help
> > > Generate dwarf4 debug info. This requires recent versions
> > > of gcc and gdb. It makes the debug information larger.
> > > --
> > > 2.30.0.284.gd98b1dd5eaa7-goog
> > >
>
>
>
> --
> Thanks,
> ~Nick Desaulniers
--
Best Regards
Masahiro Yamada
Em Fri, Jan 15, 2021 at 03:43:06PM -0800, Yonghong Song escreveu:
>
>
> On 1/15/21 3:34 PM, Nick Desaulniers wrote:
> > On Fri, Jan 15, 2021 at 3:24 PM Yonghong Song <[email protected]> wrote:
> > >
> > >
> > >
> > > On 1/15/21 1:53 PM, Sedat Dilek wrote:
> > > > En plus, I encountered breakage with GCC v10.2.1 and LLVM=1 and
> > > > CONFIG_DEBUG_INFO_DWARF4.
> > > > So might be good to add a "depends on !DEBUG_INFO_BTF" in this combination.
> >
> > Can you privately send me your configs that repro? Maybe I can isolate
> > it to a set of configs?
> >
> > >
> > > I suggested not to add !DEBUG_INFO_BTF to CONFIG_DEBUG_INFO_DWARF4.
> > > It is not there before and adding this may suddenly break some users.
> > >
> > > If certain combination of gcc/llvm does not work for
> > > CONFIG_DEBUG_INFO_DWARF4 with pahole, this is a bug bpf community
> > > should fix.
> >
> > Is there a place I should report bugs?
>
> You can send bug report to Arnaldo Carvalho de Melo <[email protected]>,
> [email protected] and [email protected].
I'm coming back from vacation, will try to read the messages and see if
I can fix this.
Thanks,
- Arnaldo
> >
> > >
> > > >
> > > > I had some other small nits commented in the single patches.
> > > >
> > > > As requested in your previous patch-series, feel free to add my:
> > > >
> > > > Tested-by: Sedat Dilek <[email protected]>
> >
> > Yeah, I'll keep it if v6 is just commit message changes.
> >
--
- Arnaldo
On Sat, Jan 16, 2021 at 8:54 AM Masahiro Yamada <[email protected]> wrote:
>
> On Sat, Jan 16, 2021 at 6:51 AM Nick Desaulniers
> <[email protected]> wrote:
> >
> > On Fri, Jan 15, 2021 at 1:48 PM Sedat Dilek <[email protected]> wrote:
> > >
> > > On Fri, Jan 15, 2021 at 10:06 PM Nick Desaulniers
> > > <[email protected]> wrote:
> > > >
> > > > From: Masahiro Yamada <[email protected]>
> > > >
> > > > The -gdwarf-4 flag is supported by GCC 4.5+, and also by Clang.
> > > >
> > > > You can see it at https://godbolt.org/z/6ed1oW
> > > >
> > > > For gcc 4.5.3 pane, line 37: .value 0x4
> > > > For clang 10.0.1 pane, line 117: .short 4
> > > >
> > > > Given Documentation/process/changes.rst stating GCC 4.9 is the minimal
> > > > version, this cc-option is unneeded.
> > > >
> > > > Note
> > > > ----
> > > >
> > > > CONFIG_DEBUG_INFO_DWARF4 controls the DWARF version only for C files.
> > > >
> > > > As you can see in the top Makefile, -gdwarf-4 is only passed to CFLAGS.
> > > >
> > > > ifdef CONFIG_DEBUG_INFO_DWARF4
> > > > DEBUG_CFLAGS += -gdwarf-4
> > > > endif
> > > >
> > > > This flag is used when compiling *.c files.
> > > >
> > > > On the other hand, the assembler is always given -gdwarf-2.
> > > >
> > > > KBUILD_AFLAGS += -Wa,-gdwarf-2
> > > >
> > > > Hence, the debug info that comes from *.S files is always DWARF v2.
> > > > This is simply because GAS supported only -gdwarf-2 for a long time.
> > > >
> > > > Recently, GAS gained the support for --dwarf-[3|4|5] options. [1]
> > > > And, also we have Clang integrated assembler. So, the debug info
> > > > for *.S files might be improved if we want.
> > > >
> > > > In my understanding, the current code is intentional, not a bug.
> > > >
> > > > [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=31bf18645d98b4d3d7357353be840e320649a67d
> > > >
> > > > Reviewed-by: Nick Desaulniers <[email protected]>
> > > > Reviewed-by: Nathan Chancellor <[email protected]>
> > > > Signed-off-by: Masahiro Yamada <[email protected]>
> > >
> > > Subject misses a "kbuild:" label like in all other patches.
> > > You have:
> > > "Remove $(cc-option,-gdwarf-4) dependency from CONFIG_DEBUG_INFO_DWARF4"
> >
> > Ack, I wonder how that happened? Ah well, will fix in v6; thanks for
> > the feedback.
>
>
>
> I will apply this in my tree,
> adding "kbuild:" and fixing the typo pointed out by Fangrui.
>
> You do not need to resend this one.
>
Applied to linux-kbuild.
>
>
>
>
>
>
> > >
> > > - Sedat -
> > >
> > > > ---
> > > > lib/Kconfig.debug | 1 -
> > > > 1 file changed, 1 deletion(-)
> > > >
> > > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > > > index 78361f0abe3a..dd7d8d35b2a5 100644
> > > > --- a/lib/Kconfig.debug
> > > > +++ b/lib/Kconfig.debug
> > > > @@ -258,7 +258,6 @@ config DEBUG_INFO_SPLIT
> > > >
> > > > config DEBUG_INFO_DWARF4
> > > > bool "Generate dwarf4 debuginfo"
> > > > - depends on $(cc-option,-gdwarf-4)
> > > > help
> > > > Generate dwarf4 debug info. This requires recent versions
> > > > of gcc and gdb. It makes the debug information larger.
> > > > --
> > > > 2.30.0.284.gd98b1dd5eaa7-goog
> > > >
> >
> >
> >
> > --
> > Thanks,
> > ~Nick Desaulniers
>
>
>
> --
> Best Regards
> Masahiro Yamada
--
Best Regards
Masahiro Yamada
On Fri, Jan 15, 2021 at 01:06:15PM -0800, Nick Desaulniers wrote:
> Modifies CONFIG_DEBUG_INFO_DWARF4 to be a member of a choice. Adds an
> explicit CONFIG_DEBUG_INFO_DWARF2, which is the default. Does so in a
> way that's forward compatible with existing configs, and makes adding
> future versions more straightforward.
>
> Suggested-by: Arvind Sankar <[email protected]>
> Suggested-by: Fangrui Song <[email protected]>
> Suggested-by: Masahiro Yamada <[email protected]>
> Signed-off-by: Nick Desaulniers <[email protected]>
> ---
> Makefile | 13 ++++++-------
> lib/Kconfig.debug | 21 ++++++++++++++++-----
> 2 files changed, 22 insertions(+), 12 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index d49c3f39ceb4..4eb3bf7ee974 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -826,13 +826,12 @@ else
> DEBUG_CFLAGS += -g
> endif
>
> -ifneq ($(LLVM_IAS),1)
> -KBUILD_AFLAGS += -Wa,-gdwarf-2
> -endif
Aren't you regressing this with this patch? Why is the hunk from 3/3
that adds
ifdef CONFIG_CC_IS_CLANG
ifneq ($(LLVM_IAS),1)
not in this patch?
> -ifdef CONFIG_DEBUG_INFO_DWARF4
> -DEBUG_CFLAGS += -gdwarf-4
> -endif
> +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF2) := 2
> +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
> +DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y)
> +# Binutils 2.35+ required for -gdwarf-4+ support.
> +dwarf-aflag := $(call as-option,-Wa$(comma)-gdwarf-$(dwarf-version-y))
> +KBUILD_AFLAGS += $(dwarf-aflag)
>
> ifdef CONFIG_DEBUG_INFO_REDUCED
> DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index dd7d8d35b2a5..e80770fac4f0 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -256,13 +256,24 @@ config DEBUG_INFO_SPLIT
> to know about the .dwo files and include them.
> Incompatible with older versions of ccache.
>
> +choice
> + prompt "DWARF version"
> + help
> + Which version of DWARF debug info to emit.
> +
> +config DEBUG_INFO_DWARF2
> + bool "Generate DWARF Version 2 debuginfo"
> + help
> + Generate DWARF v2 debug info.
> +
> config DEBUG_INFO_DWARF4
> - bool "Generate dwarf4 debuginfo"
> + bool "Generate DWARF Version 4 debuginfo"
> help
> - Generate dwarf4 debug info. This requires recent versions
> - of gcc and gdb. It makes the debug information larger.
> - But it significantly improves the success of resolving
> - variables in gdb on optimized code.
> + Generate DWARF v4 debug info. This requires gcc 4.5+ and gdb 7.0+.
> + It makes the debug information larger, but it significantly
> + improves the success of resolving variables in gdb on optimized code.
> +
> +endchoice # "DWARF version"
>
> config DEBUG_INFO_BTF
> bool "Generate BTF typeinfo"
> --
> 2.30.0.284.gd98b1dd5eaa7-goog
>
On Wed, Jan 20, 2021 at 9:40 PM Nathan Chancellor
<[email protected]> wrote:
>
> On Fri, Jan 15, 2021 at 01:06:15PM -0800, Nick Desaulniers wrote:
> > Modifies CONFIG_DEBUG_INFO_DWARF4 to be a member of a choice. Adds an
> > explicit CONFIG_DEBUG_INFO_DWARF2, which is the default. Does so in a
> > way that's forward compatible with existing configs, and makes adding
> > future versions more straightforward.
> >
> > Suggested-by: Arvind Sankar <[email protected]>
> > Suggested-by: Fangrui Song <[email protected]>
> > Suggested-by: Masahiro Yamada <[email protected]>
> > Signed-off-by: Nick Desaulniers <[email protected]>
> > ---
> > Makefile | 13 ++++++-------
> > lib/Kconfig.debug | 21 ++++++++++++++++-----
> > 2 files changed, 22 insertions(+), 12 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index d49c3f39ceb4..4eb3bf7ee974 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -826,13 +826,12 @@ else
> > DEBUG_CFLAGS += -g
> > endif
> >
> > -ifneq ($(LLVM_IAS),1)
> > -KBUILD_AFLAGS += -Wa,-gdwarf-2
> > -endif
>
> Aren't you regressing this with this patch? Why is the hunk from 3/3
> that adds
>
> ifdef CONFIG_CC_IS_CLANG
> ifneq ($(LLVM_IAS),1)
>
> not in this patch?
>
Nice catch Nathan.
Just FYI:
The patch...
"kbuild: Remove $(cc-option,-gdwarf-4) dependency from DEBUG_INFO_DWARF4"
... has now entered kbuild-next.
( This patch is included in this patch-series. )
So should we point to this one and add a comment?
Thinking of a next version of this DWARF5 support patch-series.
- Sedat -
[1] https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git/commit/?h=kbuild&id=3f4d8ce271c7082be75bacbcbd2048aa78ce2b44
> > -ifdef CONFIG_DEBUG_INFO_DWARF4
> > -DEBUG_CFLAGS += -gdwarf-4
> > -endif
> > +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF2) := 2
> > +dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
> > +DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y)
> > +# Binutils 2.35+ required for -gdwarf-4+ support.
> > +dwarf-aflag := $(call as-option,-Wa$(comma)-gdwarf-$(dwarf-version-y))
> > +KBUILD_AFLAGS += $(dwarf-aflag)
> >
> > ifdef CONFIG_DEBUG_INFO_REDUCED
> > DEBUG_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \
> > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > index dd7d8d35b2a5..e80770fac4f0 100644
> > --- a/lib/Kconfig.debug
> > +++ b/lib/Kconfig.debug
> > @@ -256,13 +256,24 @@ config DEBUG_INFO_SPLIT
> > to know about the .dwo files and include them.
> > Incompatible with older versions of ccache.
> >
> > +choice
> > + prompt "DWARF version"
> > + help
> > + Which version of DWARF debug info to emit.
> > +
> > +config DEBUG_INFO_DWARF2
> > + bool "Generate DWARF Version 2 debuginfo"
> > + help
> > + Generate DWARF v2 debug info.
> > +
> > config DEBUG_INFO_DWARF4
> > - bool "Generate dwarf4 debuginfo"
> > + bool "Generate DWARF Version 4 debuginfo"
> > help
> > - Generate dwarf4 debug info. This requires recent versions
> > - of gcc and gdb. It makes the debug information larger.
> > - But it significantly improves the success of resolving
> > - variables in gdb on optimized code.
> > + Generate DWARF v4 debug info. This requires gcc 4.5+ and gdb 7.0+.
> > + It makes the debug information larger, but it significantly
> > + improves the success of resolving variables in gdb on optimized code.
> > +
> > +endchoice # "DWARF version"
> >
> > config DEBUG_INFO_BTF
> > bool "Generate BTF typeinfo"
> > --
> > 2.30.0.284.gd98b1dd5eaa7-goog
> >
On Sun, Jan 17, 2021 at 12:14 PM Arnaldo Carvalho de Melo
<[email protected]> wrote:
>
> Em Fri, Jan 15, 2021 at 03:43:06PM -0800, Yonghong Song escreveu:
> >
> >
> > On 1/15/21 3:34 PM, Nick Desaulniers wrote:
> > > On Fri, Jan 15, 2021 at 3:24 PM Yonghong Song <[email protected]> wrote:
> > > >
> > > >
> > > >
> > > > On 1/15/21 1:53 PM, Sedat Dilek wrote:
> > > > > En plus, I encountered breakage with GCC v10.2.1 and LLVM=1 and
> > > > > CONFIG_DEBUG_INFO_DWARF4.
> > > > > So might be good to add a "depends on !DEBUG_INFO_BTF" in this combination.
> > >
> > > Can you privately send me your configs that repro? Maybe I can isolate
> > > it to a set of configs?
> > >
> > > >
> > > > I suggested not to add !DEBUG_INFO_BTF to CONFIG_DEBUG_INFO_DWARF4.
> > > > It is not there before and adding this may suddenly break some users.
> > > >
> > > > If certain combination of gcc/llvm does not work for
> > > > CONFIG_DEBUG_INFO_DWARF4 with pahole, this is a bug bpf community
> > > > should fix.
> > >
> > > Is there a place I should report bugs?
> >
> > You can send bug report to Arnaldo Carvalho de Melo <[email protected]>,
> > [email protected] and [email protected].
>
> I'm coming back from vacation, will try to read the messages and see if
> I can fix this.
IDK about DWARF v4; that seems to work for me. I was previously observing
https://bugzilla.redhat.com/show_bug.cgi?id=1922698
with DWARF v5. I just re-pulled the latest pahole, rebuilt, and no
longer see that warning.
I now observe a different set. I plan on attending "BPF office hours
tomorrow morning," but if anyone wants a sneak peak of the errors and
how to reproduce:
https://gist.github.com/nickdesaulniers/ae8c9efbe4da69b1cf0dce138c1d2781
(FWIW: some other folks are hitting issues now with kernel's lack of
DWARF v5 support: https://bugzilla.redhat.com/show_bug.cgi?id=1922707)
--
Thanks,
~Nick Desaulniers
On Wed, Feb 3, 2021 at 5:31 PM Nick Desaulniers <[email protected]> wrote:
>
> On Sun, Jan 17, 2021 at 12:14 PM Arnaldo Carvalho de Melo
> <[email protected]> wrote:
> >
> > Em Fri, Jan 15, 2021 at 03:43:06PM -0800, Yonghong Song escreveu:
> > >
> > >
> > > On 1/15/21 3:34 PM, Nick Desaulniers wrote:
> > > > On Fri, Jan 15, 2021 at 3:24 PM Yonghong Song <[email protected]> wrote:
> > > > >
> > > > >
> > > > >
> > > > > On 1/15/21 1:53 PM, Sedat Dilek wrote:
> > > > > > En plus, I encountered breakage with GCC v10.2.1 and LLVM=1 and
> > > > > > CONFIG_DEBUG_INFO_DWARF4.
> > > > > > So might be good to add a "depends on !DEBUG_INFO_BTF" in this combination.
> > > >
> > > > Can you privately send me your configs that repro? Maybe I can isolate
> > > > it to a set of configs?
> > > >
> > > > >
> > > > > I suggested not to add !DEBUG_INFO_BTF to CONFIG_DEBUG_INFO_DWARF4.
> > > > > It is not there before and adding this may suddenly break some users.
> > > > >
> > > > > If certain combination of gcc/llvm does not work for
> > > > > CONFIG_DEBUG_INFO_DWARF4 with pahole, this is a bug bpf community
> > > > > should fix.
> > > >
> > > > Is there a place I should report bugs?
> > >
> > > You can send bug report to Arnaldo Carvalho de Melo <[email protected]>,
> > > [email protected] and [email protected].
> >
> > I'm coming back from vacation, will try to read the messages and see if
> > I can fix this.
>
> IDK about DWARF v4; that seems to work for me. I was previously observing
> https://bugzilla.redhat.com/show_bug.cgi?id=1922698
> with DWARF v5. I just re-pulled the latest pahole, rebuilt, and no
> longer see that warning.
>
> I now observe a different set. I plan on attending "BPF office hours
> tomorrow morning," but if anyone wants a sneak peak of the errors and
> how to reproduce:
> https://gist.github.com/nickdesaulniers/ae8c9efbe4da69b1cf0dce138c1d2781
>
Is there another (easy) way to get your patch set without the b4 tool?
Is your patch set present in some patchworks instance, so that I can
download it in mbox format, for example?
>
> (FWIW: some other folks are hitting issues now with kernel's lack of
> DWARF v5 support: https://bugzilla.redhat.com/show_bug.cgi?id=1922707)
> --
> Thanks,
> ~Nick Desaulniers
On Wed, Feb 3, 2021 at 6:58 PM Andrii Nakryiko
<[email protected]> wrote:
>
> On Wed, Feb 3, 2021 at 5:31 PM Nick Desaulniers <[email protected]> wrote:
> >
> > On Sun, Jan 17, 2021 at 12:14 PM Arnaldo Carvalho de Melo
> > <[email protected]> wrote:
> > >
> > > Em Fri, Jan 15, 2021 at 03:43:06PM -0800, Yonghong Song escreveu:
> > > >
> > > >
> > > > On 1/15/21 3:34 PM, Nick Desaulniers wrote:
> > > > > On Fri, Jan 15, 2021 at 3:24 PM Yonghong Song <[email protected]> wrote:
> > > > > >
> > > > > >
> > > > > >
> > > > > > On 1/15/21 1:53 PM, Sedat Dilek wrote:
> > > > > > > En plus, I encountered breakage with GCC v10.2.1 and LLVM=1 and
> > > > > > > CONFIG_DEBUG_INFO_DWARF4.
> > > > > > > So might be good to add a "depends on !DEBUG_INFO_BTF" in this combination.
> > > > >
> > > > > Can you privately send me your configs that repro? Maybe I can isolate
> > > > > it to a set of configs?
> > > > >
> > > > > >
> > > > > > I suggested not to add !DEBUG_INFO_BTF to CONFIG_DEBUG_INFO_DWARF4.
> > > > > > It is not there before and adding this may suddenly break some users.
> > > > > >
> > > > > > If certain combination of gcc/llvm does not work for
> > > > > > CONFIG_DEBUG_INFO_DWARF4 with pahole, this is a bug bpf community
> > > > > > should fix.
> > > > >
> > > > > Is there a place I should report bugs?
> > > >
> > > > You can send bug report to Arnaldo Carvalho de Melo <[email protected]>,
> > > > [email protected] and [email protected].
> > >
> > > I'm coming back from vacation, will try to read the messages and see if
> > > I can fix this.
> >
> > IDK about DWARF v4; that seems to work for me. I was previously observing
> > https://bugzilla.redhat.com/show_bug.cgi?id=1922698
> > with DWARF v5. I just re-pulled the latest pahole, rebuilt, and no
> > longer see that warning.
> >
> > I now observe a different set. I plan on attending "BPF office hours
> > tomorrow morning," but if anyone wants a sneak peak of the errors and
> > how to reproduce:
> > https://gist.github.com/nickdesaulniers/ae8c9efbe4da69b1cf0dce138c1d2781
> >
>
> Is there another (easy) way to get your patch set without the b4 tool?
> Is your patch set present in some patchworks instance, so that I can
> download it in mbox format, for example?
$ wget https://lore.kernel.org/lkml/[email protected]/raw
-O - | git am
$ wget https://lore.kernel.org/lkml/[email protected]/raw
-O - | git am
If you haven't tried b4 yet, it's quite nice. Hard to go back. Lore
also has mbox.gz links. Not sure about patchwork.
>
> >
> > (FWIW: some other folks are hitting issues now with kernel's lack of
> > DWARF v5 support: https://bugzilla.redhat.com/show_bug.cgi?id=1922707)
--
Thanks,
~Nick Desaulniers
On Thu, Feb 4, 2021 at 3:58 AM Andrii Nakryiko
<[email protected]> wrote:
...
>
> Is there another (easy) way to get your patch set without the b4 tool?
> Is your patch set present in some patchworks instance, so that I can
> download it in mbox format, for example?
>
Just to promote the b4 tool - we have some cool wiki in [1].
Personally, I got in touch with b4 when dealing with the
ClangBuiltLinux project.
Note: Sometimes it takes a bit for the patch(set) to be available from
the LORE link.
- Sedat -
[1] https://github.com/ClangBuiltLinux/linux/wiki/Command-line-tips-and-tricks#fetching-a-single-patch-or-series-from-lkml
On Thu, Feb 4, 2021 at 9:42 AM Sedat Dilek <[email protected]> wrote:
>
> On Thu, Feb 4, 2021 at 3:58 AM Andrii Nakryiko
> <[email protected]> wrote:
> ...
> >
> > Is there another (easy) way to get your patch set without the b4 tool?
> > Is your patch set present in some patchworks instance, so that I can
> > download it in mbox format, for example?
> >
>
> Just to promote the b4 tool - we have some cool wiki in [1].
>
> Personally, I got in touch with b4 when dealing with the
> ClangBuiltLinux project.
>
> Note: Sometimes it takes a bit for the patch(set) to be available from
> the LORE link.
>
> - Sedat -
>
> [1] https://github.com/ClangBuiltLinux/linux/wiki/Command-line-tips-and-tricks#fetching-a-single-patch-or-series-from-lkml
Honestly, when behind a proxy-server I did not find a trick to use b4
here (DNS resolution problems).
I tried with proxychains-ng - NOPE.
In the meantime I updated the CBL-wiki page and added v8 as an example :-).
- Sedat -
On Wed, Feb 3, 2021 at 7:13 PM Nick Desaulniers <[email protected]> wrote:
>
> On Wed, Feb 3, 2021 at 6:58 PM Andrii Nakryiko
> <[email protected]> wrote:
> >
> > On Wed, Feb 3, 2021 at 5:31 PM Nick Desaulniers <[email protected]> wrote:
> > >
> > > On Sun, Jan 17, 2021 at 12:14 PM Arnaldo Carvalho de Melo
> > > <[email protected]> wrote:
> > > >
> > > > Em Fri, Jan 15, 2021 at 03:43:06PM -0800, Yonghong Song escreveu:
> > > > >
> > > > >
> > > > > On 1/15/21 3:34 PM, Nick Desaulniers wrote:
> > > > > > On Fri, Jan 15, 2021 at 3:24 PM Yonghong Song <[email protected]> wrote:
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On 1/15/21 1:53 PM, Sedat Dilek wrote:
> > > > > > > > En plus, I encountered breakage with GCC v10.2.1 and LLVM=1 and
> > > > > > > > CONFIG_DEBUG_INFO_DWARF4.
> > > > > > > > So might be good to add a "depends on !DEBUG_INFO_BTF" in this combination.
> > > > > >
> > > > > > Can you privately send me your configs that repro? Maybe I can isolate
> > > > > > it to a set of configs?
> > > > > >
> > > > > > >
> > > > > > > I suggested not to add !DEBUG_INFO_BTF to CONFIG_DEBUG_INFO_DWARF4.
> > > > > > > It is not there before and adding this may suddenly break some users.
> > > > > > >
> > > > > > > If certain combination of gcc/llvm does not work for
> > > > > > > CONFIG_DEBUG_INFO_DWARF4 with pahole, this is a bug bpf community
> > > > > > > should fix.
> > > > > >
> > > > > > Is there a place I should report bugs?
> > > > >
> > > > > You can send bug report to Arnaldo Carvalho de Melo <[email protected]>,
> > > > > [email protected] and [email protected].
> > > >
> > > > I'm coming back from vacation, will try to read the messages and see if
> > > > I can fix this.
> > >
> > > IDK about DWARF v4; that seems to work for me. I was previously observing
> > > https://bugzilla.redhat.com/show_bug.cgi?id=1922698
> > > with DWARF v5. I just re-pulled the latest pahole, rebuilt, and no
> > > longer see that warning.
> > >
> > > I now observe a different set. I plan on attending "BPF office hours
> > > tomorrow morning," but if anyone wants a sneak peak of the errors and
> > > how to reproduce:
> > > https://gist.github.com/nickdesaulniers/ae8c9efbe4da69b1cf0dce138c1d2781
> > >
> >
> > Is there another (easy) way to get your patch set without the b4 tool?
> > Is your patch set present in some patchworks instance, so that I can
> > download it in mbox format, for example?
>
> $ wget https://lore.kernel.org/lkml/[email protected]/raw
> -O - | git am
> $ wget https://lore.kernel.org/lkml/[email protected]/raw
> -O - | git am
>
> If you haven't tried b4 yet, it's quite nice. Hard to go back. Lore
> also has mbox.gz links. Not sure about patchwork.
>
Ok, I managed to apply that on linux-next, but I can't get past this:
ld.lld: error: undefined symbol: pa_trampoline_start
>>> referenced by arch/x86/realmode/rm/header.o:(real_mode_header)
ld.lld: error: undefined symbol: pa_trampoline_header
>>> referenced by arch/x86/realmode/rm/header.o:(real_mode_header)
ld.lld: error: undefined symbol: pa_trampoline_pgd
>>> referenced by arch/x86/realmode/rm/header.o:(real_mode_header)
>>> referenced by trampoline_64.S:142 (/data/users/andriin/linux/arch/x86/realmode/rm/trampoline_64.S:142)
>>> arch/x86/realmode/rm/trampoline_64.o:(startup_32)
ld.lld: error: undefined symbol: pa_wakeup_start
>>> referenced by arch/x86/realmode/rm/header.o:(real_mode_header)
ld.lld: error: undefined symbol: pa_wakeup_header
>>> referenced by arch/x86/realmode/rm/header.o:(real_mode_header)
ld.lld: error: undefined symbol: pa_machine_real_restart_asm
>>> referenced by arch/x86/realmode/rm/header.o:(real_mode_header)
ld.lld: error: undefined symbol: pa_startup_32
>>> referenced by trampoline_64.S:77 (/data/users/andriin/linux/arch/x86/realmode/rm/trampoline_64.S:77)
>>> arch/x86/realmode/rm/trampoline_64.o:(trampoline_start)
ld.lld: error: undefined symbol: pa_tr_flags
>>> referenced by trampoline_64.S:124 (/data/users/andriin/linux/arch/x86/realmode/rm/trampoline_64.S:124)
>>> arch/x86/realmode/rm/trampoline_64.o:(startup_32)
ld.lld: error: undefined symbol: pa_tr_cr4
>>> referenced by trampoline_64.S:138 (/data/users/andriin/linux/arch/x86/realmode/rm/trampoline_64.S:138)
>>> arch/x86/realmode/rm/trampoline_64.o:(startup_32)
ld.lld: error: undefined symbol: pa_tr_efer
>>> referenced by trampoline_64.S:146 (/data/users/andriin/linux/arch/x86/realmode/rm/trampoline_64.S:146)
>>> arch/x86/realmode/rm/trampoline_64.o:(startup_32)
>>> referenced by trampoline_64.S:147 (/data/users/andriin/linux/arch/x86/realmode/rm/trampoline_64.S:147)
>>> arch/x86/realmode/rm/trampoline_64.o:(startup_32)
ld.lld: error: undefined symbol: pa_startup_64
>>> referenced by trampoline_64.S:161 (/data/users/andriin/linux/arch/x86/realmode/rm/trampoline_64.S:161)
>>> arch/x86/realmode/rm/trampoline_64.o:(startup_32)
ld.lld: error: undefined symbol: pa_tr_gdt
>>> referenced by arch/x86/realmode/rm/trampoline_64.o:(tr_gdt)
>>> referenced by reboot.S:28 (/data/users/andriin/linux/arch/x86/realmode/rm/reboot.S:28)
>>> arch/x86/realmode/rm/reboot.o:(machine_real_restart_asm)
ld.lld: error: undefined symbol: pa_machine_real_restart_paging_off
>>> referenced by reboot.S:34 (/data/users/andriin/linux/arch/x86/realmode/rm/reboot.S:34)
>>> arch/x86/realmode/rm/reboot.o:(machine_real_restart_asm)
ld.lld: error: undefined symbol: pa_machine_real_restart_idt
>>> referenced by reboot.S:47 (/data/users/andriin/linux/arch/x86/realmode/rm/reboot.S:47)
>>> arch/x86/realmode/rm/reboot.o:(machine_real_restart_asm)
ld.lld: error: undefined symbol: pa_machine_real_restart_gdt
>>> referenced by reboot.S:54 (/data/users/andriin/linux/arch/x86/realmode/rm/reboot.S:54)
>>> arch/x86/realmode/rm/reboot.o:(machine_real_restart_asm)
>>> referenced by arch/x86/realmode/rm/reboot.o:(machine_real_restart_gdt)
ld.lld: error: undefined symbol: pa_wakeup_gdt
>>> referenced by arch/x86/realmode/rm/wakeup_asm.o:(wakeup_gdt)
CC arch/x86/mm/numa_64.o
CC arch/x86/mm/amdtopology.o
HOSTCC arch/x86/entry/vdso/vdso2c
make[4]: *** [arch/x86/realmode/rm/realmode.elf] Error 1
make[3]: *** [arch/x86/realmode/rm/realmode.bin] Error 2
make[2]: *** [arch/x86/realmode] Error 2
make[2]: *** Waiting for unfinished jobs....
Hopefully Arnaldo will have better luck.
> >
> > >
> > > (FWIW: some other folks are hitting issues now with kernel's lack of
> > > DWARF v5 support: https://bugzilla.redhat.com/show_bug.cgi?id=1922707)
>
>
> --
> Thanks,
> ~Nick Desaulniers
Moving a bunch of folks + lists to BCC.
On Thu, Feb 4, 2021 at 3:54 PM Andrii Nakryiko
<[email protected]> wrote:
>
> On Wed, Feb 3, 2021 at 7:13 PM Nick Desaulniers <[email protected]> wrote:
> >
> > On Wed, Feb 3, 2021 at 6:58 PM Andrii Nakryiko
> > <[email protected]> wrote:
> > >
> > > On Wed, Feb 3, 2021 at 5:31 PM Nick Desaulniers <[email protected]> wrote:
> > > >
> > > > On Sun, Jan 17, 2021 at 12:14 PM Arnaldo Carvalho de Melo
> > > > <[email protected]> wrote:
> > > > >
> > > > > Em Fri, Jan 15, 2021 at 03:43:06PM -0800, Yonghong Song escreveu:
> > > > > >
> > > > > >
> > > > > > On 1/15/21 3:34 PM, Nick Desaulniers wrote:
> > > > > > > On Fri, Jan 15, 2021 at 3:24 PM Yonghong Song <[email protected]> wrote:
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > On 1/15/21 1:53 PM, Sedat Dilek wrote:
> > > > > > > > > En plus, I encountered breakage with GCC v10.2.1 and LLVM=1 and
> > > > > > > > > CONFIG_DEBUG_INFO_DWARF4.
> > > > > > > > > So might be good to add a "depends on !DEBUG_INFO_BTF" in this combination.
> > > > > > >
> > > > > > > Can you privately send me your configs that repro? Maybe I can isolate
> > > > > > > it to a set of configs?
> > > > > > >
> > > > > > > >
> > > > > > > > I suggested not to add !DEBUG_INFO_BTF to CONFIG_DEBUG_INFO_DWARF4.
> > > > > > > > It is not there before and adding this may suddenly break some users.
> > > > > > > >
> > > > > > > > If certain combination of gcc/llvm does not work for
> > > > > > > > CONFIG_DEBUG_INFO_DWARF4 with pahole, this is a bug bpf community
> > > > > > > > should fix.
> > > > > > >
> > > > > > > Is there a place I should report bugs?
> > > > > >
> > > > > > You can send bug report to Arnaldo Carvalho de Melo <[email protected]>,
> > > > > > [email protected] and [email protected].
> > > > >
> > > > > I'm coming back from vacation, will try to read the messages and see if
> > > > > I can fix this.
> > > >
> > > > IDK about DWARF v4; that seems to work for me. I was previously observing
> > > > https://bugzilla.redhat.com/show_bug.cgi?id=1922698
> > > > with DWARF v5. I just re-pulled the latest pahole, rebuilt, and no
> > > > longer see that warning.
> > > >
> > > > I now observe a different set. I plan on attending "BPF office hours
> > > > tomorrow morning," but if anyone wants a sneak peak of the errors and
> > > > how to reproduce:
> > > > https://gist.github.com/nickdesaulniers/ae8c9efbe4da69b1cf0dce138c1d2781
> > > >
> > >
> > > Is there another (easy) way to get your patch set without the b4 tool?
> > > Is your patch set present in some patchworks instance, so that I can
> > > download it in mbox format, for example?
> >
> > $ wget https://lore.kernel.org/lkml/[email protected]/raw
> > -O - | git am
> > $ wget https://lore.kernel.org/lkml/[email protected]/raw
> > -O - | git am
> >
> > If you haven't tried b4 yet, it's quite nice. Hard to go back. Lore
> > also has mbox.gz links. Not sure about patchwork.
> >
>
> Ok, I managed to apply that on linux-next, but I can't get past this:
>
> ld.lld: error: undefined symbol: pa_trampoline_start
> >>> referenced by arch/x86/realmode/rm/header.o:(real_mode_header)
Thanks for testing and the report. Do you have a .config you can send
me to reproduce?
>
> ld.lld: error: undefined symbol: pa_trampoline_header
> >>> referenced by arch/x86/realmode/rm/header.o:(real_mode_header)
>
> ld.lld: error: undefined symbol: pa_trampoline_pgd
> >>> referenced by arch/x86/realmode/rm/header.o:(real_mode_header)
> >>> referenced by trampoline_64.S:142 (/data/users/andriin/linux/arch/x86/realmode/rm/trampoline_64.S:142)
> >>> arch/x86/realmode/rm/trampoline_64.o:(startup_32)
>
> ld.lld: error: undefined symbol: pa_wakeup_start
> >>> referenced by arch/x86/realmode/rm/header.o:(real_mode_header)
>
> ld.lld: error: undefined symbol: pa_wakeup_header
> >>> referenced by arch/x86/realmode/rm/header.o:(real_mode_header)
>
> ld.lld: error: undefined symbol: pa_machine_real_restart_asm
> >>> referenced by arch/x86/realmode/rm/header.o:(real_mode_header)
>
> ld.lld: error: undefined symbol: pa_startup_32
> >>> referenced by trampoline_64.S:77 (/data/users/andriin/linux/arch/x86/realmode/rm/trampoline_64.S:77)
> >>> arch/x86/realmode/rm/trampoline_64.o:(trampoline_start)
>
> ld.lld: error: undefined symbol: pa_tr_flags
> >>> referenced by trampoline_64.S:124 (/data/users/andriin/linux/arch/x86/realmode/rm/trampoline_64.S:124)
> >>> arch/x86/realmode/rm/trampoline_64.o:(startup_32)
>
> ld.lld: error: undefined symbol: pa_tr_cr4
> >>> referenced by trampoline_64.S:138 (/data/users/andriin/linux/arch/x86/realmode/rm/trampoline_64.S:138)
> >>> arch/x86/realmode/rm/trampoline_64.o:(startup_32)
>
> ld.lld: error: undefined symbol: pa_tr_efer
> >>> referenced by trampoline_64.S:146 (/data/users/andriin/linux/arch/x86/realmode/rm/trampoline_64.S:146)
> >>> arch/x86/realmode/rm/trampoline_64.o:(startup_32)
> >>> referenced by trampoline_64.S:147 (/data/users/andriin/linux/arch/x86/realmode/rm/trampoline_64.S:147)
> >>> arch/x86/realmode/rm/trampoline_64.o:(startup_32)
>
> ld.lld: error: undefined symbol: pa_startup_64
> >>> referenced by trampoline_64.S:161 (/data/users/andriin/linux/arch/x86/realmode/rm/trampoline_64.S:161)
> >>> arch/x86/realmode/rm/trampoline_64.o:(startup_32)
>
> ld.lld: error: undefined symbol: pa_tr_gdt
> >>> referenced by arch/x86/realmode/rm/trampoline_64.o:(tr_gdt)
> >>> referenced by reboot.S:28 (/data/users/andriin/linux/arch/x86/realmode/rm/reboot.S:28)
> >>> arch/x86/realmode/rm/reboot.o:(machine_real_restart_asm)
>
> ld.lld: error: undefined symbol: pa_machine_real_restart_paging_off
> >>> referenced by reboot.S:34 (/data/users/andriin/linux/arch/x86/realmode/rm/reboot.S:34)
> >>> arch/x86/realmode/rm/reboot.o:(machine_real_restart_asm)
>
> ld.lld: error: undefined symbol: pa_machine_real_restart_idt
> >>> referenced by reboot.S:47 (/data/users/andriin/linux/arch/x86/realmode/rm/reboot.S:47)
> >>> arch/x86/realmode/rm/reboot.o:(machine_real_restart_asm)
>
> ld.lld: error: undefined symbol: pa_machine_real_restart_gdt
> >>> referenced by reboot.S:54 (/data/users/andriin/linux/arch/x86/realmode/rm/reboot.S:54)
> >>> arch/x86/realmode/rm/reboot.o:(machine_real_restart_asm)
> >>> referenced by arch/x86/realmode/rm/reboot.o:(machine_real_restart_gdt)
>
> ld.lld: error: undefined symbol: pa_wakeup_gdt
> >>> referenced by arch/x86/realmode/rm/wakeup_asm.o:(wakeup_gdt)
> CC arch/x86/mm/numa_64.o
> CC arch/x86/mm/amdtopology.o
> HOSTCC arch/x86/entry/vdso/vdso2c
> make[4]: *** [arch/x86/realmode/rm/realmode.elf] Error 1
> make[3]: *** [arch/x86/realmode/rm/realmode.bin] Error 2
> make[2]: *** [arch/x86/realmode] Error 2
> make[2]: *** Waiting for unfinished jobs....
>
>
> Hopefully Arnaldo will have better luck.
>
>
>
> > >
> > > >
> > > > (FWIW: some other folks are hitting issues now with kernel's lack of
> > > > DWARF v5 support: https://bugzilla.redhat.com/show_bug.cgi?id=1922707)
> >
> >
> > --
> > Thanks,
> > ~Nick Desaulniers
--
Thanks,
~Nick Desaulniers