Use LIBC_LINKER_FEATURE to check -z global support

This commit is contained in:
H.J. Lu 2012-11-21 12:39:21 -08:00
parent 0fc844f8a7
commit c35d2a3a36
2 changed files with 22 additions and 30 deletions

35
configure vendored
View File

@ -6560,32 +6560,37 @@ fi
$as_echo "$libc_linker_feature" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -z global" >&5
$as_echo_n "checking for -z global... " >&6; }
if ${libc_cv_z_global+:} false; then :
$as_echo_n "(cached) " >&6
else
cat > conftest.c <<EOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z global" >&5
$as_echo_n "checking for linker that supports -z global... " >&6; }
libc_linker_feature=no
if test x"$gnu_ld" = x"yes"; then
libc_linker_check=`$LD -v --help 2>/dev/null | grep "\-z global"`
if test -n "$libc_linker_check"; then
cat > conftest.c <<EOF
int _start (void) { return 42; }
EOF
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
-fPIC -shared -o conftest.so conftest.c
-Wl,-z,global -nostdlib
1>&5'
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
-Wl,-z,global -nostdlib -nostartfiles
-fPIC -shared -o conftest.so conftest.c
1>&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }
then
then
libc_linker_feature=yes
fi
rm -f conftest*
fi
fi
if test $libc_linker_feature = yes; then
libc_cv_z_global=yes
else
libc_cv_z_global=no
fi
rm -f conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_z_global" >&5
$as_echo "$libc_cv_z_global" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_linker_feature" >&5
$as_echo "$libc_linker_feature" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fpie" >&5

View File

@ -1561,21 +1561,8 @@ LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
[libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
AC_SUBST(libc_cv_z_execstack)
AC_CACHE_CHECK(for -z global,
libc_cv_z_global, [dnl
cat > conftest.c <<EOF
int _start (void) { return 42; }
EOF
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
-fPIC -shared -o conftest.so conftest.c
-Wl,-z,global -nostdlib
1>&AS_MESSAGE_LOG_FD])
then
libc_cv_z_global=yes
else
libc_cv_z_global=no
fi
rm -f conftest*])
LIBC_LINKER_FEATURE([-z global], [-Wl,-z,global],
[libc_cv_z_global=yes], [libc_cv_z_global=no])
AC_SUBST(libc_cv_z_global)
AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl