diff mbox series

kbuild: Simplify DEBUG_INFO Kconfig handling

Message ID 20200816123248.97770-1-sedat.dilek@gmail.com (mailing list archive)
State New, archived
Headers show
Series kbuild: Simplify DEBUG_INFO Kconfig handling | expand

Commit Message

Sedat Dilek Aug. 16, 2020, 12:32 p.m. UTC
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>
---
 Makefile          |  6 +++++-
 lib/Kconfig.debug | 10 ++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

Comments

Sedat Dilek Aug. 26, 2020, 12:04 p.m. UTC | #1
Just a friendly ping.

- Sedat -

On Sun, Aug 16, 2020 at 2:32 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
>
> 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>
> ---
>  Makefile          |  6 +++++-
>  lib/Kconfig.debug | 10 ++++------
>  2 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 24a4c1b97bb0..f7af83393a49 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -810,13 +810,15 @@ endif
>  DEBUG_CFLAGS   := $(call cc-option, -fno-var-tracking-assignments)
>
>  ifdef CONFIG_DEBUG_INFO
> +
>  ifdef CONFIG_DEBUG_INFO_SPLIT
>  DEBUG_CFLAGS   += -gsplit-dwarf
>  else
>  DEBUG_CFLAGS   += -g
>  endif
> +
>  KBUILD_AFLAGS  += -Wa,-gdwarf-2
> -endif
> +
>  ifdef CONFIG_DEBUG_INFO_DWARF4
>  DEBUG_CFLAGS   += -gdwarf-4
>  endif
> @@ -832,6 +834,8 @@ KBUILD_AFLAGS       += -gz=zlib
>  KBUILD_LDFLAGS += --compress-debug-sections=zlib
>  endif
>
> +endif # CONFIG_DEBUG_INFO
> +
>  KBUILD_CFLAGS += $(DEBUG_CFLAGS)
>  export DEBUG_CFLAGS
>
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 9ad9210d70a1..19930c412b93 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -212,9 +212,10 @@ config DEBUG_INFO
>
>           If unsure, say N.
>
> +if DEBUG_INFO
> +
>  config DEBUG_INFO_REDUCED
>         bool "Reduce debugging information"
> -       depends on DEBUG_INFO
>         help
>           If you say Y here gcc is instructed to generate less debugging
>           information for structure types. This means that tools that
> @@ -227,7 +228,6 @@ config DEBUG_INFO_REDUCED
>
>  config DEBUG_INFO_COMPRESSED
>         bool "Compressed debugging information"
> -       depends on DEBUG_INFO
>         depends on $(cc-option,-gz=zlib)
>         depends on $(ld-option,--compress-debug-sections=zlib)
>         help
> @@ -243,7 +243,6 @@ config DEBUG_INFO_COMPRESSED
>
>  config DEBUG_INFO_SPLIT
>         bool "Produce split debuginfo in .dwo files"
> -       depends on DEBUG_INFO
>         depends on $(cc-option,-gsplit-dwarf)
>         help
>           Generate debug info into separate .dwo files. This significantly
> @@ -259,7 +258,6 @@ config DEBUG_INFO_SPLIT
>
>  config DEBUG_INFO_DWARF4
>         bool "Generate dwarf4 debuginfo"
> -       depends on DEBUG_INFO
>         depends on $(cc-option,-gdwarf-4)
>         help
>           Generate dwarf4 debug info. This requires recent versions
> @@ -269,7 +267,6 @@ config DEBUG_INFO_DWARF4
>
>  config DEBUG_INFO_BTF
>         bool "Generate BTF typeinfo"
> -       depends on DEBUG_INFO
>         depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED
>         depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST
>         help
> @@ -279,7 +276,6 @@ config DEBUG_INFO_BTF
>
>  config GDB_SCRIPTS
>         bool "Provide GDB scripts for kernel debugging"
> -       depends on DEBUG_INFO
>         help
>           This creates the required links to GDB helper scripts in the
>           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
>           for further details.
>
> +endif # DEBUG_INFO
> +
>  config ENABLE_MUST_CHECK
>         bool "Enable __must_check logic"
>         default y
> --
> 2.28.0
>
Masahiro Yamada Aug. 26, 2020, 1:42 p.m. UTC | #2
On Wed, Aug 26, 2020 at 9:04 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
>
> Just a friendly ping.
>
> - Sedat -
>
> On Sun, Aug 16, 2020 at 2:32 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
> >
> > While playing with [1] I saw that the handling
> > of CONFIG_DEBUG_INFO can be simplified.
> >
> > [1] https://patchwork.kernel.org/patch/11716107/


