This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] powerpc64: prevent '__PIC__ redefined' messages


GCC always generates PIC code for powerpc64-linux.  __PIC__ is always
defined, and the options -fPIC and -fpic define it again, causing
warnings about the redefinition.  This patch is based on one against
the 3.2 branch (not in CVS) from Alan Modra.

Tested on powerpc64-linux with a cross compiler (c,c++,f77) and
64-bit bootstrap.  Those used to get hundreds of warnings about __PIC__
being redefined; those are now gone, and test results had no change.

OK for the mainline and the 3.3 branch?

2003-01-10  Janis Johnson  <janis187@us.ibm.com>

	* config/rs6000/linux64.h (TARGET_OS_CPP_BUILTINS): Don't define
	__PIC__.  (CPP_PIC_DEFAULT): New macro, with definition for ppc64.
	* config/rs6000/sysv4.h (CPP_PIC_DEFAULT): Default definition.
	(CPP_SYSV_SPEC): Use CPP_PIC_DEFAULT for -fPIC, -fpic.

Index: config/rs6000/linux64.h
===================================================================
RCS file: /home/janis/gcc_rsync/gcc-cvs/gcc/gcc/config/rs6000/linux64.h,v
retrieving revision 1.32
diff -u -p -r1.32 linux64.h
--- config/rs6000/linux64.h	16 Dec 2002 18:21:46 -0000	1.32
+++ config/rs6000/linux64.h	8 Jan 2003 18:19:28 -0000
@@ -118,12 +118,14 @@ Boston, MA 02111-1307, USA.  */
       builtin_define ("__PPC64__");         \
       builtin_define ("__powerpc__");       \
       builtin_define ("__powerpc64__");     \
-      builtin_define ("__PIC__");           \
       builtin_define ("__ELF__");           \
       builtin_assert ("cpu=powerpc64");     \
       builtin_assert ("machine=powerpc64"); \
     }                                       \
   while (0)
+
+#undef  CPP_PIC_DEFAULT
+#define CPP_PIC_DEFAULT "-D__PIC__ -D__pic__"
 
 #undef  CPP_OS_DEFAULT_SPEC
 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
Index: config/rs6000/sysv4.h
===================================================================
RCS file: /home/janis/gcc_rsync/gcc-cvs/gcc/gcc/config/rs6000/sysv4.h,v
retrieving revision 1.114
diff -u -p -r1.114 sysv4.h
--- config/rs6000/sysv4.h	16 Dec 2002 18:21:49 -0000	1.114
+++ config/rs6000/sysv4.h	9 Jan 2003 00:49:08 -0000
@@ -949,10 +949,14 @@ do {						\
 
 #define LINK_OS_DEFAULT_SPEC ""
 
+/* Default defines for generating PIC code.  */
+#define CPP_PIC_DEFAULT ""
+
 #define CPP_SYSV_SPEC \
 "%{mrelocatable*: -D_RELOCATABLE} \
 %{fpic: -D__PIC__=1 -D__pic__=1} \
-%{!fpic: %{fPIC: -D__PIC__=2 -D__pic__=2}}"
+%{!fpic: %{fPIC: -D__PIC__=2 -D__pic__=2}} \
+%{!fpic: %{!fPIC: %(cpp_pic_default)}}"
 
 /* Override rs6000.h definition.  */
 #undef	CPP_SPEC
@@ -1269,6 +1273,7 @@ ncrtn.o%s"
   { "cc1_endian_big",		CC1_ENDIAN_BIG_SPEC },			\
   { "cc1_endian_little",	CC1_ENDIAN_LITTLE_SPEC },		\
   { "cc1_endian_default",	CC1_ENDIAN_DEFAULT_SPEC },		\
+  { "cpp_pic_default",		CPP_PIC_DEFAULT },			\
   { "cpp_os_ads",		CPP_OS_ADS_SPEC },			\
   { "cpp_os_yellowknife",	CPP_OS_YELLOWKNIFE_SPEC },		\
   { "cpp_os_mvme",		CPP_OS_MVME_SPEC },			\


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]