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

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