diff options
author | ro <ro@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-01-23 13:03:25 +0000 |
---|---|---|
committer | ro <ro@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-01-23 13:03:25 +0000 |
commit | dffe2d192cf2ab307e74213d13797b9e95c09b6a (patch) | |
tree | 51a38715a0e7346a965322711a16d29cd887c919 | |
parent | b94ae734847346812da1f0ad2709fcdaf6d9ab3c (diff) | |
download | gcc-dffe2d192cf2ab307e74213d13797b9e95c09b6a.tar.gz |
Clear hardware capabilities on libitm.so with Sun ld
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183430 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libitm/ChangeLog | 11 | ||||
-rw-r--r-- | libitm/Makefile.am | 2 | ||||
-rw-r--r-- | libitm/Makefile.in | 3 | ||||
-rw-r--r-- | libitm/acinclude.m4 | 30 | ||||
-rw-r--r-- | libitm/clearcap.map | 14 | ||||
-rw-r--r-- | libitm/configure | 114 | ||||
-rw-r--r-- | libitm/configure.ac | 11 | ||||
-rw-r--r-- | libitm/testsuite/Makefile.in | 1 |
8 files changed, 177 insertions, 9 deletions
diff --git a/libitm/ChangeLog b/libitm/ChangeLog index c6874485823..2b5e1f404be 100644 --- a/libitm/ChangeLog +++ b/libitm/ChangeLog @@ -1,3 +1,14 @@ +2012-01-23 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. + 2012-01-17 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> PR libitm/51173 diff --git a/libitm/Makefile.am b/libitm/Makefile.am index b4ee5a84a19..f1c351c21d5 100644 --- a/libitm/Makefile.am +++ b/libitm/Makefile.am @@ -21,7 +21,7 @@ AM_CFLAGS = $(XCFLAGS) AM_CXXFLAGS = $(XCFLAGS) -std=gnu++0x -funwind-tables -fno-exceptions \ -fno-rtti $(abi_version) AM_CCASFLAGS = $(XCFLAGS) -AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS) +AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS) $(HWCAP_LDFLAGS) toolexeclib_LTLIBRARIES = libitm.la nodist_toolexeclib_HEADERS = libitm.spec diff --git a/libitm/Makefile.in b/libitm/Makefile.in index 20961095e37..22baeb8de85 100644 --- a/libitm/Makefile.in +++ b/libitm/Makefile.in @@ -241,6 +241,7 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HWCAP_LDFLAGS = @HWCAP_LDFLAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -359,7 +360,7 @@ AM_CXXFLAGS = $(XCFLAGS) -std=gnu++0x -funwind-tables -fno-exceptions \ -fno-rtti $(abi_version) AM_CCASFLAGS = $(XCFLAGS) -AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS) +AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS) $(HWCAP_LDFLAGS) toolexeclib_LTLIBRARIES = libitm.la nodist_toolexeclib_HEADERS = libitm.spec @LIBITM_BUILD_VERSIONED_SHLIB_FALSE@libitm_version_script = diff --git a/libitm/acinclude.m4 b/libitm/acinclude.m4 index 069738d8e80..1031f1f12c8 100644 --- a/libitm/acinclude.m4 +++ b/libitm/acinclude.m4 @@ -261,6 +261,36 @@ 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 by Sun ld at the moment. +dnl +dnl Defines: +dnl HWCAP_LDFLAGS='-Wl,-M,clearcap.map' 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 -Wl,-M,$srcdir/clearcap.map" + + AC_MSG_CHECKING([for ld that supports -Wl,-M,mapfile]) + AC_TRY_LINK([], [return 0;], [ac_hwcap_ldflags=yes],[ac_hwcap_ldflags=no]) + if test "$ac_hwcap_ldflags" = "yes"; then + HWCAP_LDFLAGS="-Wl,-M,$srcdir/clearcap.map $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/clearcap.map b/libitm/clearcap.map new file mode 100644 index 00000000000..bd8189b43ff --- /dev/null +++ b/libitm/clearcap.map @@ -0,0 +1,14 @@ +# Clear hardware capabilities emitted by Sun as: calls to the x86_avx.c +# functions are only emitted with -mavx. +# +# The v1 mapfile syntax has no support for clearing specific capabilities, +# so clear everything. +# +hwcap_1 = V0x0 OVERRIDE; +# +# If we can assume mapfile v2 syntax, we can specificially clear AVX. +# +#$mapfile_version 2 +#CAPABILITY { +# HW -= AVX; +#}; diff --git a/libitm/configure b/libitm/configure index 3abc7930e20..5fc8703cd9c 100644 --- a/libitm/configure +++ b/libitm/configure @@ -621,6 +621,9 @@ LIBITM_BUILD_VERSIONED_SHLIB_FALSE LIBITM_BUILD_VERSIONED_SHLIB_TRUE OPT_LDFLAGS SECTION_LDFLAGS +HAVE_HWCAP_FALSE +HAVE_HWCAP_TRUE +HWCAP_LDFLAGS libtool_VERSION MAINT MAINTAINER_MODE_FALSE @@ -2225,6 +2228,51 @@ rm -f conftest.val return $ac_retval } # ac_fn_c_compute_int + +# ac_fn_c_check_decl LINENO SYMBOL VAR +# ------------------------------------ +# Tests whether SYMBOL is declared, setting cache variable VAR accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -11722,7 +11770,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11725 "configure" +#line 11773 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11828,7 +11876,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11831 "configure" +#line 11879 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -16452,7 +16500,7 @@ $as_echo "#define HAVE_TLS 1" >>confdefs.h fi -# See what sort of export controls are availible. +# See what sort of export controls are available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports hidden visibility" >&5 $as_echo_n "checking whether the target supports hidden visibility... " >&6; } @@ -16559,6 +16607,8 @@ $as_echo "#define HAVE_ATTRIBUTE_ALIAS 1" >>confdefs.h fi +# Check linker hardware capability support. + # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : @@ -16669,6 +16719,59 @@ with_gnu_ld=$lt_cv_prog_gnu_ld + test -z "$HWCAP_LDFLAGS" && HWCAP_LDFLAGS='' + + + ac_save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LFLAGS -Wl,-M,$srcdir/clearcap.map" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld that supports -Wl,-M,mapfile" >&5 +$as_echo_n "checking for ld that supports -Wl,-M,mapfile... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_hwcap_ldflags=yes +else + ac_hwcap_ldflags=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$ac_hwcap_ldflags" = "yes"; then + HWCAP_LDFLAGS="-Wl,-M,$srcdir/clearcap.map $HWCAP_LDFLAGS" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_hwcap_ldflags" >&5 +$as_echo "$ac_hwcap_ldflags" >&6; } + + LDFLAGS="$ac_save_LDFLAGS" + + + + if test $ac_hwcap_ldflags != no; then + HAVE_HWCAP_TRUE= + HAVE_HWCAP_FALSE='#' +else + HAVE_HWCAP_TRUE='#' + HAVE_HWCAP_FALSE= +fi + + +# If defaulting to -mavx, don't clear hwcaps. +ac_fn_c_check_decl "$LINENO" "__AVX__" "ac_cv_have_decl___AVX__" "$ac_includes_default" +if test "x$ac_cv_have_decl___AVX__" = x""yes; then : + HWCAP_LDFLAGS='' +fi + + + # If we're not using GNU ld, then there's no point in even trying these # tests. Check for that first. We should have already tested for gld # by now (in libtool), but require it now just to be safe... @@ -16964,7 +17067,6 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: versioning on shared library symbols is $enable_symvers" >&5 $as_echo "$as_me: versioning on shared library symbols is $enable_symvers" >&6;} - if test $enable_symvers = gnu; then $as_echo "#define LIBITM_GNU_SYMBOL_VERSIONING 1" >>confdefs.h @@ -17540,6 +17642,10 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_HWCAP_TRUE}" && test -z "${HAVE_HWCAP_FALSE}"; then + as_fn_error "conditional \"HAVE_HWCAP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${LIBITM_BUILD_VERSIONED_SHLIB_TRUE}" && test -z "${LIBITM_BUILD_VERSIONED_SHLIB_FALSE}"; then as_fn_error "conditional \"LIBITM_BUILD_VERSIONED_SHLIB\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/libitm/configure.ac b/libitm/configure.ac index ab2a90b7cf9..7b54371fa88 100644 --- a/libitm/configure.ac +++ b/libitm/configure.ac @@ -1,5 +1,5 @@ # Process this file with autoreconf to produce a configure script. -# Copyright (C) 2011 Free Software Foundation, Inc. +# Copyright (C) 2011, 2012 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -208,12 +208,17 @@ GCC_LINUX_FUTEX(:) # See if we support thread-local storage. GCC_CHECK_TLS -# See what sort of export controls are availible. +# See what sort of export controls are available. LIBITM_CHECK_ATTRIBUTE_VISIBILITY LIBITM_CHECK_ATTRIBUTE_DLLEXPORT LIBITM_CHECK_ATTRIBUTE_ALIAS -LIBITM_ENABLE_SYMVERS +# Check linker hardware capability support. +LIBITM_CHECK_LINKER_HWCAP +# If defaulting to -mavx, don't clear hwcaps. +AC_CHECK_DECL([__AVX__], [HWCAP_LDFLAGS='']) + +LIBITM_ENABLE_SYMVERS if test $enable_symvers = gnu; then AC_DEFINE(LIBITM_GNU_SYMBOL_VERSIONING, 1, [Define to 1 if GNU symbol versioning is used for libitm.]) diff --git a/libitm/testsuite/Makefile.in b/libitm/testsuite/Makefile.in index 8066a2a0388..094e44de51a 100644 --- a/libitm/testsuite/Makefile.in +++ b/libitm/testsuite/Makefile.in @@ -95,6 +95,7 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HWCAP_LDFLAGS = @HWCAP_LDFLAGS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ |