Properly check linker -z XXX support
This commit is contained in:
parent
ad35f2dd75
commit
6bfea97493
|
@ -1,5 +1,11 @@
|
||||||
2012-11-21 H.J. Lu <hongjiu.lu@intel.com>
|
2012-11-21 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
[BZ #14865]
|
||||||
|
* aclocal.m4 (LIBC_LINKER_FEATURE): New macro.
|
||||||
|
* configure.in: Use LIBC_LINKER_FEATURE to check -z nodelete,
|
||||||
|
-z nodlopen, -z initfirst and -z execstack support.
|
||||||
|
* configure: Regenerated.
|
||||||
|
|
||||||
* elf/elf.h (DF_1_NODIRECT): New macro.
|
* elf/elf.h (DF_1_NODIRECT): New macro.
|
||||||
(DF_1_IGNMULDEF): Likewise.
|
(DF_1_IGNMULDEF): Likewise.
|
||||||
(DF_1_NOKSYMS): Likewise.
|
(DF_1_NOKSYMS): Likewise.
|
||||||
|
|
2
NEWS
2
NEWS
|
@ -21,7 +21,7 @@ Version 2.17
|
||||||
14638, 14645, 14648, 14652, 14660, 14661, 14669, 14672, 14683, 14694,
|
14638, 14645, 14648, 14652, 14660, 14661, 14669, 14672, 14683, 14694,
|
||||||
14716, 14719, 14743, 14767, 14783, 14784, 14785, 14793, 14796, 14797,
|
14716, 14719, 14743, 14767, 14783, 14784, 14785, 14793, 14796, 14797,
|
||||||
14801, 14805, 14807, 14809, 14811, 14815, 14821, 14824, 14828, 14831,
|
14801, 14805, 14807, 14809, 14811, 14815, 14821, 14824, 14828, 14831,
|
||||||
14835, 14838, 14856, 14866.
|
14835, 14838, 14856, 14865, 14866.
|
||||||
|
|
||||||
* Port to ARM AArch64 contributed by Linaro.
|
* Port to ARM AArch64 contributed by Linaro.
|
||||||
|
|
||||||
|
|
|
@ -213,3 +213,31 @@ AC_DEFUN([ACX_BUGURL],[
|
||||||
AC_SUBST(REPORT_BUGS_TO)
|
AC_SUBST(REPORT_BUGS_TO)
|
||||||
AC_SUBST(REPORT_BUGS_TEXI)
|
AC_SUBST(REPORT_BUGS_TEXI)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl Check linker option support.
|
||||||
|
dnl LIBC_LINKER_FEATURE([ld_option], [cc_option], [action-if-true], [action-if-false])
|
||||||
|
AC_DEFUN([LIBC_LINKER_FEATURE],
|
||||||
|
[AC_MSG_CHECKING([for linker that supports $1])
|
||||||
|
libc_linker_feature=no
|
||||||
|
if test x"$gnu_ld" = x"yes"; then
|
||||||
|
libc_linker_check=`$LD -v --help 2>/dev/null | grep "\$1"`
|
||||||
|
if test -n "$libc_linker_check"; then
|
||||||
|
cat > conftest.c <<EOF
|
||||||
|
int _start (void) { return 42; }
|
||||||
|
EOF
|
||||||
|
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
|
||||||
|
$2 -nostdlib -nostartfiles
|
||||||
|
-fPIC -shared -o conftest.so conftest.c
|
||||||
|
1>&AS_MESSAGE_LOG_FD])
|
||||||
|
then
|
||||||
|
libc_linker_feature=yes
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test $libc_linker_feature = yes; then
|
||||||
|
$3
|
||||||
|
else
|
||||||
|
$4
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT($libc_linker_feature)])
|
||||||
|
|
|
@ -6235,86 +6235,101 @@ if test $libc_cv_cc_with_libunwind = yes; then
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -z nodelete option" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z nodelete" >&5
|
||||||
$as_echo_n "checking for -z nodelete option... " >&6; }
|
$as_echo_n "checking for linker that supports -z nodelete... " >&6; }
|
||||||
if ${libc_cv_z_nodelete+:} false; then :
|
libc_linker_feature=no
|
||||||
$as_echo_n "(cached) " >&6
|
if test x"$gnu_ld" = x"yes"; then
|
||||||
else
|
libc_linker_check=`$LD -v --help 2>/dev/null | grep "\-z nodelete"`
|
||||||
cat > conftest.c <<EOF
|
if test -n "$libc_linker_check"; then
|
||||||
|
cat > conftest.c <<EOF
|
||||||
int _start (void) { return 42; }
|
int _start (void) { return 42; }
|
||||||
EOF
|
EOF
|
||||||
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
|
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
|
||||||
-fPIC -shared -o conftest.so conftest.c
|
-Wl,--enable-new-dtags,-z,nodelete -nostdlib -nostartfiles
|
||||||
-nostartfiles -nostdlib
|
-fPIC -shared -o conftest.so conftest.c
|
||||||
-Wl,--enable-new-dtags,-z,nodelete 1>&5'
|
1>&5'
|
||||||
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||||
(eval $ac_try) 2>&5
|
(eval $ac_try) 2>&5
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
test $ac_status = 0; }; }
|
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_nodelete=yes
|
libc_cv_z_nodelete=yes
|
||||||
else
|
else
|
||||||
as_fn_error $? "linker with -z nodelete support required" "$LINENO" 5
|
as_fn_error $? "linker with -z nodelete support required" "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
rm -f conftest*
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_linker_feature" >&5
|
||||||
fi
|
$as_echo "$libc_linker_feature" >&6; }
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_z_nodelete" >&5
|
|
||||||
$as_echo "$libc_cv_z_nodelete" >&6; }
|
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -z nodlopen option" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z nodlopen" >&5
|
||||||
$as_echo_n "checking for -z nodlopen option... " >&6; }
|
$as_echo_n "checking for linker that supports -z nodlopen... " >&6; }
|
||||||
if ${libc_cv_z_nodlopen+:} false; then :
|
libc_linker_feature=no
|
||||||
$as_echo_n "(cached) " >&6
|
if test x"$gnu_ld" = x"yes"; then
|
||||||
else
|
libc_linker_check=`$LD -v --help 2>/dev/null | grep "\-z nodlopen"`
|
||||||
cat > conftest.c <<EOF
|
if test -n "$libc_linker_check"; then
|
||||||
|
cat > conftest.c <<EOF
|
||||||
int _start (void) { return 42; }
|
int _start (void) { return 42; }
|
||||||
EOF
|
EOF
|
||||||
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
|
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
|
||||||
-fPIC -shared -o conftest.so conftest.c
|
-Wl,--enable-new-dtags,-z,nodlopen -nostdlib -nostartfiles
|
||||||
-nostartfiles -nostdlib
|
-fPIC -shared -o conftest.so conftest.c
|
||||||
-Wl,--enable-new-dtags,-z,nodlopen 1>&5'
|
1>&5'
|
||||||
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||||
(eval $ac_try) 2>&5
|
(eval $ac_try) 2>&5
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
test $ac_status = 0; }; }
|
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_nodlopen=yes
|
libc_cv_z_nodlopen=yes
|
||||||
else
|
else
|
||||||
as_fn_error $? "linker with -z nodlopen support required" "$LINENO" 5
|
as_fn_error $? "linker with -z nodlopen support required" "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
rm -f conftest*
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_linker_feature" >&5
|
||||||
fi
|
$as_echo "$libc_linker_feature" >&6; }
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_z_nodlopen" >&5
|
|
||||||
$as_echo "$libc_cv_z_nodlopen" >&6; }
|
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -z initfirst option" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z initfirst" >&5
|
||||||
$as_echo_n "checking for -z initfirst option... " >&6; }
|
$as_echo_n "checking for linker that supports -z initfirst... " >&6; }
|
||||||
if ${libc_cv_z_initfirst+:} false; then :
|
libc_linker_feature=no
|
||||||
$as_echo_n "(cached) " >&6
|
if test x"$gnu_ld" = x"yes"; then
|
||||||
else
|
libc_linker_check=`$LD -v --help 2>/dev/null | grep "\-z initfirst"`
|
||||||
cat > conftest.c <<EOF
|
if test -n "$libc_linker_check"; then
|
||||||
|
cat > conftest.c <<EOF
|
||||||
int _start (void) { return 42; }
|
int _start (void) { return 42; }
|
||||||
EOF
|
EOF
|
||||||
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
|
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
|
||||||
-fPIC -shared -o conftest.so conftest.c
|
-Wl,--enable-new-dtags,-z,initfirst -nostdlib -nostartfiles
|
||||||
-nostartfiles -nostdlib
|
-fPIC -shared -o conftest.so conftest.c
|
||||||
-Wl,--enable-new-dtags,-z,initfirst 1>&5'
|
1>&5'
|
||||||
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||||
(eval $ac_try) 2>&5
|
(eval $ac_try) 2>&5
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
test $ac_status = 0; }; }
|
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_initfirst=yes
|
libc_cv_z_initfirst=yes
|
||||||
else
|
else
|
||||||
as_fn_error $? "linker with -z initfirst support required" "$LINENO" 5
|
as_fn_error $? "linker with -z initfirst support required" "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
rm -f conftest*
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_linker_feature" >&5
|
||||||
fi
|
$as_echo "$libc_linker_feature" >&6; }
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_z_initfirst" >&5
|
|
||||||
$as_echo "$libc_cv_z_initfirst" >&6; }
|
|
||||||
|
|
||||||
# Add-on fragments can set these for other machines.
|
# Add-on fragments can set these for other machines.
|
||||||
libc_commonpagesize=${libc_commonpagesize:-no}
|
libc_commonpagesize=${libc_commonpagesize:-no}
|
||||||
|
@ -6511,32 +6526,37 @@ if test "$libc_cv_z_combreloc" = yes; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -z execstack" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z execstack" >&5
|
||||||
$as_echo_n "checking for -z execstack... " >&6; }
|
$as_echo_n "checking for linker that supports -z execstack... " >&6; }
|
||||||
if ${libc_cv_z_execstack+:} false; then :
|
libc_linker_feature=no
|
||||||
$as_echo_n "(cached) " >&6
|
if test x"$gnu_ld" = x"yes"; then
|
||||||
else
|
libc_linker_check=`$LD -v --help 2>/dev/null | grep "\-z execstack"`
|
||||||
cat > conftest.c <<EOF
|
if test -n "$libc_linker_check"; then
|
||||||
|
cat > conftest.c <<EOF
|
||||||
int _start (void) { return 42; }
|
int _start (void) { return 42; }
|
||||||
EOF
|
EOF
|
||||||
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
|
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
|
||||||
-fPIC -shared -o conftest.so conftest.c
|
-Wl,-z,execstack -nostdlib -nostartfiles
|
||||||
-Wl,-z,execstack -nostdlib
|
-fPIC -shared -o conftest.so conftest.c
|
||||||
1>&5'
|
1>&5'
|
||||||
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||||
(eval $ac_try) 2>&5
|
(eval $ac_try) 2>&5
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
test $ac_status = 0; }; }
|
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_execstack=yes
|
libc_cv_z_execstack=yes
|
||||||
else
|
else
|
||||||
libc_cv_z_execstack=no
|
libc_cv_z_execstack=no
|
||||||
fi
|
fi
|
||||||
rm -f conftest*
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_linker_feature" >&5
|
||||||
fi
|
$as_echo "$libc_linker_feature" >&6; }
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_z_execstack" >&5
|
|
||||||
$as_echo "$libc_cv_z_execstack" >&6; }
|
|
||||||
|
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fpie" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fpie" >&5
|
||||||
|
|
71
configure.in
71
configure.in
|
@ -1409,53 +1409,17 @@ if test $libc_cv_cc_with_libunwind = yes; then
|
||||||
AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
|
AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CACHE_CHECK(for -z nodelete option,
|
LIBC_LINKER_FEATURE([-z nodelete], [-Wl,--enable-new-dtags,-z,nodelete],
|
||||||
libc_cv_z_nodelete, [dnl
|
[libc_cv_z_nodelete=yes],
|
||||||
cat > conftest.c <<EOF
|
[AC_MSG_ERROR(linker with -z nodelete support required)])
|
||||||
int _start (void) { return 42; }
|
|
||||||
EOF
|
|
||||||
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
|
|
||||||
-fPIC -shared -o conftest.so conftest.c
|
|
||||||
-nostartfiles -nostdlib
|
|
||||||
-Wl,--enable-new-dtags,-z,nodelete 1>&AS_MESSAGE_LOG_FD])
|
|
||||||
then
|
|
||||||
libc_cv_z_nodelete=yes
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR(linker with -z nodelete support required)
|
|
||||||
fi
|
|
||||||
rm -f conftest*])
|
|
||||||
|
|
||||||
AC_CACHE_CHECK(for -z nodlopen option,
|
LIBC_LINKER_FEATURE([-z nodlopen], [-Wl,--enable-new-dtags,-z,nodlopen],
|
||||||
libc_cv_z_nodlopen, [dnl
|
[libc_cv_z_nodlopen=yes],
|
||||||
cat > conftest.c <<EOF
|
[AC_MSG_ERROR(linker with -z nodlopen support required)])
|
||||||
int _start (void) { return 42; }
|
|
||||||
EOF
|
|
||||||
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
|
|
||||||
-fPIC -shared -o conftest.so conftest.c
|
|
||||||
-nostartfiles -nostdlib
|
|
||||||
-Wl,--enable-new-dtags,-z,nodlopen 1>&AS_MESSAGE_LOG_FD])
|
|
||||||
then
|
|
||||||
libc_cv_z_nodlopen=yes
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR(linker with -z nodlopen support required)
|
|
||||||
fi
|
|
||||||
rm -f conftest*])
|
|
||||||
|
|
||||||
AC_CACHE_CHECK(for -z initfirst option,
|
LIBC_LINKER_FEATURE([-z initfirst], [-Wl,--enable-new-dtags,-z,initfirst],
|
||||||
libc_cv_z_initfirst, [dnl
|
[libc_cv_z_initfirst=yes],
|
||||||
cat > conftest.c <<EOF
|
[AC_MSG_ERROR(linker with -z initfirst support required)])
|
||||||
int _start (void) { return 42; }
|
|
||||||
EOF
|
|
||||||
if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
|
|
||||||
-fPIC -shared -o conftest.so conftest.c
|
|
||||||
-nostartfiles -nostdlib
|
|
||||||
-Wl,--enable-new-dtags,-z,initfirst 1>&AS_MESSAGE_LOG_FD])
|
|
||||||
then
|
|
||||||
libc_cv_z_initfirst=yes
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR(linker with -z initfirst support required)
|
|
||||||
fi
|
|
||||||
rm -f conftest*])
|
|
||||||
|
|
||||||
# Add-on fragments can set these for other machines.
|
# Add-on fragments can set these for other machines.
|
||||||
libc_commonpagesize=${libc_commonpagesize:-no}
|
libc_commonpagesize=${libc_commonpagesize:-no}
|
||||||
|
@ -1593,21 +1557,8 @@ if test "$libc_cv_z_combreloc" = yes; then
|
||||||
fi
|
fi
|
||||||
AC_SUBST(libc_cv_z_combreloc)
|
AC_SUBST(libc_cv_z_combreloc)
|
||||||
|
|
||||||
AC_CACHE_CHECK(for -z execstack,
|
LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
|
||||||
libc_cv_z_execstack, [dnl
|
[libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
|
||||||
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,execstack -nostdlib
|
|
||||||
1>&AS_MESSAGE_LOG_FD])
|
|
||||||
then
|
|
||||||
libc_cv_z_execstack=yes
|
|
||||||
else
|
|
||||||
libc_cv_z_execstack=no
|
|
||||||
fi
|
|
||||||
rm -f conftest*])
|
|
||||||
AC_SUBST(libc_cv_z_execstack)
|
AC_SUBST(libc_cv_z_execstack)
|
||||||
|
|
||||||
AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
|
AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
|
||||||
|
|
Loading…
Reference in New Issue