components/gcc5/patches/002-libc-values.patch
author Norm Jacobs <Norm.Jacobs@Oracle.COM>
Wed, 07 Sep 2016 18:09:38 -0500
changeset 6859 569bef81e3c4
parent 5342 components/gcc53/patches/002-libc-values.patch@e55d87e99ecd
child 7161 7a2bce2bb68a
permissions -rw-r--r--
22991497 /usr/gcc/5.3 should be /usr/gcc/5

#
# As the comment mentions below, match the values-*.o that selects the libc
# behaviour for the C/C++ standard selected on the command line.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40411
#
--- gcc-5.3.0.orig/gcc/config/sol2.h	Thu Oct  1 05:01:18 2015
+++ gcc-5.3.0/gcc/config/sol2.h	Tue Jan 12 17:39:43 2016
@@ -150,9 +150,32 @@
 #define MD_EXEC_PREFIX "/usr/ccs/bin/"
 #endif
 
+/* Solaris libc and libm implement multiple behaviours for various interfaces
+   that have changed over the years in different versions of the standards.
+   The behaviour is controlled by linking corresponding values-*.o objects.
+   Each of these objects contain alternate defintions of one or more variables
+   that libc uses to select which conflicting behaviour it should exhibit.
+   There are two sets of these objects, values-X*.o and values-xpg*.o.
+
+   The values-X*.o objects set the variable _lib_version to one of strict_ansi,
+   ansi_1, or c_issue_4.  Ignoring '-Xt' and '-Xs', unless '-Xc' is used with
+   the Solaris Studio C/C++ compilers, it appears that values-Xa.o is linked
+   into resulting executables regardless of which '-std=' setting is selected.
+
+   The values-xpg*.o objects define one or more __xpg* variables.  No
+   values-xpg*.o object is linked in unless the equivalent of '-std=c99|c11'
+   is used during the linking of C code.  In either of those cases,
+   values-xpg6.o is linked.
+
+   The below spec string is reasonably consistent with that behaviour. */
 #undef STARTFILE_ARCH_SPEC
-#define STARTFILE_ARCH_SPEC "%{ansi:values-Xc.o%s} \
-			    %{!ansi:values-Xa.o%s}"
+#define STARTFILE_ARCH_SPEC \
+    "%{ansi:values-Xc.o%s; :values-Xa.o%s} \
+     %{std=c99|std=c9x|std=gnu99|std=gnu9x:values-xpg6.o%s} \
+     %{std=c11|std=c1x|std=gnu11|std=gnu1x:values-xpg6.o%s} \
+     %{std=c++11|std=c++0x|std=gnu++11|std=gnu++0x:values-xpg6.o%s} \
+     %{std=c++14|std=c++1y|std=gnu++14|std=gnu++1y:values-xpg6.o%s} \
+     %{std=c++1z|std=gnu++1z:values-xpg6.o%s}"
 
 #if defined(HAVE_LD_PIE) && defined(HAVE_SOLARIS_CRTS)
 #define STARTFILE_CRTBEGIN_SPEC "%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"