diff mbox series

[1/3] Kconfig.debug: simplify the dependency of DEBUG_INFO_DWARF4/5

Message ID 20221002181107.51286-2-masahiroy@kernel.org (mailing list archive)
State New, archived
Headers show
Series Kconfig.debug: make more efforts to fix CONFIG_DEBUG_INFO for Clang+GAS | expand

Commit Message

Masahiro Yamada Oct. 2, 2022, 6:11 p.m. UTC
Commit c0a5c81ca9be ("Kconfig.debug: drop GCC 5+ version check for
DWARF5") could have cleaned up the code a bit deeper.

"CC_IS_CLANG &&" is unneeded. No functional change is intended.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 lib/Kconfig.debug | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Nathan Chancellor Oct. 3, 2022, 4:47 p.m. UTC | #1
On Mon, Oct 03, 2022 at 03:11:05AM +0900, Masahiro Yamada wrote:
> Commit c0a5c81ca9be ("Kconfig.debug: drop GCC 5+ version check for
> DWARF5") could have cleaned up the code a bit deeper.
> 
> "CC_IS_CLANG &&" is unneeded. No functional change is intended.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Good point!

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
> 
>  lib/Kconfig.debug | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index d3e5f36bb01e..f4b2165f24db 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -264,7 +264,7 @@ config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
>  config DEBUG_INFO_DWARF4
>  	bool "Generate DWARF Version 4 debuginfo"
>  	select DEBUG_INFO
> -	depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)))
> +	depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)
>  	help
>  	  Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2
>  	  if using clang without clang's integrated assembler, and gdb 7.0+.
> @@ -276,7 +276,7 @@ config DEBUG_INFO_DWARF4
>  config DEBUG_INFO_DWARF5
>  	bool "Generate DWARF Version 5 debuginfo"
>  	select DEBUG_INFO
> -	depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)))
> +	depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)
>  	help
>  	  Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc
>  	  5.0+ accepts the -gdwarf-5 flag but only had partial support for some
> -- 
> 2.34.1
>
Nick Desaulniers Oct. 3, 2022, 4:53 p.m. UTC | #2
On Sun, Oct 2, 2022 at 11:11 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> Commit c0a5c81ca9be ("Kconfig.debug: drop GCC 5+ version check for
> DWARF5") could have cleaned up the code a bit deeper.
>
> "CC_IS_CLANG &&" is unneeded. No functional change is intended.

This implies that there are only 2 compilers capable of building the
kernel; consider also removing
include/linux/compiler-intel.h
if ICC is no longer supported.  Otherwise, what implications does this
patch have for ICC?

>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
>  lib/Kconfig.debug | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index d3e5f36bb01e..f4b2165f24db 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -264,7 +264,7 @@ config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
>  config DEBUG_INFO_DWARF4
>         bool "Generate DWARF Version 4 debuginfo"
>         select DEBUG_INFO
> -       depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)))
> +       depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)
>         help
>           Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2
>           if using clang without clang's integrated assembler, and gdb 7.0+.
> @@ -276,7 +276,7 @@ config DEBUG_INFO_DWARF4
>  config DEBUG_INFO_DWARF5
>         bool "Generate DWARF Version 5 debuginfo"
>         select DEBUG_INFO
> -       depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)))
> +       depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)
>         help
>           Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc
>           5.0+ accepts the -gdwarf-5 flag but only had partial support for some
> --
> 2.34.1
>
Masahiro Yamada Oct. 3, 2022, 7:56 p.m. UTC | #3
On Tue, Oct 4, 2022 at 1:53 AM Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> On Sun, Oct 2, 2022 at 11:11 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > Commit c0a5c81ca9be ("Kconfig.debug: drop GCC 5+ version check for
> > DWARF5") could have cleaned up the code a bit deeper.
> >
> > "CC_IS_CLANG &&" is unneeded. No functional change is intended.
>
> This implies that there are only 2 compilers capable of building the
> kernel; consider also removing
> include/linux/compiler-intel.h
> if ICC is no longer supported.  Otherwise, what implications does this
> patch have for ICC?




I am just doing logical simplification in general.

When A and B are bool,

   !A || (A && B)

is always redundant.
It can be simplified into

   !A || B



So, this patch is irrelevant to the presence of the third compiler, ICC.

Such an implication happened in commit c0a5c81ca9be.
When you dropped GCC 5+ check, you converted
"GCC_VERSION >= 50000" into "!CC_IS_CLANG" instead of "CC_IS_GCC".


"CC_IS_GCC" and "!CC_IS_CLANG" are not equivalent,
but a lot of code already expects that, and nobody asked
"We have the third compiler, so do we need CC_IS_ICC?"



I agree that we can drop ICC support, but I want to
point out that ICC is DON'T_CARE to my patch.








> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > ---
> >
> >  lib/Kconfig.debug | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > index d3e5f36bb01e..f4b2165f24db 100644
> > --- a/lib/Kconfig.debug
> > +++ b/lib/Kconfig.debug
> > @@ -264,7 +264,7 @@ config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
> >  config DEBUG_INFO_DWARF4
> >         bool "Generate DWARF Version 4 debuginfo"
> >         select DEBUG_INFO
> > -       depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)))
> > +       depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)
> >         help
> >           Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2
> >           if using clang without clang's integrated assembler, and gdb 7.0+.
> > @@ -276,7 +276,7 @@ config DEBUG_INFO_DWARF4
> >  config DEBUG_INFO_DWARF5
> >         bool "Generate DWARF Version 5 debuginfo"
> >         select DEBUG_INFO
> > -       depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)))
> > +       depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)
> >         help
> >           Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc
> >           5.0+ accepts the -gdwarf-5 flag but only had partial support for some
> > --
> > 2.34.1
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers
diff mbox series

Patch

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index d3e5f36bb01e..f4b2165f24db 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -264,7 +264,7 @@  config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
 config DEBUG_INFO_DWARF4
 	bool "Generate DWARF Version 4 debuginfo"
 	select DEBUG_INFO
-	depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)))
+	depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)
 	help
 	  Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2
 	  if using clang without clang's integrated assembler, and gdb 7.0+.
@@ -276,7 +276,7 @@  config DEBUG_INFO_DWARF4
 config DEBUG_INFO_DWARF5
 	bool "Generate DWARF Version 5 debuginfo"
 	select DEBUG_INFO
-	depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)))
+	depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502)
 	help
 	  Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc
 	  5.0+ accepts the -gdwarf-5 flag but only had partial support for some