This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/53383] New: Allow -mpreferred-stack-boundary=3 on x86-64
- From: "hpa at zytor dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 17 May 2012 00:12:57 +0000
- Subject: [Bug c/53383] New: Allow -mpreferred-stack-boundary=3 on x86-64
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383
Bug #: 53383
Summary: Allow -mpreferred-stack-boundary=3 on x86-64
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: hpa@zytor.com
In the Linux kernel, we do not use SSE or floating-point of any kind (except in
very particular highly controlled places); furthermore, stack space is at an
extreme premium. As such, it makes absolutely no sense to align the stack to
16 bytes in x86-64.
gcc, however, refuses to allow setting the stack alignment to 8 bytes:
: anacreon 105 ; gcc -mpreferred-stack-boundary=3 -mincoming-stack-boundary=3
-O2 -mno-sse -c /tmp/foo.c
/tmp/foo.c:1:0: error: -mpreferred-stack-boundary=3 is not between 4 and 12
/tmp/foo.c:1:0: error: -mincoming-stack-boundary=3 is not between 4 and 12
This is particularly ironic since we have found out that, in fact, ALL kernel
stacks are actually 16-byte misaligned on x86-64 as the entry code pushes a
total of 88 bytes onto the stack. As such, gcc trying to keep a 16-byte
alignment actually makes the code do worse, not better.