components/gcc49/patches/000-sol2.h.patch
author Stefan Teleman <stefan.teleman@oracle.com>
Wed, 16 Dec 2015 20:20:50 -0800
changeset 5205 eaff9ab86216
child 5210 f83eefca4ec2
permissions -rw-r--r--
21637184 integrate GCC 4.9.3 in Solaris 21637193 enable CilkPlus support for SPARC in GCC 4.9.3

# Stefan Teleman <[email protected]>
# We need to raise a number of macros depending on which Language
# Standard we are compiling for.
# We also need to link in specific *.o's to the Language Standard
# we are compiling for.
# Solaris specific internal patch.
--- gcc/config/sol2.h	2014-05-28 04:37:50.000000000 -0700
+++ gcc/config/sol2.h	2015-11-10 16:03:47.892113304 -0800
@@ -89,11 +89,76 @@
 	   library.  */					\
 	if (c_dialect_cxx ())				\
 	  {						\
+        if ((cxx_dialect == cxx98) || (cxx_dialect == cxx03))  \
+        { \
+          builtin_define ("__STDC_VERSION__=199409L");         \
+          builtin_define ("_XOPEN_SOURCE=500");                \
+        } \
+        else if (cxx_dialect == cxx11)                         \
+        { \
+          builtin_define ("__STDC_VERSION__=199901L");         \
+          builtin_define ("_STDC_C99=1");                      \
+          builtin_define ("__C99FEATURES__=1");                \
+          builtin_define ("__XPG7_THREAD_MODEL__=1");          \
+          builtin_define ("_XOPEN_SOURCE=700");                \
+          builtin_define ("__STDC_ISO_10646__=201011L");       \
+          builtin_define ("__STDC_MB_MIGHT_NEQ_WC__=1");       \
+          builtin_define ("__STDCPP_STRICT_POINTER_SAFETY__=1");  \
+          builtin_define ("__STDCPP_THREADS__=1");             \
+        } \
+        else if ((cxx_dialect > cxx11) || (cxx_dialect == cxx1y)) \
+        { \
+          builtin_define ("__STDC_VERSION__=201112L");         \
+          builtin_define ("_STDC_C99=1");                      \
+          builtin_define ("_STDC_C11=1");                      \
+          builtin_define ("__C99FEATURES__=1");                \
+          builtin_define ("__XPG7_THREAD_MODEL__=1");          \
+          builtin_define ("_XOPEN_SOURCE=700");                \
+          builtin_define ("__STDC_ISO_10646__=201011L");       \
+          builtin_define ("__STDC_MB_MIGHT_NEQ_WC__=1");       \
+          builtin_define ("__STDCPP_STRICT_POINTER_SAFETY__=1");  \
+          builtin_define ("__STDC_LIB_EXT1__=201112L");         \
+          builtin_define ("__STDCPP_THREADS__=1");             \
+        } \
+        else \
+        { \
 	    builtin_define ("__STDC_VERSION__=199901L");\
 	    builtin_define ("_XOPEN_SOURCE=600");	\
+        } \
 	    builtin_define ("_LARGEFILE_SOURCE=1");	\
 	    builtin_define ("_LARGEFILE64_SOURCE=1");	\
-	    builtin_define ("__EXTENSIONS__");		\
+        builtin_define ("_FILE_OFFSET_BITS=64");              \
+        builtin_define ("__EXTENSIONS__=1");                  \
+        builtin_define ("_REENTRANT=1");                      \
+      }                                                       \
+      if (c_language == clk_c)                                \
+      { \
+        builtin_define ("_LARGEFILE_SOURCE=1");	\
+        builtin_define ("_LARGEFILE64_SOURCE=1");	\
+        builtin_define ("_FILE_OFFSET_BITS=64");              \
+        builtin_define ("_REENTRANT=1");                      \
+        builtin_define ("__EXTENSIONS__=1");                  \
+        if (flag_isoc11 == 1)                                 \
+        { \
+          builtin_define ("_STDC_C11=1");                     \
+          builtin_define ("__STDC_ISO_10646__=201011L");      \
+          builtin_define ("__STDC_MB_MIGHT_NEQ_WC__=1");      \
+          builtin_define ("__STDC_ANALYZABLE=1");             \
+          builtin_define ("__STDC_IEC_559__=1");              \
+          builtin_define ("__STDC_IEC_559_COMPLEX__=1");      \
+          builtin_define ("__STDC_LIB_EXT1__=201112L");       \
+          builtin_define ("__XPG7_THREAD_MODEL__=1");         \
+          builtin_define ("_XOPEN_SOURCE=700");               \
+        } \
+        else if (flag_isoc99 == 1)                            \
+        { \
+          builtin_define ("__C99FEATURES__=1");               \
+          if (flag_isoc11 == 0)                               \
+          { \
+            builtin_define ("_STDC_C99=1");                   \
+            builtin_define ("_XOPEN_SOURCE=600");             \
+          } \
+        } \
 	  }						\
 	TARGET_SUB_OS_CPP_BUILTINS();			\
     } while (0)
@@ -109,7 +174,12 @@
 #define ASM_SPEC_BASE \
 "%{v:-V} %{Qy:} %{!Qn:-Qy} %{Ym,*} -s %(asm_cpu)"
 
+/* GAS wants -KPIC, Sun as wants -K PIC */
+#ifdef USE_GAS
 #define ASM_PIC_SPEC " %{fpic|fpie|fPIC|fPIE:-K PIC}"
