Skip to contentSkip to conversation

Kconfig.debug: Make DEBUG_INFO always default=n

PATCH In review Kees Cook 2 participants 2 messages Jan 28, 2022 Library code

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 Kconfig.debug: Make DEBUG_INFO always default=n

While trying to make sure CONFIG_DEBUG_INFO wasn't set for COMPILE_TEST, I ordered the choices incorrectly to retain the prior default=n state. Move DEBUG_INFO_NONE to the top so that the default choice is disabled, and remove the "if COMPILE_TEST" as it is now redundant.

---
Andrew, this is a fix for kconfigdebug-make-debug_info-selectable-from-a-choice.patch

---
 lib/Kconfig.debug | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
lib/Kconfig.debug +6 -7
index a7b657d67318..a1262358d55a 100644
@@ -234,7 +234,6 @@ config DEBUG_INFO
 choice
 	prompt "Debug information"
 	depends on DEBUG_KERNEL
-	default DEBUG_INFO_NONE if COMPILE_TEST
 	help
 	  Selecting something other than "None" results in a kernel image
 	  that will include debugging info resulting in a larger kernel image.
@@ -245,6 +244,12 @@ choice
 	  Choose which version of DWARF debug info to emit. If unsure,
 	  select "Toolchain default".
 
+config DEBUG_INFO_NONE
+	bool "Disable debug information"
+	help
+	  Do not build the kernel with debugging information, which will
+	  result in a faster and smaller build.
+
 config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
 	bool "Rely on the toolchain's implicit default DWARF version"
 	select DEBUG_INFO
@@ -283,12 +288,6 @@ config DEBUG_INFO_DWARF5
 	  config if they rely on tooling that has not yet been updated to
 	  support DWARF Version 5.
 
-config DEBUG_INFO_NONE
-	bool "Disable debug information"
-	help
-	  Do not build the kernel with debugging information, which will
-	  result in a faster and smaller build.
-
 endchoice # "Debug information"
 
 if DEBUG_INFO
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Kees Cook

While trying to make sure CONFIG_DEBUG_INFO wasn't set for COMPILE_TEST, I ordered the choices incorrectly to retain the prior default=n state. Move DEBUG_INFO_NONE to the top so that the default choice is disabled, and remove the "if COMPILE_TEST" as it is now redundant.

Quoted 8 lines

Another fallout of the original change is that defconfigs that do enable CONFIG_DEBUG_INFO without any of the DWARF version configs will not have debug info anymore.

Mainline:

$ make -sj$(nproc) ARCH=arm64 LLVM=1 mrproper defconfig && rg DEBUG_INFO .config
9296:CONFIG_DEBUG_INFO=y
9297:CONFIG_DEBUG_INFO_REDUCED=y
9298:# CONFIG_DEBUG_INFO_COMPRESSED is not set
9299:# CONFIG_DEBUG_INFO_SPLIT is not set
9300:CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
9301:# CONFIG_DEBUG_INFO_DWARF4 is not set
9302:# CONFIG_DEBUG_INFO_DWARF5 is not set

next-20220128:

$ make -sj$(nproc) ARCH=arm64 LLVM=1 mrproper defconfig && rg DEBUG_INFO .config
9299:CONFIG_DEBUG_INFO=y
9300:CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
9301:# CONFIG_DEBUG_INFO_DWARF4 is not set
9302:# CONFIG_DEBUG_INFO_DWARF5 is not set
9303:# CONFIG_DEBUG_INFO_NONE is not set
9304:CONFIG_DEBUG_INFO_REDUCED=y
9305:# CONFIG_DEBUG_INFO_COMPRESSED is not set
9306:# CONFIG_DEBUG_INFO_SPLIT is not set

next-20220128 + this patch:

$ make -sj$(nproc) ARCH=arm64 LLVM=1 mrproper defconfig && rg DEBUG_INFO .config
9299:CONFIG_DEBUG_INFO_NONE=y
9300:# CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is not set
9301:# CONFIG_DEBUG_INFO_DWARF4 is not set
9302:# CONFIG_DEBUG_INFO_DWARF5 is not set

I guess there is not really a way around that other than having people regenerate their defconfigs (which should really be done each release anyways) since DEBUG_INFO is no longer a user selectable symbol and it is probably better to have this choice default to no debug info rather than debug info. Is there any precedent to updating defconfigs due to a change like this or some other way to let people know about it?

Cheers,
Nathan

Quoted 47 lines

---
Andrew, this is a fix for kconfigdebug-make-debug_info-selectable-from-a-choice.patch

---
 lib/Kconfig.debug | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
lib/Kconfig.debug +6 -7
index a7b657d67318..a1262358d55a 100644
@@ -234,7 +234,6 @@ config DEBUG_INFO
 choice
 	prompt "Debug information"
 	depends on DEBUG_KERNEL
-	default DEBUG_INFO_NONE if COMPILE_TEST
 	help
 	  Selecting something other than "None" results in a kernel image
 	  that will include debugging info resulting in a larger kernel image.
@@ -245,6 +244,12 @@ choice
 	  Choose which version of DWARF debug info to emit. If unsure,
 	  select "Toolchain default".
 
+config DEBUG_INFO_NONE
+	bool "Disable debug information"
+	help
+	  Do not build the kernel with debugging information, which will
+	  result in a faster and smaller build.
+
 config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
 	bool "Rely on the toolchain's implicit default DWARF version"
 	select DEBUG_INFO
@@ -283,12 +288,6 @@ config DEBUG_INFO_DWARF5
 	  config if they rely on tooling that has not yet been updated to
 	  support DWARF Version 5.
 
-config DEBUG_INFO_NONE
-	bool "Disable debug information"
-	help
-	  Do not build the kernel with debugging information, which will
-	  result in a faster and smaller build.
-
 endchoice # "Debug information"
 
 if DEBUG_INFO
Signature · 1 line
2.30.2