PATCH] Use -mpreferred-stack-boundary=3 on x86-64 if supported

H.J. Lu
2012-06-23T16:14:50Z

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]

Hi,

-mpreferred-stack-boundary=3 can be used on x86-64 with GCC 4.8.0:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383

I backported it to hjl/x32/gcc-4_7-branch branch at

http://gcc.gnu.org/git/?p=gcc.git;a=summary

http://gcc.gnu.org/git/?p=gcc.git;a=commit;h=96828b1f869a31e3a1227afa420b8f28e71
e006c

This patch uses -mpreferred-stack-boundary=3 on x86-64 if it is supported.
I have been running 3.4 kernel compiled with this option for weeks.

H.J.

[-- Attachment #2: 0001-Use-mpreferred-stack-boundary-3-if-supported.patch --]
[-- Type: application/octet-stream, Size: 884 bytes --]

From 5e067376e73fe3bf86b71c2560e03c5d35a7b537 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 29 May 2012 14:31:23 -0700
Subject: [PATCH] Use -mpreferred-stack-boundary=3 if supported

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
arch/x86/Makefile | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 94e91e4..cd4a4f7 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -49,6 +49,9 @@ else
KBUILD_AFLAGS += -m64
KBUILD_CFLAGS += -m64

+ # Use -mpreferred-stack-boundary=3 if supported.
+ KBUILD_CFLAGS += $(call cc-option,-mno-sse -mpreferred-stack-boundary=3)
+
# FIXME - should be integrated in Makefile.cpu (Makefile_32.cpu)
cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)
cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
--
1.7.10.2