From patchwork Mon Dec 5 13:32:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 86567 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1477731qgi; Mon, 5 Dec 2016 05:33:24 -0800 (PST) X-Received: by 10.98.7.83 with SMTP id b80mr57338070pfd.79.1480944804153; Mon, 05 Dec 2016 05:33:24 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id h1si14716121plh.10.2016.12.05.05.33.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Dec 2016 05:33:24 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-443473-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-443473-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-443473-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=yvIC7qedw/nifwRyOcIyEsXavEk5MTBHgJH3aI9VvK81RcxaWd nDW0dShLI0RABr3sHDqTI+R4SNp5N/EcWkF+fiOENwTigY8s0VoM1EMMkNJWHf/J lV1tywotBAdeTr2+YyLRaddYLb+y1NJo6hG6Eif+izM6gmQQ4L/VhAFeM= 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=RoxMPTPvXM8ozrH7OFNW7CqKfwg=; b=Xw0PHq8hM1jx961Zvv0j hVqDnq41J14MK9wvkpO5asthvhhEfZPz2RgBznvSh5KmsFgoEmUL6sloskDAFnr+ mcYSivzsS13G9GlSmRLrPNKL1BAwpg9bNrgaOUBWaomSBg6nIk1leLDTqRi+37V3 icDbaWeTAWmsR32wIv7qxvQ= Received: (qmail 119591 invoked by alias); 5 Dec 2016 13:33:10 -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 118371 invoked by uid 89); 5 Dec 2016 13:33:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=UD:alloc_comp_1.f90, marking, UD:la, generalizes 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; Mon, 05 Dec 2016 13:32:58 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id ACD87AE1; Mon, 5 Dec 2016 14:32:56 +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 AoCTW8roTIll; Mon, 5 Dec 2016 14:32:52 +0100 (CET) Received: from fuego.CeBiTec.Uni-Bielefeld.DE (p5DCE36F5.dip0.t-ipconnect.de [93.206.54.245]) (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 9DF81ADF; Mon, 5 Dec 2016 14:32:52 +0100 (CET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: fortran@gcc.gnu.org, Paolo Bonzini Subject: [build] Disable hwcaps on libgfortran Date: Mon, 05 Dec 2016 14:32:51 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes The AVX-specific matmul patch for libgfortran broke Solaris/x86 testing with /bin/as pretty badly: every single execution test involving libgfortran.so now FAILs like ld.so.1: alloc_comp_1.exe: fatal: /var/gcc/regression/trunk/10-gcc/build/i386-pc-solaris2.10/./libgfortran/.libs/libgfortran.so.4: hardware capability (CA_SUNW_HW_2) unsupported: 0x40 [ AVX2 ] FAIL: gfortran.dg/coarray/alloc_comp_1.f90 -fcoarray=single -O2 -latomic execution test This happens because libgfortran.so now requires AVX and AVX2 support from the executing system: ro@zebrano 14 > elfdump -H libgfortran.so Capabilities Section: .SUNW_cap Object Capabilities: index tag value [0] CA_SUNW_HW_2 0x40 [ AVX2 ] [1] CA_SUNW_HW_1 0x20001800 [ AVX SSE2 SSE ] Since the relevant code is guarded by runtime test, this needs to be disabled. Fortunately, a similar problem has already been solved in libitm and this patch just generalizes the solution: * The autoconf macro checking for the -mclear-hwcaps compiler option (only available on Solaris at this time) is moved to a new config/hwcaps.m4, appropriately renamed. * It's invoked in libgfortran.ac and the result added to the libgfortran.la LDFLAGS. The patch below implements that. It has been bootstrapped successfully on i386-pc-solaris2.10 with both as/ld (where -mclear-hwcaps is present and needed to avoid all those failures) and gas/gld (where -mclear-hwcaps is present, but a no-op), and x86_64-pc-linux-gnu (where the flag doesn't exist). Testresults are back to normal for the first configuration and unchanged for the other two. Ok for mainline? Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2016-12-04 Rainer Orth libgfortran: * configure.ac: Call GCC_CHECK_LINKER_HWCAP. * Makefile.am (libgfortran_la_LDFLAGS): Add HWCAP_LDFLAGS. * aclocal.m4: Regenerate. * configure: Regenerate. * Makefile.in: Regenerate. config: * hwcaps.m4: New file. libitm: * acinclude.m4 (LIBITM_CHECK_LINKER_FEATURES): Remove. * aclocal.m4: Regenerate. * configure.ac: Call GCC_CHECK_LINKER_HWCAP instead of LIBITM_CHECK_LINKER_HWCAP. # HG changeset patch # Parent 652ae1c5b6c997f22956287c4158ac9bef51f7d3 Disable hwcaps on libgfortran diff --git a/config/hwcaps.m4 b/config/hwcaps.m4 new file mode 100644 --- /dev/null +++ b/config/hwcaps.m4 @@ -0,0 +1,28 @@ +dnl +dnl Check if the linker used supports linker maps to clear hardware +dnl capabilities. This is only supported on Solaris at the moment. +dnl +dnl Defines: +dnl HWCAP_LDFLAGS=-mclear-hwcap if possible +dnl LD (as a side effect of testing) +dnl +AC_DEFUN([GCC_CHECK_LINKER_HWCAP], [ + test -z "$HWCAP_LDFLAGS" && HWCAP_LDFLAGS='' + AC_REQUIRE([AC_PROG_LD]) + + ac_save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LFLAGS -mclear-hwcap" + + AC_MSG_CHECKING([for -mclear-hwcap]) + AC_TRY_LINK([], [return 0;], [ac_hwcap_ldflags=yes],[ac_hwcap_ldflags=no]) + if test "$ac_hwcap_ldflags" = "yes"; then + HWCAP_LDFLAGS="-mclear-hwcap $HWCAP_LDFLAGS" + fi + AC_MSG_RESULT($ac_hwcap_ldflags) + + LDFLAGS="$ac_save_LDFLAGS" + + AC_SUBST(HWCAP_LDFLAGS) + + AM_CONDITIONAL(HAVE_HWCAP, test $ac_hwcap_ldflags != no) +]) diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am --- a/libgfortran/Makefile.am +++ b/libgfortran/Makefile.am @@ -38,6 +38,7 @@ toolexeclib_DATA = libgfortran.spec libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS) libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ $(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \ + $(HWCAP_LDFLAGS) \ -lm $(extra_ldflags_libgfortran) \ $(version_arg) -Wc,-shared-libgcc libgfortran_la_DEPENDENCIES = $(version_dep) libgfortran.spec $(LIBQUADLIB_DEP) diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac --- a/libgfortran/configure.ac +++ b/libgfortran/configure.ac @@ -222,6 +222,9 @@ fi AC_MSG_RESULT($ac_fdsections) AC_SUBST(SECTION_FLAGS) +# Check linker hardware capability support. +GCC_CHECK_LINKER_HWCAP + # Find other programs we need. AC_CHECK_TOOL(AS, as) AC_CHECK_TOOL(AR, ar) diff --git a/libitm/acinclude.m4 b/libitm/acinclude.m4 --- a/libitm/acinclude.m4 +++ b/libitm/acinclude.m4 @@ -300,36 +300,6 @@ AC_DEFUN([LIBITM_CHECK_LINKER_FEATURES], dnl -dnl Check if the linker used supports linker maps to clear hardware -dnl capabilities. This is only supported on Solaris at the moment. -dnl -dnl Defines: -dnl HWCAP_LDFLAGS=-mclear-hwcap if possible -dnl LD (as a side effect of testing) -dnl -AC_DEFUN([LIBITM_CHECK_LINKER_HWCAP], [ - test -z "$HWCAP_LDFLAGS" && HWCAP_LDFLAGS='' - AC_REQUIRE([AC_PROG_LD]) - - ac_save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LFLAGS -mclear-hwcap" - - AC_MSG_CHECKING([for -mclear-hwcap]) - AC_TRY_LINK([], [return 0;], [ac_hwcap_ldflags=yes],[ac_hwcap_ldflags=no]) - if test "$ac_hwcap_ldflags" = "yes"; then - HWCAP_LDFLAGS="-mclear-hwcap $HWCAP_LDFLAGS" - fi - AC_MSG_RESULT($ac_hwcap_ldflags) - - LDFLAGS="$ac_save_LDFLAGS" - - AC_SUBST(HWCAP_LDFLAGS) - - AM_CONDITIONAL(HAVE_HWCAP, test $ac_hwcap_ldflags != no) -]) - - -dnl dnl Add version tags to symbols in shared library (or not), additionally dnl marking other symbols as private/local (or not). dnl diff --git a/libitm/configure.ac b/libitm/configure.ac --- a/libitm/configure.ac +++ b/libitm/configure.ac @@ -215,7 +215,7 @@ LIBITM_CHECK_ATTRIBUTE_DLLEXPORT LIBITM_CHECK_ATTRIBUTE_ALIAS # Check linker hardware capability support. -LIBITM_CHECK_LINKER_HWCAP +GCC_CHECK_LINKER_HWCAP # If defaulting to -mavx, don't clear hwcaps. AC_CHECK_DECL([__AVX__], [HWCAP_LDFLAGS=''])