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 <r...@cebitec.uni-bielefeld.de> 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=''])