[PATCH 3/6] x86/build: Clean up stack alignment flags in CC_FLAGS_FPU

Nathan Chancellor posted 6 patches 1 month, 2 weeks ago
[PATCH 3/6] x86/build: Clean up stack alignment flags in CC_FLAGS_FPU
Posted by Nathan Chancellor 1 month, 2 weeks ago
The minimum supported version of GCC to build the x86 kernel was bumped
to GCC 8.1 in commit a3e8fe814ad1 ("x86/build: Raise the minimum GCC
version to 8.1").

Prior to GCC 7.1, '-mpreferred-stack-boundary=3' was not allowed with
'-msse', so areas of the kernel that needed floating point had a
different alignment. Now that GCC > 7.1 is mandatory, there is no need
to have a different value of '-mpreferred-stack-boundary' from the rest
of the kernel, so remove this handling from CC_FLAGS_FPU.

Link: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=34fac449e121be97dd073c5428cc855367b2872c
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 arch/x86/Makefile | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index f0aa58d2ec17..0c82a610fb54 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -84,19 +84,7 @@ KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-av
 #
 CC_FLAGS_FPU := -msse -msse2
 ifdef CONFIG_CC_IS_GCC
-# Stack alignment mismatch, proceed with caution.
-# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
-# (8B stack alignment).
-# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383
-#
-# The "-msse" in the first argument is there so that the
-# -mpreferred-stack-boundary=3 build error:
-#
-#  -mpreferred-stack-boundary=3 is not between 4 and 12
-#
-# can be triggered. Otherwise gcc doesn't complain.
 CC_FLAGS_FPU += -mhard-float
-CC_FLAGS_FPU += $(call cc-option,-msse -mpreferred-stack-boundary=3,-mpreferred-stack-boundary=4)
 endif
 
 ifeq ($(CONFIG_X86_KERNEL_IBT),y)

-- 
2.50.1
[tip: x86/build] x86/build: Clean up stack alignment flags in CC_FLAGS_FPU
Posted by tip-bot2 for Nathan Chancellor 1 month, 2 weeks ago
The following commit has been merged into the x86/build branch of tip:

Commit-ID:     487fe3a936b0b84ef09fa324b4c01d059886f951
Gitweb:        https://git.kernel.org/tip/487fe3a936b0b84ef09fa324b4c01d059886f951
Author:        Nathan Chancellor <nathan@kernel.org>
AuthorDate:    Thu, 14 Aug 2025 18:31:39 -07:00
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Sat, 16 Aug 2025 23:50:16 +02:00

x86/build: Clean up stack alignment flags in CC_FLAGS_FPU

The minimum supported version of GCC to build the x86 kernel was bumped
to GCC 8.1 in

  a3e8fe814ad1 ("x86/build: Raise the minimum GCC version to 8.1").

Prior to GCC 7.1, '-mpreferred-stack-boundary=3' was not allowed with
'-msse', so areas of the kernel that needed floating point had a
different alignment. Now that GCC > 7.1 is mandatory, there is no need
to have a different value of '-mpreferred-stack-boundary' from the rest
of the kernel, so remove this handling from CC_FLAGS_FPU.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=34fac449e121be97dd073c5428cc855367b2872c
Link: https://lore.kernel.org/20250814-x86-min-ver-cleanups-v1-3-ff7f19457523@kernel.org
---
 arch/x86/Makefile | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index f0aa58d..0c82a61 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -84,19 +84,7 @@ KBUILD_RUSTFLAGS += -Ctarget-feature=-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-av
 #
 CC_FLAGS_FPU := -msse -msse2
 ifdef CONFIG_CC_IS_GCC
-# Stack alignment mismatch, proceed with caution.
-# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
-# (8B stack alignment).
-# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383
-#
-# The "-msse" in the first argument is there so that the
-# -mpreferred-stack-boundary=3 build error:
-#
-#  -mpreferred-stack-boundary=3 is not between 4 and 12
-#
-# can be triggered. Otherwise gcc doesn't complain.
 CC_FLAGS_FPU += -mhard-float
-CC_FLAGS_FPU += $(call cc-option,-msse -mpreferred-stack-boundary=3,-mpreferred-stack-boundary=4)
 endif
 
 ifeq ($(CONFIG_X86_KERNEL_IBT),y)