From patchwork Thu Jan 5 09:20:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 89964 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp8877604qgi; Thu, 5 Jan 2017 01:21:27 -0800 (PST) X-Received: by 10.84.217.148 with SMTP id p20mr155178344pli.164.1483608087341; Thu, 05 Jan 2017 01:21:27 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 1si75420927pli.45.2017.01.05.01.21.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jan 2017 01:21:27 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-445433-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-445433-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-445433-patch=linaro.org@gcc.gnu.org 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=I54aRJ/YH97ZBIotLaeQ709AFG/O0a4iQI25mcHmfqSatdZWVY Ev/rs5Wu/cpipui4UcrQXIY56a6syQ1Xz1LC5a+IviIItkpxh9dT1sZRWV06WROY CYPWaNrvYXP8ln8s0hzmWJRgSQLPVhFbCLPH30ajb/sYOHCwdRQjL6lds= 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=VmQ6O8MEZpDJ20gbM2pX1YPMGn8=; b=iwN5UuH5yVZ0kAQKjgDC 91aPcfIGMb/Q3EFmXsszSTT+DsIT80i+0KOpiwkp49MCuKSMPl96sCXrdq7vVAuU 9gOaRM+3G7m4o1sSyctba9v9S2bhimnYMp3ptY7KUdagTPY//aJUiNKeSTByjEKv anYNoRSFYEKNadHUvOt3MiM= Received: (qmail 128958 invoked by alias); 5 Jan 2017 09:21:15 -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 128929 invoked by uid 89); 5 Jan 2017 09:21:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=rocebitecunibielefeldde, roCeBiTecUniBielefeldDE, ro@CeBiTec.Uni-Bielefeld.DE, ro@cebitec.uni-bielefeld.de X-Spam-User: qpsmtpd, 2 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; Thu, 05 Jan 2017 09:21:03 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id D76D4FB; Thu, 5 Jan 2017 10:21:00 +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 jYhRjPen1hoj; Thu, 5 Jan 2017 10:20:56 +0100 (CET) Received: from lokon.CeBiTec.Uni-Bielefeld.DE (lokon.CeBiTec.Uni-Bielefeld.DE [129.70.161.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 08CC7FA; Thu, 5 Jan 2017 10:20:56 +0100 (CET) Received: (from ro@localhost) by lokon.CeBiTec.Uni-Bielefeld.DE (8.15.2+Sun/8.15.2/Submit) id v059Kthc006735; Thu, 5 Jan 2017 10:20:55 +0100 (MET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Ian Lance Taylor , Paolo Bonzini Subject: [build, libgo, libstdc++] Build libgo with -Wa, -nH if possible (PR go/78978) Date: Thu, 05 Jan 2017 10:20:55 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes As could have been expected, the static libgo.a causes the same problem with hardware capabilities on Solaris/x86 as was solved for libgo.so with https://gcc.gnu.org/ml/gcc-patches/2016-12/msg00726.html Instead of trying to pass -mclear-hwcap with -static-libgo, it was deemed easier to solve both problems the same way and disable hwcaps support in the assembler in the first place. This has already been done in libstdc++, so I've moved the corresponding autoconf macro to config/hwcaps.m4 and adapted it to set HWCAP_CFLAGS instead of HWCAP_FLAGS to better differntiate from HWCAP_LDFLAGS. Everything else is straightforward, I believe. Bootstrapped without regressions on i386-pc-solaris2.1[02] with as/ld (where as supports -nH) and sparc-sun-solaris2.12 with as/ld (where as doesn't, or rather it's called -hwcap={1|0}), and the libgo runtime/pprof failure is gone. Ok for mainline? Once approved, how should we proceed with checking? Ian, will you take care of the libgo part once the rest is in? Thanks. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2017-01-04 Rainer Orth libgo: PR go/78978 * Makefile.am (AM_CFLAGS): Add HWCAP_CFLAGS. * configure.ac: Call GCC_CHECK_ASSEMBLER_HWCAP. * aclocal.m4: Regenerate. * configure: Regenerate. * Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. Revert: 2016-12-09 Rainer Orth * configure.ac: Call GCC_CHECK_LINKER_HWCAP. * Makefile.am (AM_LDFLAGS): Initialize to HWCAP_LDFLAGS. [USING_SPLIT_STACK]: Add to AM_LDFLAGS. * aclocal.m4: Regenerate. * configure: Regenerate. * Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. libstdc++-v3: PR go/78978 * acinclude.m4 (GLIBCXX_CHECK_ASSEMBLER_HWCAP): Remove. * configure.ac: Call GCC_CHECK_ASSEMBLER_HWCAP instead of GLIBCXX_CHECK_ASSEMBLER_HWCAP. * fragment.am (CONFIG_CXXFLAGS): Use HWCAP_CFLAGS instead of HWCAP_FLAGS. * aclocal.m4: Regenerate. * configure: Regenerate. * Makefile.in, doc/Makefile.in, include/Makefile.in, libsupc++/Makefile.in, po/Makefile.in, python/Makefile.in, src/Makefile.in, src/c++11/Makefile.in, src/c++98/Makefile.in, src/filesystem/Makefile.in, testsuite/Makefile.in: Regenerate. config: PR go/78978 * hwcaps.m4 (GCC_CHECK_ASSEMBLER_HWCAP): New macro. # HG changeset patch # Parent d2202c84f6ecdf3980dc94ba513be676b4015819 Build libgo with -Wa,-nH if possible (PR go/78978) diff --git a/config/hwcaps.m4 b/config/hwcaps.m4 --- a/config/hwcaps.m4 +++ b/config/hwcaps.m4 @@ -1,3 +1,35 @@ +dnl +dnl Check if the assembler used supports disabling generation of hardware +dnl capabilities. This is only supported by Solaris as at the moment. +dnl +dnl Defines: +dnl HWCAP_CFLAGS='-Wa,-nH' if possible. +dnl +AC_DEFUN([GCC_CHECK_ASSEMBLER_HWCAP], [ + test -z "$HWCAP_CFLAGS" && HWCAP_CFLAGS='' + + # Restrict the test to Solaris, other assemblers (e.g. AIX as) have -nH + # with a different meaning. + case ${target_os} in + solaris2*) + ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Wa,-nH" + + AC_MSG_CHECKING([for as that supports -Wa,-nH]) + AC_TRY_COMPILE([], [return 0;], [ac_hwcap_flags=yes],[ac_hwcap_flags=no]) + if test "$ac_hwcap_flags" = "yes"; then + HWCAP_CFLAGS="-Wa,-nH $HWCAP_CFLAGS" + fi + AC_MSG_RESULT($ac_hwcap_flags) + + CFLAGS="$ac_save_CFLAGS" + ;; + esac + + AC_SUBST(HWCAP_CFLAGS) +]) + + dnl dnl Check if the linker used supports linker maps to clear hardware dnl capabilities. This is only supported on Solaris at the moment. diff --git a/libgo/Makefile.am b/libgo/Makefile.am --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -42,14 +42,12 @@ ACLOCAL_AMFLAGS = -I ./config -I ../conf AM_CFLAGS = -fexceptions -fnon-call-exceptions -fplan9-extensions \ $(SPLIT_STACK) $(WARN_CFLAGS) \ - $(STRINGOPS_FLAG) $(OSCFLAGS) \ + $(STRINGOPS_FLAG) $(HWCAP_CFLAGS) $(OSCFLAGS) \ -I $(srcdir)/../libgcc -I $(srcdir)/../libbacktrace \ -I $(MULTIBUILDTOP)../../gcc/include -AM_LDFLAGS = $(HWCAP_LDFLAGS) - if USING_SPLIT_STACK -AM_LDFLAGS += -XCClinker $(SPLIT_STACK) +AM_LDFLAGS = -XCClinker $(SPLIT_STACK) endif # Multilib support. diff --git a/libgo/configure.ac b/libgo/configure.ac --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -421,9 +421,6 @@ case "$target" in esac AC_SUBST(OSCFLAGS) -dnl Check linker hardware capability support. -GCC_CHECK_LINKER_HWCAP - case "$target" in *86*-*-solaris2.1[[1-9]]*) # Link with -shared-libgcc on Solaris 11+/x86 as a workaround for @@ -433,6 +430,9 @@ case "$target" in esac AC_SUBST(OSLDFLAGS) +# Check if assembler supports disabling hardware capability support. +GCC_CHECK_ASSEMBLER_HWCAP + dnl Use -fsplit-stack when compiling C code if available. AC_CACHE_CHECK([whether -fsplit-stack is supported], [libgo_cv_c_split_stack_supported], diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -169,38 +169,6 @@ AC_DEFUN([GLIBCXX_CHECK_COMPILER_FEATURE dnl -dnl Check if the assembler used supports disabling generation of hardware -dnl capabilities. This is only supported by Sun as at the moment. -dnl -dnl Defines: -dnl HWCAP_FLAGS='-Wa,-nH' if possible. -dnl -AC_DEFUN([GLIBCXX_CHECK_ASSEMBLER_HWCAP], [ - test -z "$HWCAP_FLAGS" && HWCAP_FLAGS='' - - # Restrict the test to Solaris, other assemblers (e.g. AIX as) have -nH - # with a different meaning. - case ${target_os} in - solaris2*) - ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Wa,-nH" - - AC_MSG_CHECKING([for as that supports -Wa,-nH]) - AC_TRY_COMPILE([], [return 0;], [ac_hwcap_flags=yes],[ac_hwcap_flags=no]) - if test "$ac_hwcap_flags" = "yes"; then - HWCAP_FLAGS="-Wa,-nH $HWCAP_FLAGS" - fi - AC_MSG_RESULT($ac_hwcap_flags) - - CFLAGS="$ac_save_CFLAGS" - ;; - esac - - AC_SUBST(HWCAP_FLAGS) -]) - - -dnl dnl If GNU ld is in use, check to see if tricky linker opts can be used. If dnl the native linker is in use, all variables will be defined to something dnl safe (like an empty string). diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -400,7 +400,7 @@ AC_SUBST(LONG_DOUBLE_COMPAT_FLAGS) GLIBCXX_CONDITIONAL(GLIBCXX_LDBL_COMPAT, test $ac_ldbl_compat = yes) # Check if assembler supports disabling hardware capability support. -GLIBCXX_CHECK_ASSEMBLER_HWCAP +GCC_CHECK_ASSEMBLER_HWCAP # Check if assembler supports rdrand opcode. GLIBCXX_CHECK_X86_RDRAND diff --git a/libstdc++-v3/fragment.am b/libstdc++-v3/fragment.am --- a/libstdc++-v3/fragment.am +++ b/libstdc++-v3/fragment.am @@ -28,7 +28,7 @@ endif # These bits are all figured out from configure. Look in acinclude.m4 # or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS. CONFIG_CXXFLAGS = \ - $(SECTION_FLAGS) $(HWCAP_FLAGS) -frandom-seed=$@ + $(SECTION_FLAGS) $(HWCAP_CFLAGS) -frandom-seed=$@ WARN_CXXFLAGS = \ $(WARN_FLAGS) $(WERROR_FLAG) -fdiagnostics-show-location=once