Commit 9ce91011 by Rainer Orth Committed by Rainer Orth

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.

From-SVN: r183430
parent 191879f9
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> 2012-01-17 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR libitm/51173 PR libitm/51173
......
...@@ -21,7 +21,7 @@ AM_CFLAGS = $(XCFLAGS) ...@@ -21,7 +21,7 @@ AM_CFLAGS = $(XCFLAGS)
AM_CXXFLAGS = $(XCFLAGS) -std=gnu++0x -funwind-tables -fno-exceptions \ AM_CXXFLAGS = $(XCFLAGS) -std=gnu++0x -funwind-tables -fno-exceptions \
-fno-rtti $(abi_version) -fno-rtti $(abi_version)
AM_CCASFLAGS = $(XCFLAGS) AM_CCASFLAGS = $(XCFLAGS)
AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS) AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS) $(HWCAP_LDFLAGS)
toolexeclib_LTLIBRARIES = libitm.la toolexeclib_LTLIBRARIES = libitm.la
nodist_toolexeclib_HEADERS = libitm.spec nodist_toolexeclib_HEADERS = libitm.spec
......
...@@ -241,6 +241,7 @@ EGREP = @EGREP@ ...@@ -241,6 +241,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@ EXEEXT = @EXEEXT@
FGREP = @FGREP@ FGREP = @FGREP@
GREP = @GREP@ GREP = @GREP@
HWCAP_LDFLAGS = @HWCAP_LDFLAGS@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
...@@ -359,7 +360,7 @@ AM_CXXFLAGS = $(XCFLAGS) -std=gnu++0x -funwind-tables -fno-exceptions \ ...@@ -359,7 +360,7 @@ AM_CXXFLAGS = $(XCFLAGS) -std=gnu++0x -funwind-tables -fno-exceptions \
-fno-rtti $(abi_version) -fno-rtti $(abi_version)
AM_CCASFLAGS = $(XCFLAGS) AM_CCASFLAGS = $(XCFLAGS)
AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS) AM_LDFLAGS = $(XLDFLAGS) $(SECTION_LDFLAGS) $(OPT_LDFLAGS) $(HWCAP_LDFLAGS)
toolexeclib_LTLIBRARIES = libitm.la toolexeclib_LTLIBRARIES = libitm.la
nodist_toolexeclib_HEADERS = libitm.spec nodist_toolexeclib_HEADERS = libitm.spec
@LIBITM_BUILD_VERSIONED_SHLIB_FALSE@libitm_version_script = @LIBITM_BUILD_VERSIONED_SHLIB_FALSE@libitm_version_script =
......
...@@ -261,6 +261,36 @@ AC_DEFUN([LIBITM_CHECK_LINKER_FEATURES], [ ...@@ -261,6 +261,36 @@ AC_DEFUN([LIBITM_CHECK_LINKER_FEATURES], [
dnl 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 Add version tags to symbols in shared library (or not), additionally
dnl marking other symbols as private/local (or not). dnl marking other symbols as private/local (or not).
dnl dnl
......
# 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;
#};
...@@ -621,6 +621,9 @@ LIBITM_BUILD_VERSIONED_SHLIB_FALSE ...@@ -621,6 +621,9 @@ LIBITM_BUILD_VERSIONED_SHLIB_FALSE
LIBITM_BUILD_VERSIONED_SHLIB_TRUE LIBITM_BUILD_VERSIONED_SHLIB_TRUE
OPT_LDFLAGS OPT_LDFLAGS
SECTION_LDFLAGS SECTION_LDFLAGS
HAVE_HWCAP_FALSE
HAVE_HWCAP_TRUE
HWCAP_LDFLAGS
libtool_VERSION libtool_VERSION
MAINT MAINT
MAINTAINER_MODE_FALSE MAINTAINER_MODE_FALSE
...@@ -2225,6 +2228,51 @@ rm -f conftest.val ...@@ -2225,6 +2228,51 @@ rm -f conftest.val
return $ac_retval return $ac_retval
} # ac_fn_c_compute_int } # 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 cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
...@@ -11722,7 +11770,7 @@ else ...@@ -11722,7 +11770,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 11725 "configure" #line 11773 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -11828,7 +11876,7 @@ else ...@@ -11828,7 +11876,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 11831 "configure" #line 11879 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -16452,7 +16500,7 @@ $as_echo "#define HAVE_TLS 1" >>confdefs.h ...@@ -16452,7 +16500,7 @@ $as_echo "#define HAVE_TLS 1" >>confdefs.h
fi 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 "$as_me:${as_lineno-$LINENO}: checking whether the target supports hidden visibility" >&5
$as_echo_n "checking whether the target supports hidden visibility... " >&6; } $as_echo_n "checking whether the target supports hidden visibility... " >&6; }
...@@ -16559,6 +16607,8 @@ $as_echo "#define HAVE_ATTRIBUTE_ALIAS 1" >>confdefs.h ...@@ -16559,6 +16607,8 @@ $as_echo "#define HAVE_ATTRIBUTE_ALIAS 1" >>confdefs.h
fi fi
# Check linker hardware capability support.
# Check whether --with-gnu-ld was given. # Check whether --with-gnu-ld was given.
if test "${with_gnu_ld+set}" = set; then : if test "${with_gnu_ld+set}" = set; then :
...@@ -16669,6 +16719,59 @@ with_gnu_ld=$lt_cv_prog_gnu_ld ...@@ -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 # 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 # tests. Check for that first. We should have already tested for gld
# by now (in libtool), but require it now just to be safe... # by now (in libtool), but require it now just to be safe...
...@@ -16964,7 +17067,6 @@ fi ...@@ -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:${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;} $as_echo "$as_me: versioning on shared library symbols is $enable_symvers" >&6;}
if test $enable_symvers = gnu; then if test $enable_symvers = gnu; then
$as_echo "#define LIBITM_GNU_SYMBOL_VERSIONING 1" >>confdefs.h $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 ...@@ -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 Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi 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 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. as_fn_error "conditional \"LIBITM_BUILD_VERSIONED_SHLIB\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5 Usually this means the macro was only invoked conditionally." "$LINENO" 5
......
# Process this file with autoreconf to produce a configure script. # 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 # 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 # it under the terms of the GNU General Public License as published by
...@@ -208,12 +208,17 @@ GCC_LINUX_FUTEX(:) ...@@ -208,12 +208,17 @@ GCC_LINUX_FUTEX(:)
# See if we support thread-local storage. # See if we support thread-local storage.
GCC_CHECK_TLS 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_VISIBILITY
LIBITM_CHECK_ATTRIBUTE_DLLEXPORT LIBITM_CHECK_ATTRIBUTE_DLLEXPORT
LIBITM_CHECK_ATTRIBUTE_ALIAS 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 if test $enable_symvers = gnu; then
AC_DEFINE(LIBITM_GNU_SYMBOL_VERSIONING, 1, AC_DEFINE(LIBITM_GNU_SYMBOL_VERSIONING, 1,
[Define to 1 if GNU symbol versioning is used for libitm.]) [Define to 1 if GNU symbol versioning is used for libitm.])
......
...@@ -95,6 +95,7 @@ EGREP = @EGREP@ ...@@ -95,6 +95,7 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@ EXEEXT = @EXEEXT@
FGREP = @FGREP@ FGREP = @FGREP@
GREP = @GREP@ GREP = @GREP@
HWCAP_LDFLAGS = @HWCAP_LDFLAGS@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment