diff mbox series

[5/7] x86: remove cc-option-yn test for -mtune=

Message ID 20210817002109.2736222-6-ndesaulniers@google.com (mailing list archive)
State New, archived
Headers show
Series kbuild: remove cc-option-yn | expand

Commit Message

Nick Desaulniers Aug. 17, 2021, 12:21 a.m. UTC
As noted in the comment, -mtune= has been supported since GCC 3.4. The
minimum required version of GCC to build the kernel (as specified in
Documentation/process/changes.rst) is GCC 4.9.

tune is not immediately expanded. Instead it defines a macro that will
test via cc-option later values for -mtune=. But we can skip the test
whether to use -mtune= vs. -mcpu=.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: x86@kernel.org
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 arch/x86/Makefile_32.cpu | 6 ------
 1 file changed, 6 deletions(-)

Comments

Nathan Chancellor Aug. 17, 2021, 2:08 a.m. UTC | #1
On 8/16/2021 5:21 PM, 'Nick Desaulniers' via Clang Built Linux wrote:
> As noted in the comment, -mtune= has been supported since GCC 3.4. The
> minimum required version of GCC to build the kernel (as specified in
> Documentation/process/changes.rst) is GCC 4.9.
> 
> tune is not immediately expanded. Instead it defines a macro that will
> test via cc-option later values for -mtune=. But we can skip the test
> whether to use -mtune= vs. -mcpu=.
> 
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: H. Peter Anvin <hpa@zytor.com>
> Cc: x86@kernel.org
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Yay for removing stale checks!

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

> ---
>   arch/x86/Makefile_32.cpu | 6 ------
>   1 file changed, 6 deletions(-)
> 
> diff --git a/arch/x86/Makefile_32.cpu b/arch/x86/Makefile_32.cpu
> index cd3056759880..e7355f8b51c2 100644
> --- a/arch/x86/Makefile_32.cpu
> +++ b/arch/x86/Makefile_32.cpu
> @@ -2,13 +2,7 @@
>   # CPU tuning section - shared with UML.
>   # Must change only cflags-y (or [yn]), not CFLAGS! That makes a difference for UML.
>   
> -#-mtune exists since gcc 3.4
> -HAS_MTUNE	:= $(call cc-option-yn, -mtune=i386)
> -ifeq ($(HAS_MTUNE),y)
>   tune		= $(call cc-option,-mtune=$(1),$(2))
> -else
> -tune		= $(call cc-option,-mcpu=$(1),$(2))
> -endif
>   
>   cflags-$(CONFIG_M486SX)		+= -march=i486
>   cflags-$(CONFIG_M486)		+= -march=i486
>
Masahiro Yamada Aug. 19, 2021, 7:54 p.m. UTC | #2
On Tue, Aug 17, 2021 at 9:21 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> As noted in the comment, -mtune= has been supported since GCC 3.4. The
> minimum required version of GCC to build the kernel (as specified in
> Documentation/process/changes.rst) is GCC 4.9.
>
> tune is not immediately expanded. Instead it defines a macro that will
> test via cc-option later values for -mtune=. But we can skip the test
> whether to use -mtune= vs. -mcpu=.
>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: H. Peter Anvin <hpa@zytor.com>
> Cc: x86@kernel.org
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
>  arch/x86/Makefile_32.cpu | 6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/arch/x86/Makefile_32.cpu b/arch/x86/Makefile_32.cpu
> index cd3056759880..e7355f8b51c2 100644
> --- a/arch/x86/Makefile_32.cpu
> +++ b/arch/x86/Makefile_32.cpu
> @@ -2,13 +2,7 @@
>  # CPU tuning section - shared with UML.
>  # Must change only cflags-y (or [yn]), not CFLAGS! That makes a difference for UML.
>
> -#-mtune exists since gcc 3.4
> -HAS_MTUNE      := $(call cc-option-yn, -mtune=i386)
> -ifeq ($(HAS_MTUNE),y)
>  tune           = $(call cc-option,-mtune=$(1),$(2))
> -else
> -tune           = $(call cc-option,-mcpu=$(1),$(2))
> -endif
>
>  cflags-$(CONFIG_M486SX)                += -march=i486
>  cflags-$(CONFIG_M486)          += -march=i486
> --
> 2.33.0.rc1.237.g0d66db33f3-goog
>

LGTM.

Perhaps, a follow-up patch can remove the tune macro too,
replacing  $(call tune,pentium2) with $(call cc-option,-mtune=pentium2)







--
Best Regards
Masahiro Yamada
Miguel Ojeda Aug. 19, 2021, 10:19 p.m. UTC | #3
On Tue, Aug 17, 2021 at 2:21 AM 'Nick Desaulniers' via Clang Built
Linux <clang-built-linux@googlegroups.com> wrote:
>
> As noted in the comment, -mtune= has been supported since GCC 3.4. The
> minimum required version of GCC to build the kernel (as specified in
> Documentation/process/changes.rst) is GCC 4.9.

Yes, please!

Reviewed-by: Miguel Ojeda <ojeda@kernel.org>

Cheers,
Miguel
Masahiro Yamada Aug. 25, 2021, 4:39 a.m. UTC | #4
On Fri, Aug 20, 2021 at 7:20 AM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Tue, Aug 17, 2021 at 2:21 AM 'Nick Desaulniers' via Clang Built
> Linux <clang-built-linux@googlegroups.com> wrote:
> >
> > As noted in the comment, -mtune= has been supported since GCC 3.4. The
> > minimum required version of GCC to build the kernel (as specified in
> > Documentation/process/changes.rst) is GCC 4.9.
>
> Yes, please!
>
> Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
>
> Cheers,
> Miguel


Applied to linux-kbuild.
diff mbox series

Patch

diff --git a/arch/x86/Makefile_32.cpu b/arch/x86/Makefile_32.cpu
index cd3056759880..e7355f8b51c2 100644
--- a/arch/x86/Makefile_32.cpu
+++ b/arch/x86/Makefile_32.cpu
@@ -2,13 +2,7 @@ 
 # CPU tuning section - shared with UML.
 # Must change only cflags-y (or [yn]), not CFLAGS! That makes a difference for UML.
 
-#-mtune exists since gcc 3.4
-HAS_MTUNE	:= $(call cc-option-yn, -mtune=i386)
-ifeq ($(HAS_MTUNE),y)
 tune		= $(call cc-option,-mtune=$(1),$(2))
-else
-tune		= $(call cc-option,-mcpu=$(1),$(2))
-endif
 
 cflags-$(CONFIG_M486SX)		+= -march=i486
 cflags-$(CONFIG_M486)		+= -march=i486