+#else
+#define ASM_PIC_SPEC " %{fpic|fpie|fPIC|fPIE:-K PIC}"
+#endif
 
 #undef LIB_SPEC
 #define LIB_SPEC \
@@ -127,8 +197,62 @@
 #endif
 
 #undef STARTFILE_ARCH32_SPEC
-#define STARTFILE_ARCH32_SPEC "%{ansi:values-Xc.o%s} \
-			    %{!ansi:values-Xa.o%s}"
+#define STARTFILE_ARCH32_SPEC "%{std=c++0x:values-Xc.o%s} \
+  %{std=c++0x:values-xpg6.o%s} \
+  %{std=c++14:values-Xc.o%s} \
+  %{std=c++14:values-xpg6.o%s} \
+  %{std=c++11:values-Xc.o%s} \
+  %{std=c++11:values-xpg6.o%s} \
+  %{std=c11:values-Xc.o%s} \
+  %{std=c11:values-xpg6.o%s} \
+  %{std=c1x:values-Xc.o%s} \
+  %{std=c1x:values-xpg6.o%s} \
+  %{std=c99:values-Xc.o%s} \
+  %{std=c99:values-xpg6.o%s} \
+  %{std=c9x:values-Xc.o%s} \
+  %{std=c9x:values-xpg6.o%s} \
+  %{std=gnu++0x:values-Xc.o%s} \
+  %{std=gnu++0x:values-xpg6.o%s} \
+  %{std=gnu++14:values-Xc.o%s} \
+  %{std=gnu++14:values-xpg6.o%s} \
+  %{std=gnu++11:values-Xc.o%s} \
+  %{std=gnu++11:values-xpg6.o%s} \
+  %{std=gnu11:values-Xc.o%s} \
+  %{std=gnu11:values-xpg6.o%s} \
+  %{std=gnu1x:values-Xc.o%s} \
+  %{std=gnu1x:values-xpg6.o%s} \
+  %{std=gnu99:values-Xc.o%s} \
+  %{std=gnu99:values-xpg6.o%s} \
+  %{std=gnu9x:values-Xc.o%s} \
+  %{std=gnu9x:values-xpg6.o%s} \
+  %{std=f2003:values-Xc.o%s} \
+  %{std=f2003:values-xpg6.o%s} \
+  %{std=f2008:values-Xc.o%s} \
+  %{std=f2008:values-xpg6.o%s} \
+  %{std=f2008ts:values-Xc.o%s} \
+  %{std=f2008ts:values-xpg6.o%s} \
+  %{std=f95:values-Xa.o%s} \
+  %{std=f95:values-xpg4.o%s} \
+  %{std=gnu:values-Xa.o%s} \
+  %{std=gnu:values-xpg4.o%s} \
+  %{std=legacy:values-Xa.o%s} \
+  %{std=legacy:values-xpg4.o%s} \
+  %{std=c++03:values-Xa.o%s} \
+  %{std=c++03:values-xpg4.o%s} \
+  %{std=c++98:values-Xa.o%s} \
+  %{std=c++98:values-xpg4.o%s} \
+  %{std=c89:values-Xa.o%s} \
+  %{std=c89:values-xpg4.o%s} \
+  %{std=c90:values-Xa.o%s} \
+  %{std=c90:values-xpg4.o%s} \
+  %{std=gnu++03:values-Xa.o%s} \
+  %{std=gnu++03:values-xpg4.o%s} \
+  %{std=gnu++98:values-Xa.o%s} \
+  %{std=gnu++98:values-xpg4.o%s} \
+  %{std=gnu89:values-Xa.o%s} \
+  %{std=gnu89:values-xpg4.o%s} \
+  %{std=gnu90:values-Xa.o%s} \
+  %{std=gnu90:values-xpg4.o%s}"
 
 #undef STARTFILE_ARCH_SPEC
 #define STARTFILE_ARCH_SPEC STARTFILE_ARCH32_SPEC
@@ -154,8 +278,8 @@
   "%{G:-G} \
    %{YP,*} \
    %{R*} \
-   %{!YP,*:%{p|pg:-Y P,%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/lib:%R/usr/lib} \
-	   %{!p:%{!pg:-Y P,%R/usr/ccs/lib:%R/lib:%R/usr/lib}}}"
+   %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp:%R/lib:%R/usr/lib} \
+     %{!p:%{!pg:-Y P,%R/lib:%R/usr/lib}}}"
 
 #undef LINK_ARCH32_SPEC
 #define LINK_ARCH32_SPEC LINK_ARCH32_SPEC_BASE
@@ -191,6 +315,10 @@
 #define LINK_CLEARCAP_SPEC ""
 #endif
 
+/*
+ * Change -z textwarn to -z text after clearing that [-fpie|-fPIE]
+ * no longer generates any text relocation warnings.
+ */
 #undef  LINK_SPEC
 #define LINK_SPEC \
   "%{h*} %{v:-V} \
@@ -199,6 +327,8 @@
    %{shared:-G -dy %{!mimpure-text:-z text}} " \
    LINK_LIBGCC_MAPFILE_SPEC LINK_CLEARCAP_SPEC " \
    %{symbolic:-Bsymbolic -G -dy -z text} \
+   %{fpie:-Qy -z direct -z textwarn -z type=pie -z aslr=enable} \
+   %{fPIE:-Qy -z direct -z textwarn -z type=pie -z aslr=enable} \
    %(link_arch) \
    %{Qy:} %{!Qn:-Qy}"