Blame SOURCES/gcc32-ppc64-stack-boundary.patch

6f1b0c
2005-09-23  Alexandre Oliva  <aoliva@redhat.com>
6f1b0c
6f1b0c
	* config/rs6000/sysv4.h (PREFERRED_STACK_BOUNDARY): New,
6f1b0c
	same as STACK_BOUNDARY as in rs6000.h.
6f1b0c
6f1b0c
--- gcc/config/rs6000/sysv4.h.orig
6f1b0c
+++ gcc/config/rs6000/sysv4.h
6f1b0c
@@ -395,6 +395,22 @@ do {									\
6f1b0c
 #undef	STACK_BOUNDARY
6f1b0c
 #define	STACK_BOUNDARY	(TARGET_ALTIVEC_ABI ? 128 : 64)
6f1b0c
 
6f1b0c
+/* The definition above is actually wrong, since it doesn't use
6f1b0c
+   128-bit alignment on ppc64 like the ABI mandates.  It was removed
6f1b0c
+   in newer versions of GCC.  The correct definition would be the one
6f1b0c
+   below, from rs6000.h.  Unfortunately, changing it would increase
6f1b0c
+   the stack alignment expectations of newly-compiled functions, that
6f1b0c
+   might be called by functions compiled with the old compiler.  If
6f1b0c
+   the latter didn't keep the stack sufficiently aligned.  This may
6f1b0c
+   happen if the latter uses alloca() or dynamically-sized arrays.  We
6f1b0c
+   compensate for the error here, getting the compiler to keep the
6f1b0c
+   stack aligned to the correct boundary, but not assuming it is
6f1b0c
+   sufficiently aligned.  Code that still assumes proper alignment
6f1b0c
+   will fail and require recompilation with this patch or a newer
6f1b0c
+   compiler, but most of the code will work without change.  */
6f1b0c
+#define PREFERRED_STACK_BOUNDARY \
6f1b0c
+  ((TARGET_32BIT && !TARGET_ALTIVEC_ABI) ? 64 : 128)
6f1b0c
+
6f1b0c
 /* Real stack boundary as mandated by the appropriate ABI.  */
6f1b0c
 #define ABI_STACK_BOUNDARY ((TARGET_EABI && !TARGET_ALTIVEC_ABI) ? 64 : 128)
6f1b0c