23587181 Align gcc optimizer with Solaris x86 32-bit ABI for building Userland components
authorAlan Coopersmith <Alan.Coopersmith@Oracle.COM>
Wed, 15 Jun 2016 22:04:52 -0700
changeset 6231 8b569784feeb
parent 6230 126ac13f1547
child 6232 42781cd5b9bd
23587181 Align gcc optimizer with Solaris x86 32-bit ABI for building Userland components
components/gcc3/Makefile
components/gnome/gtk2/Makefile
make-rules/shared-macros.mk
--- a/components/gcc3/Makefile	Thu Jun 16 09:06:16 2016 -0700
+++ b/components/gcc3/Makefile	Wed Jun 15 22:04:52 2016 -0700
@@ -68,6 +68,9 @@
 
 CFLAGS += -std=gnu89
 
+# gcc3 doesn't support -mincoming-stack-boundary, but doesn't need it either.
+gcc_STACK_ALIGN.i386.32 =
+
 CONFIGURE_PREFIX =	/usr/gcc/3.4
 CONFIGURE_INFODIR =	$(CONFIGURE_PREFIX)/share/info
 
--- a/components/gnome/gtk2/Makefile	Thu Jun 16 09:06:16 2016 -0700
+++ b/components/gnome/gtk2/Makefile	Wed Jun 15 22:04:52 2016 -0700
@@ -53,13 +53,6 @@
 
 CFLAGS += $(CPP_XPG6MODE)
 
-# gcc defaults to assuming stacks are 8 byte aligned on x86, but some
-# important existing binaries use the 4 byte alignment from the SysV ABI
-# and may segv on instructions like MOVAPS that require correct alignment,
-# so we override the gcc defaults until gcc fixes
-# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838
-gcc_OPT.i386.32 += -mincoming-stack-boundary=2
-
 # Generate man pages.
 CONFIGURE_OPTIONS += --enable-man
 # Required for other components.
--- a/make-rules/shared-macros.mk	Thu Jun 16 09:06:16 2016 -0700
+++ b/make-rules/shared-macros.mk	Wed Jun 15 22:04:52 2016 -0700
@@ -879,12 +879,20 @@
 # component build with CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)" or similiar.
 #
 
+# gcc defaults to assuming stacks are 8 byte aligned on x86, but some
+# important existing binaries use the 4 byte alignment from the SysV ABI
+# and may segv on instructions like MOVAPS that require correct alignment,
+# so we override the gcc defaults until gcc fixes - see Oracle bug 21393975
+# or upstream bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62281
+gcc_STACK_ALIGN.i386.32 += -mincoming-stack-boundary=2
+
 # GCC Compiler optimization flag
 gcc_OPT.sparc.32 ?=	-O3
 gcc_OPT.sparc.64 ?=	-O3
 gcc_OPT.i386.32 ?=	-O3
 gcc_OPT.i386.64 ?=	-O3
-gcc_OPT ?=		$(gcc_OPT.$(MACH).$(BITS))
+gcc_OPT ?=		$(gcc_OPT.$(MACH).$(BITS)) \
+			$(gcc_STACK_ALIGN.$(MACH).$(BITS))
 
 # GCC PIC code generation.  Use CC_PIC instead to select PIC code generation.
 gcc_PIC =	-fPIC -DPIC