mirror of git://sourceware.org/git/glibc.git
Pass -Wl,--no-error-execstack for tests where -Wl,-z,execstack is used [PR32717]
When GNU Binutils is configured with --enable-error-execstack=yes, a handful of our tests which rely on -Wl,-z,execstack fail. Pass --Wl,--no-error-execstack to override the behaviour and get a warning instead. Bug: https://sourceware.org/PR32717 Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
4cf2d86936
commit
a2bd5008a9
|
@ -53,6 +53,7 @@ c++-bits-std_abs-h = @CXX_BITS_STD_ABS_H@
|
||||||
enable-werror = @enable_werror@
|
enable-werror = @enable_werror@
|
||||||
|
|
||||||
have-z-execstack = @libc_cv_z_execstack@
|
have-z-execstack = @libc_cv_z_execstack@
|
||||||
|
have-no-error-execstack = @libc_cv_no_error_execstack@
|
||||||
have-protected-data = @libc_cv_protected_data@
|
have-protected-data = @libc_cv_protected_data@
|
||||||
have-insert = @libc_cv_insert@
|
have-insert = @libc_cv_insert@
|
||||||
have-glob-dat-reloc = @libc_cv_has_glob_dat@
|
have-glob-dat-reloc = @libc_cv_has_glob_dat@
|
||||||
|
|
|
@ -659,6 +659,7 @@ libc_cv_has_glob_dat
|
||||||
libc_cv_fpie
|
libc_cv_fpie
|
||||||
libc_cv_test_static_pie
|
libc_cv_test_static_pie
|
||||||
libc_cv_z_execstack
|
libc_cv_z_execstack
|
||||||
|
libc_cv_no_error_execstack
|
||||||
ASFLAGS_config
|
ASFLAGS_config
|
||||||
libc_cv_cc_with_libunwind
|
libc_cv_cc_with_libunwind
|
||||||
libc_cv_insert
|
libc_cv_insert
|
||||||
|
@ -7114,6 +7115,40 @@ if test $libc_cv_as_noexecstack = yes; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker that supports --no-error-execstack" >&5
|
||||||
|
printf %s "checking for linker that supports --no-error-execstack... " >&6; }
|
||||||
|
libc_linker_feature=no
|
||||||
|
cat > conftest.c <<EOF
|
||||||
|
int _start (void) { return 42; }
|
||||||
|
EOF
|
||||||
|
if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
|
||||||
|
-Wl,-no-error-execstack -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=$?
|
||||||
|
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||||
|
test $ac_status = 0; }; }
|
||||||
|
then
|
||||||
|
if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -Wl,-no-error-execstack -nostdlib \
|
||||||
|
-nostartfiles -fPIC -shared -o conftest.so conftest.c 2>&1 \
|
||||||
|
| grep "warning: --no-error-execstack ignored" > /dev/null 2>&1; then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
libc_linker_feature=yes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
if test $libc_linker_feature = yes; then
|
||||||
|
libc_cv_no_error_execstack=yes
|
||||||
|
else
|
||||||
|
libc_cv_no_error_execstack=no
|
||||||
|
fi
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_linker_feature" >&5
|
||||||
|
printf "%s\n" "$libc_linker_feature" >&6; }
|
||||||
|
|
||||||
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z execstack" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z execstack" >&5
|
||||||
printf %s "checking for linker that supports -z execstack... " >&6; }
|
printf %s "checking for linker that supports -z execstack... " >&6; }
|
||||||
libc_linker_feature=no
|
libc_linker_feature=no
|
||||||
|
|
|
@ -1318,6 +1318,10 @@ if test $libc_cv_as_noexecstack = yes; then
|
||||||
fi
|
fi
|
||||||
AC_SUBST(ASFLAGS_config)
|
AC_SUBST(ASFLAGS_config)
|
||||||
|
|
||||||
|
LIBC_LINKER_FEATURE([--no-error-execstack], [-Wl,-no-error-execstack],
|
||||||
|
[libc_cv_no_error_execstack=yes], [libc_cv_no_error_execstack=no])
|
||||||
|
AC_SUBST(libc_cv_no_error_execstack)
|
||||||
|
|
||||||
LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
|
LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
|
||||||
[libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
|
[libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
|
||||||
AC_SUBST(libc_cv_z_execstack)
|
AC_SUBST(libc_cv_z_execstack)
|
||||||
|
|
|
@ -1990,6 +1990,9 @@ $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so
|
||||||
CPPFLAGS-tst-execstack.c += -DUSE_PTHREADS=0
|
CPPFLAGS-tst-execstack.c += -DUSE_PTHREADS=0
|
||||||
LDFLAGS-tst-execstack = -Wl,-z,noexecstack
|
LDFLAGS-tst-execstack = -Wl,-z,noexecstack
|
||||||
LDFLAGS-tst-execstack-mod.so = -Wl,-z,execstack
|
LDFLAGS-tst-execstack-mod.so = -Wl,-z,execstack
|
||||||
|
ifeq ($(have-no-error-execstack),yes)
|
||||||
|
LDFLAGS-tst-execstack-mod.so += -Wl,--no-error-execstack
|
||||||
|
endif
|
||||||
|
|
||||||
$(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
|
$(objpfx)tst-execstack-needed: $(objpfx)tst-execstack-mod.so
|
||||||
LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
|
LDFLAGS-tst-execstack-needed = -Wl,-z,noexecstack
|
||||||
|
@ -1999,6 +2002,9 @@ CFLAGS-tst-execstack-prog.c += -Wno-trampolines
|
||||||
CFLAGS-tst-execstack-mod.c += -Wno-trampolines
|
CFLAGS-tst-execstack-mod.c += -Wno-trampolines
|
||||||
|
|
||||||
LDFLAGS-tst-execstack-prog-static = -Wl,-z,execstack
|
LDFLAGS-tst-execstack-prog-static = -Wl,-z,execstack
|
||||||
|
ifeq ($(have-no-error-execstack),yes)
|
||||||
|
LDFLAGS-tst-execstack-prog-static += -Wl,--no-error-execstack
|
||||||
|
endif
|
||||||
CFLAGS-tst-execstack-prog-static.c += -Wno-trampolines
|
CFLAGS-tst-execstack-prog-static.c += -Wno-trampolines
|
||||||
|
|
||||||
ifeq (yes,$(build-hardcoded-path-in-tests))
|
ifeq (yes,$(build-hardcoded-path-in-tests))
|
||||||
|
|
|
@ -702,6 +702,9 @@ $(objpfx)tst-execstack-threads.out: $(objpfx)tst-execstack-threads-mod.so
|
||||||
LDFLAGS-tst-execstack-threads = -Wl,-z,noexecstack
|
LDFLAGS-tst-execstack-threads = -Wl,-z,noexecstack
|
||||||
LDFLAGS-tst-execstack-threads-mod.so = -Wl,-z,execstack
|
LDFLAGS-tst-execstack-threads-mod.so = -Wl,-z,execstack
|
||||||
CFLAGS-tst-execstack-threads-mod.c += -Wno-trampolines
|
CFLAGS-tst-execstack-threads-mod.c += -Wno-trampolines
|
||||||
|
ifeq ($(have-no-error-execstack),yes)
|
||||||
|
LDFLAGS-tst-execstack-threads-mod.so += -Wl,--no-error-execstack
|
||||||
|
endif
|
||||||
|
|
||||||
tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
|
tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
|
||||||
tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
|
tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"
|
||||||
|
|
Loading…
Reference in New Issue