Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Feb 2009 20:09:31 GMT
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 158034 for review
Message-ID:  <200902212009.n1LK9V1m063357@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=158034

Change 158034 by nwhitehorn@nwhitehorn_trantor on 2009/02/21 20:08:58

	GCC breaks in interesting ways if you try to use the System V R4 ABI
	on 64-bit systems. Folow NetBSD and Linux and use the AIX ABI for
	PPC64.

Affected files ...

.. //depot/projects/ppc-g5/contrib/gcc/config/rs6000/freebsd.h#3 edit
.. //depot/projects/ppc-g5/contrib/gcc/config/rs6000/sysv4.h#2 edit

Differences ...

==== //depot/projects/ppc-g5/contrib/gcc/config/rs6000/freebsd.h#3 (text+ko) ====

@@ -21,22 +21,25 @@
 
 /* Override the defaults, which exist to force the proper definition.  */
 
+#undef TARGET_64BIT
+#define TARGET_64BIT (TARGET_CPU_DEFAULT != NULL && strcmp(TARGET_CPU_DEFAULT, \
+    "powerpc64") == 0)
+
 #ifdef IN_LIBGCC2
 #undef TARGET_64BIT
-#ifdef __powerpc64__
+#ifdef __ppc64__
 #define TARGET_64BIT 1
 #else
 #define TARGET_64BIT 0
 #endif
 #endif
 
-#undef TARGET_64BIT
-#ifdef TARGET_CPU_DEFAULT
-#define TARGET_64BIT 1
-#else
-#error 32 bit
-#define TARGET_64BIT 0
-#endif
+/* On 64-bit systems, use the AIX ABI like Linux and NetBSD */
+
+#undef DEFAULT_ABI
+#define DEFAULT_ABI (TARGET_64BIT ? ABI_AIX : ABI_V4)
+#undef	TARGET_AIX
+#define	TARGET_AIX TARGET_64BIT
 
 #undef	CPP_OS_DEFAULT_SPEC
 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_freebsd)"
@@ -54,6 +57,7 @@
 	{					\
 	  builtin_define ("__LP64__");		\
 	  builtin_define ("__ppc64__");		\
+	  builtin_define ("__powerpc64__");	\
 	  builtin_define ("__arch64__");	\
 	}					\
     }						\

==== //depot/projects/ppc-g5/contrib/gcc/config/rs6000/sysv4.h#2 (text+ko) ====

@@ -103,7 +103,12 @@
   else if (!strcmp (rs6000_abi_name, "aixdesc"))			\
     rs6000_current_abi = ABI_AIX;					\
   else if (!strcmp (rs6000_abi_name, "freebsd"))			\
-    rs6000_current_abi = ABI_V4;					\
+    {									\
+      if (TARGET_64BIT)							\
+	rs6000_current_abi = ABI_AIX;					\
+      else								\
+	rs6000_current_abi = ABI_V4;					\
+    }									\
   else if (!strcmp (rs6000_abi_name, "linux"))				\
     {									\
       if (TARGET_64BIT)							\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902212009.n1LK9V1m063357>