[libitm, build] Clear hardware capabilities on libitm.so with Sun ld

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Mon Jan 16 16:36:00 GMT 2012

Richard Henderson <rth@redhat.com> writes:

> On 11/21/2011 09:23 AM, Rainer Orth wrote:
>> Richard Henderson <rth@redhat.com> writes:
>>> This is only ok if the compiler and library are build with default options.
>>> If you use --with-arch=corei7-avx then we may well use AVX insns all through
>>> the library, not just in the one interface that will only be used if the 
>>> user of the library is using avx.
>>> Can you auto-foo this based on CC+CFLAGS?  E.g.  compile-time tests for the
>>> various __SSE__ / __AVX__ macros?
>> Probably, but it occured to me that it might be easier to just apply the
>> mapfile to x86_avx.o unconditionally before linking libitm.la.
> Possibly.  Though you'd want to do the same thing for x86_sse.o too.
> Again, that file is only used if the main program uses SSE.

The ld -r route for x86_avx.o has failed completely due to several
libtool bugs, so I'm back to your suggestion.  I didn't check for
__SSE__, though: Solaris 10 is the first release where both as and ld
have hwcap support, and it requires SSE-capable hardware to run.

The following patch has been bootstrapped without regressions on
i386-pc-solaris2.11 with as/ld, gas/ld, and gas/gld and fixes the
hwcap-related execution failures in the first case.  Besides, I've
configured libitm with CFLAGS='-g -O2 -mavx' and verified that
LDFLAGS_HWCAP is cleared/not applied in this case.

I've kept the LIBITM_CHECK_LINKER_HWCAP test and the __AVX__ check
separate since the former is generic (with the exception of the mapfile
name), while the latter is strictly libitm-specific.

Ok for mainline?


2011-11-18  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* clearcap.map: New file.
	* acinclude.m4 (LIBITM_CHECK_LINKER_HWCAP): New test.
	* configure.ac: Call it.
	Clear HWCAP_LDFLAGS if defaulting to -mavx.
	* Makefile.am (AM_LDFLAGS): Add $(HWCAP_LDFLAGS)
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: solx86-libitm-hwcap.patch
Type: text/x-patch
Size: 3412 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120116/d7ca250f/attachment.bin>
-------------- next part --------------

Rainer Orth, Center for Biotechnology, Bielefeld University

More information about the Gcc-patches mailing list