[build] Disable hwcaps on libgfortran

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Mon Dec 5 13:33:00 GMT 2016


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  <ro@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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sol2-libgfortran-hwcaps.patch
Type: text/x-patch
Size: 3475 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161205/f5817c57/attachment.bin>


More information about the Gcc-patches mailing list