Skip to content

Commit 32ef9e5

Browse files
nickdesaulniersmasahir0y
authored andcommitted
Makefile.debug: re-enable debug info for .S files
Alexey reported that the fraction of unknown filename instances in kallsyms grew from ~0.3% to ~10% recently; Bill and Greg tracked it down to assembler defined symbols, which regressed as a result of: commit b8a9092 ("Kbuild: do not emit debug info for assembly with LLVM_IAS=1") In that commit, I allude to restoring debug info for assembler defined symbols in a follow up patch, but it seems I forgot to do so in commit a66049e ("Kbuild: make DWARF version a choice") Link: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=31bf18645d98b4d3d7357353be840e320649a67d Fixes: b8a9092 ("Kbuild: do not emit debug info for assembly with LLVM_IAS=1") Reported-by: Alexey Alexandrov <aalexand@google.com> Reported-by: Bill Wendling <morbo@google.com> Reported-by: Greg Thelen <gthelen@google.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Suggested-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
1 parent 61f2b7c commit 32ef9e5

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

lib/Kconfig.debug

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,10 @@ config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
264264
config DEBUG_INFO_DWARF4
265265
bool "Generate DWARF Version 4 debuginfo"
266266
select DEBUG_INFO
267+
depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)))
267268
help
268-
Generate DWARF v4 debug info. This requires gcc 4.5+ and gdb 7.0+.
269+
Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2
270+
if using clang without clang's integrated assembler, and gdb 7.0+.
269271

270272
If you have consumers of DWARF debug info that are not ready for
271273
newer revisions of DWARF, you may wish to choose this or have your

scripts/Makefile.debug

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
DEBUG_CFLAGS := -g
1+
DEBUG_CFLAGS :=
2+
debug-flags-y := -g
23

34
ifdef CONFIG_DEBUG_INFO_SPLIT
45
DEBUG_CFLAGS += -gsplit-dwarf
56
endif
67

7-
ifndef CONFIG_AS_IS_LLVM
8-
KBUILD_AFLAGS += -Wa,-gdwarf-2
9-
endif
10-
11-
ifndef CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
12-
dwarf-version-$(CONFIG_DEBUG_INFO_DWARF4) := 4
13-
dwarf-version-$(CONFIG_DEBUG_INFO_DWARF5) := 5
14-
DEBUG_CFLAGS += -gdwarf-$(dwarf-version-y)
8+
debug-flags-$(CONFIG_DEBUG_INFO_DWARF4) += -gdwarf-4
9+
debug-flags-$(CONFIG_DEBUG_INFO_DWARF5) += -gdwarf-5
10+
ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_AS_IS_GNU),yy)
11+
# Clang does not pass -g or -gdwarf-* option down to GAS.
12+
# Add -Wa, prefix to explicitly specify the flags.
13+
KBUILD_AFLAGS += $(addprefix -Wa$(comma), $(debug-flags-y))
1514
endif
15+
DEBUG_CFLAGS += $(debug-flags-y)
16+
KBUILD_AFLAGS += $(debug-flags-y)
1617

1718
ifdef CONFIG_DEBUG_INFO_REDUCED
1819
DEBUG_CFLAGS += -fno-var-tracking
@@ -27,5 +28,5 @@ KBUILD_AFLAGS += -gz=zlib
2728
KBUILD_LDFLAGS += --compress-debug-sections=zlib
2829
endif
2930

30-
KBUILD_CFLAGS += $(DEBUG_CFLAGS)
31+
KBUILD_CFLAGS += $(DEBUG_CFLAGS)
3132
export DEBUG_CFLAGS

0 commit comments

Comments
 (0)