kbuild: Simplify DEBUG_INFO Kconfig handling

While playing with [1] I saw that the handling
of CONFIG_DEBUG_INFO can be simplified.

[1] https://patchwork.kernel.org/patch/11716107/

Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
Sedat Dilek 2020-08-16 14:32:44 +02:00 committed by Masahiro Yamada
parent d012a7190f
commit 695afd3d7d
2 changed files with 9 additions and 7 deletions

View File

@ -816,13 +816,15 @@ endif
DEBUG_CFLAGS := $(call cc-option, -fno-var-tracking-assignments) DEBUG_CFLAGS := $(call cc-option, -fno-var-tracking-assignments)
ifdef CONFIG_DEBUG_INFO ifdef CONFIG_DEBUG_INFO
ifdef CONFIG_DEBUG_INFO_SPLIT ifdef CONFIG_DEBUG_INFO_SPLIT
DEBUG_CFLAGS += -gsplit-dwarf DEBUG_CFLAGS += -gsplit-dwarf
else else
DEBUG_CFLAGS += -g DEBUG_CFLAGS += -g
endif endif
KBUILD_AFLAGS += -Wa,-gdwarf-2 KBUILD_AFLAGS += -Wa,-gdwarf-2
endif
ifdef CONFIG_DEBUG_INFO_DWARF4 ifdef CONFIG_DEBUG_INFO_DWARF4
DEBUG_CFLAGS += -gdwarf-4 DEBUG_CFLAGS += -gdwarf-4
endif endif
@ -838,6 +840,8 @@ KBUILD_AFLAGS += -gz=zlib
KBUILD_LDFLAGS += --compress-debug-sections=zlib KBUILD_LDFLAGS += --compress-debug-sections=zlib
endif endif
endif # CONFIG_DEBUG_INFO
KBUILD_CFLAGS += $(DEBUG_CFLAGS) KBUILD_CFLAGS += $(DEBUG_CFLAGS)
export DEBUG_CFLAGS export DEBUG_CFLAGS

View File

@ -212,9 +212,10 @@ config DEBUG_INFO
If unsure, say N. If unsure, say N.
if DEBUG_INFO
config DEBUG_INFO_REDUCED config DEBUG_INFO_REDUCED
bool "Reduce debugging information" bool "Reduce debugging information"
depends on DEBUG_INFO
help help
If you say Y here gcc is instructed to generate less debugging If you say Y here gcc is instructed to generate less debugging
information for structure types. This means that tools that information for structure types. This means that tools that
@ -227,7 +228,6 @@ config DEBUG_INFO_REDUCED
config DEBUG_INFO_COMPRESSED config DEBUG_INFO_COMPRESSED
bool "Compressed debugging information" bool "Compressed debugging information"
depends on DEBUG_INFO
depends on $(cc-option,-gz=zlib) depends on $(cc-option,-gz=zlib)
depends on $(ld-option,--compress-debug-sections=zlib) depends on $(ld-option,--compress-debug-sections=zlib)
help help
@ -243,7 +243,6 @@ config DEBUG_INFO_COMPRESSED
config DEBUG_INFO_SPLIT config DEBUG_INFO_SPLIT
bool "Produce split debuginfo in .dwo files" bool "Produce split debuginfo in .dwo files"
depends on DEBUG_INFO
depends on $(cc-option,-gsplit-dwarf) depends on $(cc-option,-gsplit-dwarf)
help help
Generate debug info into separate .dwo files. This significantly Generate debug info into separate .dwo files. This significantly
@ -259,7 +258,6 @@ config DEBUG_INFO_SPLIT
config DEBUG_INFO_DWARF4 config DEBUG_INFO_DWARF4
bool "Generate dwarf4 debuginfo" bool "Generate dwarf4 debuginfo"
depends on DEBUG_INFO
depends on $(cc-option,-gdwarf-4) depends on $(cc-option,-gdwarf-4)
help help
Generate dwarf4 debug info. This requires recent versions Generate dwarf4 debug info. This requires recent versions
@ -269,7 +267,6 @@ config DEBUG_INFO_DWARF4
config DEBUG_INFO_BTF config DEBUG_INFO_BTF
bool "Generate BTF typeinfo" bool "Generate BTF typeinfo"
depends on DEBUG_INFO
depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED
depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST
help help
@ -279,7 +276,6 @@ config DEBUG_INFO_BTF
config GDB_SCRIPTS config GDB_SCRIPTS
bool "Provide GDB scripts for kernel debugging" bool "Provide GDB scripts for kernel debugging"
depends on DEBUG_INFO
help help
This creates the required links to GDB helper scripts in the This creates the required links to GDB helper scripts in the
build directory. If you load vmlinux into gdb, the helper build directory. If you load vmlinux into gdb, the helper
@ -288,6 +284,8 @@ config GDB_SCRIPTS
instance. See Documentation/dev-tools/gdb-kernel-debugging.rst instance. See Documentation/dev-tools/gdb-kernel-debugging.rst
for further details. for further details.
endif # DEBUG_INFO
config ENABLE_MUST_CHECK config ENABLE_MUST_CHECK
bool "Enable __must_check logic" bool "Enable __must_check logic"
default y default y