Only use visibility if supported

* configure.ac (libcilkrts_cv_have_attribute_visibility): Check
	for __attribute__((visibility)).
	* configure: Regenerate.
	* include/cilk/common.h (CILK_EXPORT, CILK_EXPORT_DATA): Only use
	__attribute__((visibility)) if HAVE_ATTRIBUTE_VISIBILITY.

From-SVN: r205254
This commit is contained in:
Rainer Orth 2013-11-22 11:44:56 +00:00 committed by Rainer Orth
parent 517854bc93
commit 954d457405
4 changed files with 50 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2013-11-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.ac (libcilkrts_cv_have_attribute_visibility): Check
for __attribute__((visibility)).
* configure: Regenerate.
* include/cilk/common.h (CILK_EXPORT, CILK_EXPORT_DATA): Only use
__attribute__((visibility)) if HAVE_ATTRIBUTE_VISIBILITY.
2013-11-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.ac (AC_PROG_CXX): Move after AC_PROG_CC.

31
libcilkrts/configure vendored
View File

@ -4874,6 +4874,33 @@ _ACEOF
fi
# Check whether the target supports protected visibility.
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
void __attribute__((visibility("protected"))) foo(void) { }
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
libcilkrts_cv_have_attribute_visibility=yes
else
libcilkrts_cv_have_attribute_visibility=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$save_CFLAGS"
if test $libcilkrts_cv_have_attribute_visibility = yes; then
$as_echo "#define HAVE_ATTRIBUTE_VISIBILITY 1" >>confdefs.h
fi
# Get target configury.
. ${srcdir}/configure.tgt
if test -n "$UNSUPPORTED"; then
@ -11060,7 +11087,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11063 "configure"
#line 11090 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11166,7 +11193,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11169 "configure"
#line 11196 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H

View File

@ -54,6 +54,18 @@ AC_CONFIG_FILES([Makefile])
AM_ENABLE_MULTILIB(, ..)
AC_FUNC_ALLOCA
# Check whether the target supports protected visibility.
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([void __attribute__((visibility("protected"))) foo(void) { }],
[], libcilkrts_cv_have_attribute_visibility=yes,
libcilkrts_cv_have_attribute_visibility=no)
CFLAGS="$save_CFLAGS"
if test $libcilkrts_cv_have_attribute_visibility = yes; then
AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
[Define to 1 if the target supports __attribute__((visibility(...))).])
fi
# Get target configury.
. ${srcdir}/configure.tgt
if test -n "$UNSUPPORTED"; then

View File

@ -101,7 +101,7 @@ namespace cilk {
# define CILK_EXPORT /* nothing */
# define CILK_EXPORT_DATA /* nothing */
#else /* Unix/gcc */
# ifdef IN_CILK_RUNTIME
# if defined(IN_CILK_RUNTIME) && defined(HAVE_ATTRIBUTE_VISIBILITY)
# define CILK_EXPORT __attribute__((visibility("protected")))
# define CILK_EXPORT_DATA __attribute__((visibility("protected")))
# else