Applied to linux-kbuild.

Sorry for the delay.
Sedat Dilek Aug. 26, 2020, 2:21 p.m. UTC | #3
On Wed, Aug 26, 2020 at 3:43 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Wed, Aug 26, 2020 at 9:04 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
> >
> > Just a friendly ping.
> >
> > - Sedat -
> >
> > On Sun, Aug 16, 2020 at 2:32 PM Sedat Dilek <sedat.dilek@gmail.com> wrote:
> > >
> > > While playing with [1] I saw that the handling
> > > of CONFIG_DEBUG_INFO can be simplified.
> > >
> > > [1] https://patchwork.kernel.org/patch/11716107/
>
>
> Applied to linux-kbuild.
>
> Sorry for the delay.
>

No problem.

Thanks.

- Sedat -
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 24a4c1b97bb0..f7af83393a49 100644
--- a/Makefile
+++ b/Makefile
@@ -810,13 +810,15 @@  endif
 DEBUG_CFLAGS	:= $(call cc-option, -fno-var-tracking-assignments)
 
 ifdef CONFIG_DEBUG_INFO
+
 ifdef CONFIG_DEBUG_INFO_SPLIT
 DEBUG_CFLAGS	+= -gsplit-dwarf
 else
 DEBUG_CFLAGS	+= -g
 endif
+
 KBUILD_AFLAGS	+= -Wa,-gdwarf-2
-endif
+
 ifdef CONFIG_DEBUG_INFO_DWARF4
 DEBUG_CFLAGS	+= -gdwarf-4
 endif
@@ -832,6 +834,8 @@  KBUILD_AFLAGS	+= -gz=zlib
 KBUILD_LDFLAGS	+= --compress-debug-sections=zlib
 endif
 
+endif # CONFIG_DEBUG_INFO
+
 KBUILD_CFLAGS += $(DEBUG_CFLAGS)
 export DEBUG_CFLAGS
 
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 9ad9210d70a1..19930c412b93 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -212,9 +212,10 @@  config DEBUG_INFO
 
 	  If unsure, say N.
 
+if DEBUG_INFO
+
 config DEBUG_INFO_REDUCED
 	bool "Reduce debugging information"
-	depends on DEBUG_INFO
 	help
 	  If you say Y here gcc is instructed to generate less debugging
 	  information for structure types. This means that tools that
@@ -227,7 +228,6 @@  config DEBUG_INFO_REDUCED
 
 config DEBUG_INFO_COMPRESSED
 	bool "Compressed debugging information"
-	depends on DEBUG_INFO
 	depends on $(cc-option,-gz=zlib)
 	depends on $(ld-option,--compress-debug-sections=zlib)
 	help
@@ -243,7 +243,6 @@  config DEBUG_INFO_COMPRESSED
 
 config DEBUG_INFO_SPLIT
 	bool "Produce split debuginfo in .dwo files"
-	depends on DEBUG_INFO
 	depends on $(cc-option,-gsplit-dwarf)
 	help
 	  Generate debug info into separate .dwo files. This significantly
@@ -259,7 +258,6 @@  config DEBUG_INFO_SPLIT
 
 config DEBUG_INFO_DWARF4
 	bool "Generate dwarf4 debuginfo"
-	depends on DEBUG_INFO
 	depends on $(cc-option,-gdwarf-4)
 	help
 	  Generate dwarf4 debug info. This requires recent versions
@@ -269,7 +267,6 @@  config DEBUG_INFO_DWARF4
 
 config DEBUG_INFO_BTF
 	bool "Generate BTF typeinfo"
-	depends on DEBUG_INFO
 	depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED
 	depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST
 	help
@@ -279,7 +276,6 @@  config DEBUG_INFO_BTF
 
 config GDB_SCRIPTS
 	bool "Provide GDB scripts for kernel debugging"
-	depends on DEBUG_INFO
 	help
 	  This creates the required links to GDB helper scripts in the
 	  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
 	  for further details.
 
+endif # DEBUG_INFO
+
 config ENABLE_MUST_CHECK
 	bool "Enable __must_check logic"
 	default y