diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2012-11-21 07:50:58 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2012-11-21 12:36:21 -0800 |
commit | 0fc844f8a771cddcad68c9e58b59e065db032cd3 (patch) | |
tree | 00f5c7f06f33f00fca83c0aeeff00be4951ed664 | |
parent | 163abe1837d2ff89be00b8a675e45d478f509df6 (diff) | |
download | glibc-0fc844f8a771cddcad68c9e58b59e065db032cd3.tar.gz glibc-0fc844f8a771cddcad68c9e58b59e065db032cd3.tar.xz glibc-0fc844f8a771cddcad68c9e58b59e065db032cd3.zip |
Check if -z global works
-rw-r--r-- | config.make.in | 1 | ||||
-rwxr-xr-x | configure | 29 | ||||
-rw-r--r-- | configure.in | 17 | ||||
-rw-r--r-- | elf/Makefile | 5 |
4 files changed, 51 insertions, 1 deletions
diff --git a/config.make.in b/config.make.in index 7f1bbb51d5..b282f1cef2 100644 --- a/config.make.in +++ b/config.make.in @@ -51,6 +51,7 @@ all-warnings = @all_warnings@ have-z-combreloc = @libc_cv_z_combreloc@ have-z-execstack = @libc_cv_z_execstack@ +have-z-global = @libc_cv_z_global@ have-Bgroup = @libc_cv_Bgroup@ with-fp = @with_fp@ old-glibc-headers = @old_glibc_headers@ diff --git a/configure b/configure index ff2d34ca9c..4b23722b56 100755 --- a/configure +++ b/configure @@ -613,6 +613,7 @@ fno_unit_at_a_time libc_cv_output_format libc_cv_hashstyle libc_cv_fpie +libc_cv_z_global libc_cv_z_execstack libc_cv_z_combreloc ASFLAGS_config @@ -6559,6 +6560,34 @@ 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 +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' + { { 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 + 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}: checking for -fpie" >&5 $as_echo_n "checking for -fpie... " >&6; } if ${libc_cv_fpie+:} false; then : diff --git a/configure.in b/configure.in index a7f7198818..2ec07b1e43 100644 --- a/configure.in +++ b/configure.in @@ -1561,6 +1561,23 @@ 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*]) +AC_SUBST(libc_cv_z_global) + AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no]) ]) diff --git a/elf/Makefile b/elf/Makefile index a70b836d57..fa7b6c3e6a 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -145,8 +145,11 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \ tst-audit1 tst-audit2 tst-audit8 \ tst-stackguard1 tst-addr1 tst-thrlock \ tst-unique1 tst-unique2 tst-unique3 tst-unique4 \ - tst-initorder tst-initorder2 tst-relsort1 reldep10 + tst-initorder tst-initorder2 tst-relsort1 # reldep9 +ifeq (yes,$(have-z-global)) +tests += reldep10 +endif test-srcs = tst-pathopt selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null) ifneq ($(selinux-enabled),1) |