On Solaris, gcc has long failed to enable libc's C99 mode as documented in PR target/40411. To do so, one needs to link with a values-xpg6.o file provided by the system. That file defines a __xpg6 variable in a way which lets libc (and in some cases libm) select between C99 and non-C99 behaviour at runtime. This failure causes lots of problems for users and has become worse since GCC 5 which enables -std=gnu11 by default, requiring C99 behaviour without any special options. We also have two testcases that are xfail'ed because of this issue. The fix in itself is trivial, but has long been highly contentious because it affects even shared libraries that are compiled as (and may even require) C90 mode. However, there's nothing to be done about that since this is how Solaris' C99 mode selection works, and the alternative (not enabling it all or leaving linking some weird object to the users) are far worse. At the same time, I had a new look at when values-Xc.o is used by the Studio compilers. It selects strict ISO C mode in a couple of cases, and the latest Studio 12.6 cc, which is about to do away with the previous -Xc option which enabled that mode in favour of gcc-compatible -pedantic, uses the latter to control its use. So I've changed gcc to follow suit. Given that only one instance of the __xpg6 etc. variables take effect per process, I'm only linking the values-*.o files into executable programs, not shared libraries. Versions of this patch have long been in the Solaris userland and OpenIndiana oi-userland repos with no ill effect, and the current one has been bootstrapped on the whole range of Solaris targets (*86*-pc-solaris2.1[01] and sparc*-sun-solaris2.1[01]) without regressions. The STARTFILE_ARCH_SPEC comment is losely based on one from the Solaris userland repo patch, but heavily reworked, clarified and extended. Also, to the best of my knowledge Oracle has a corporate copyright assignment in place, so this shouldn't be a problem anyway. Installed on mainline. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2017-01-10 Rainer Orth gcc/testsuite: PR libfortran/67412 * gfortran.dg/execute_command_line_2.f90: Remove dg-xfail-run-if on *-*-solaris2.10. libstdc++-v3: PR libstdc++/64054 * testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc: Remove dg-xfail-run-if. gcc: PR target/40411 * config/sol2.h (STARTFILE_ARCH_SPEC): Don't use with -shared or -symbolic. Use values-Xc.o for -pedantic. Link with values-xpg4.o for C90, values-xpg6.o otherwise.