[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20210826185833.174862-1-ndesaulniers@google.com>
Date: Thu, 26 Aug 2021 11:58:33 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Ingo Molnar <mingo@...hat.com>
Cc: llvm@...ts.linux.dev, Masahiro Yamada <masahiroy@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org
Subject: [PATCH] x86/build: Refresh stale cc-option check for stack alignment
GCC did not support values for -mpreferred-stack-boundary= outside the
range [4, 12] for -m64 until GCC 7+. Modify the cc-option tests to check
for support for a value of 3, and only when using GCC.
GCC has long supported values in the range [2, 12] for -m16 and -m32
targets, so there's no need to test for support for
-mpreferred-stack-boundary=2, since cc_stack_align4 is only used for
-m16 and -m32 targets.
Signed-off-by: Nick Desaulniers <ndesaulniers@...gle.com>
---
arch/x86/Makefile | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index d82d01490dd3..2744c4f60b63 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -14,10 +14,11 @@ endif
# For gcc stack alignment is specified with -mpreferred-stack-boundary,
# clang has the option -mstack-alignment for that purpose.
-ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
+ifdef CONFIG_CC_IS_GCC
cc_stack_align4 := -mpreferred-stack-boundary=2
- cc_stack_align8 := -mpreferred-stack-boundary=3
-else ifneq ($(call cc-option, -mstack-alignment=16),)
+ cc_stack_align8 := $(call cc-option,-mpreferred-stack-boundary=3)
+endif
+ifdef CONFIG_CC_IS_CLANG
cc_stack_align4 := -mstack-alignment=4
cc_stack_align8 := -mstack-alignment=8
endif
base-commit: 2e98d9bede666aa8f2137047043bfba9c2c2edc0
--
2.33.0.259.gc128427fd7-goog
Powered by blists - more mailing lists