From patchwork Fri Jan 12 09:59:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 859706 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-470954-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="J4f/eegz"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zHyrx5vp5z9t34 for ; Fri, 12 Jan 2018 20:59:28 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=kdzZrCQM9sKmHZuBKCuYRE9nIGiBE5HWQ3fDGLn8RIWcTklq4F nLNd8CtpL/CHW0aDZwoqfP16aT3+PL5LwlmEDRh+8yodWNVB7o8i5wqfwoqhOw3S 0wvJitMuV3pXPAXur3lVIekO2GUvhexoUkPtEEkHYgg6LG6QFOHJO0TwA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type; s= default; bh=VnySfoct7Y7T2g51Fs/5bqk8m7M=; b=J4f/eegzvudOpr8yorfF E6IB8R8jOUtygUyZ1pWXU2L5NPjQlkMewsEx6zIvEz0FcNYkuX7jm7vfhgi36aCl MG+RWZwTCf7sx+a85mFfu0/bz19SGnaXVpTrG0cNYrZYwqShPh3Lu53BFUUndG68 Cr64eaEF0xrGlRWxaUamgwA= Received: (qmail 16140 invoked by alias); 12 Jan 2018 09:59:21 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 16094 invoked by uid 89); 12 Jan 2018 09:59:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-20.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Oracle, suit X-Spam-User: qpsmtpd, 3 recipients X-HELO: smtp.CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE (HELO smtp.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Jan 2018 09:59:18 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 4FFC972F; Fri, 12 Jan 2018 10:59:11 +0100 (CET) Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id mJcnzWBEShfo; Fri, 12 Jan 2018 10:59:07 +0100 (CET) Received: from manam.CeBiTec.Uni-Bielefeld.DE (p4FDDBA48.dip0.t-ipconnect.de [79.221.186.72]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPSA id CE99F72C; Fri, 12 Jan 2018 10:59:06 +0100 (CET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: fortran@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: Link with correct values-*.o files on Solaris (PR target/40411) Date: Fri, 12 Jan 2018 10:59:05 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes 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 # HG changeset patch # Parent 6c02c349f11cdd56ccf4666e36295538969b37d2 Link with correct values-xpg[46].o file on Solaris (PR target/40411) diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h --- a/gcc/config/sol2.h +++ b/gcc/config/sol2.h @@ -169,9 +169,34 @@ along with GCC; see the file COPYING3. #undef SUPPORTS_INIT_PRIORITY #define SUPPORTS_INIT_PRIORITY HAVE_INITFINI_ARRAY_SUPPORT +/* Solaris libc and libm implement multiple behaviours for various + interfaces that have changed over the years in different versions of the + C standard. The behaviour is controlled by linking corresponding + values-*.o objects. Each of these objects contain alternate definitions + of one or more variables that the libraries use to select which + conflicting behaviour they should exhibit. There are two sets of these + objects, values-X*.o and values-xpg*.o. + + The values-X[ac].o objects set the variable _lib_version. The Studio C + compilers use values-Xc.o with either -Xc or (since Studio 12.6) + -pedantic to select strictly conformant ISO C behaviour, otherwise + values-Xa.o. + + The values-xpg[46].o objects define either or both __xpg[46] variables, + selecting XPG4 mode (__xpg4) and conforming C99/SUSv3 behavior (__xpg6). + + Since GCC 5, gcc defaults to -std=gnu11 or higher, so we link + values-xpg6.o to get C99 semantics. Besides, most of the runtime + libraries always require C99 semantics. + + Since only one instance of _lib_version and __xpg[46] takes effekt (the + first in ld.so.1's search path), we only link the values-*.o files into + executable programs. */ #undef STARTFILE_ARCH_SPEC -#define STARTFILE_ARCH_SPEC "%{ansi:values-Xc.o%s} \ - %{!ansi:values-Xa.o%s}" +#define STARTFILE_ARCH_SPEC \ + "%{!shared:%{!symbolic: \ + %{pedantic:values-Xc.o%s; :values-Xa.o%s} \ + %{std=c90|std=gnu90:values-xpg4.o%s; :values-xpg6.o%s}}}" #if defined(HAVE_LD_PIE) && defined(HAVE_SOLARIS_CRTS) #define STARTFILE_CRTBEGIN_SPEC "%{static:crtbegin.o%s; \ diff --git a/gcc/testsuite/gfortran.dg/execute_command_line_2.f90 b/gcc/testsuite/gfortran.dg/execute_command_line_2.f90 --- a/gcc/testsuite/gfortran.dg/execute_command_line_2.f90 +++ b/gcc/testsuite/gfortran.dg/execute_command_line_2.f90 @@ -1,5 +1,4 @@ ! { dg-do run } -! { dg-xfail-run-if "PR libfortran/67412" { *-*-solaris2.10 } } ! ! Check that EXECUTE_COMMAND_LINE handles invalid command lines appropriately ! diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc --- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_arithmetic/char/hexfloat.cc @@ -1,6 +1,5 @@ // { dg-do run { target c++11 } } // { dg-require-string-conversions "" } -// { dg-xfail-run-if "PR libstdc++/64054" { *-*-solaris* } } // { dg-xfail-run-if "broken long double IO" { newlib_broken_long_double_io } } // 2014-03-27 RĂ¼diger Sonderfeld