From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id EF49C3858428; Fri, 28 Oct 2022 17:44:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF49C3858428 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666979072; bh=+GtuAniwNnmPtzISm3cHEr5/L2hPPWhktuxzGU943Vw=; h=From:To:Subject:Date:From; b=F1FJuJHxxoSFNrtJRYbU8fuGGuFGGBLKCbrKxaqJsE/WsHrOLNd8hVsiHCWjR6Kdg txndGTUugI7JmNMtXCP9kfew0F2DJHWVt55dAKpKxyE8msK4TespGB5p5NF2Tl/22d 5/EST+MuFNxRJ7FpWPA/2dqq3+lhNqSujtqlmfuY= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] Use check tests with trampolines iff compiler supports it X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: 92b07aa885131c0c5298afcda41ae8bde356a636 X-Git-Newrev: a519068663701bbcf59ccac9b1212c56a074bf92 Message-Id: <20221028174432.EF49C3858428@sourceware.org> Date: Fri, 28 Oct 2022 17:44:32 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a519068663701bbcf59ccac9b1212c56a074bf92 commit a519068663701bbcf59ccac9b1212c56a074bf92 Author: Adhemerval Zanella Date: Fri Mar 25 08:58:03 2022 -0300 Use check tests with trampolines iff compiler supports it Diff: --- configure | 32 ++++++++++++++++++++++++++++++++ configure.ac | 20 ++++++++++++++++++++ elf/Makefile | 10 +++++----- nptl/Makefile | 6 ++++-- 4 files changed, 61 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 8a71df6568..9b3f3ffa5d 100755 --- a/configure +++ b/configure @@ -6549,6 +6549,38 @@ if test $libc_cv_cc_loop_to_function = yes; then fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC has support for trampolines" >&5 +$as_echo_n "checking if $CC has support for trampolines... " >&6; } +if ${libc_cv_cc_trampoline+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.c <&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_cc_trampoline=yes +fi +rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_trampoline" >&5 +$as_echo "$libc_cv_cc_trampoline" >&6; } +config_vars="$config_vars +have-cc-trampoline = $libc_cv_cc_trampoline" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5 $as_echo_n "checking for libgd... " >&6; } if test "$with_gd" != "no"; then diff --git a/configure.ac b/configure.ac index d28ac6ed1e..fbc24f9119 100644 --- a/configure.ac +++ b/configure.ac @@ -1606,6 +1606,26 @@ if test $libc_cv_cc_loop_to_function = yes; then fi AC_SUBST(libc_cv_cc_loop_to_function) +AC_CACHE_CHECK(if $CC has support for trampolines, libc_cv_cc_trampoline, [dnl +cat > conftest.c < /dev/null) ifneq ($(selinux-enabled),1) -tests-execstack-yes = \ +tests-execstack-yesyes = \ tst-execstack \ tst-execstack-needed \ tst-execstack-prog \ @@ -625,7 +625,7 @@ $(objpfx)tst-valgrind-smoke.out: tst-valgrind-smoke.sh $(objpfx)ld.so $(objpfx)v $(SHELL) $< $(objpfx)ld.so $(rtlddir)/$(rtld-installed-name) '$(test-wrapper-env)' \ '$(run-program-env)' '$(rpath-link)' $(objpfx)valgrind-test > $@; $(evaluate-test) -tests += $(tests-execstack-$(have-z-execstack)) +tests += $(tests-execstack-$(have-z-execstack)$(have-cc-trampoline)) ifeq ($(run-built-tests),yes) tests-special += \ $(objpfx)noload-mem.out \ @@ -972,7 +972,7 @@ modules-names-cxx = \ modules-names += \ $(if $(CXX),$(modules-names-cxx)) \ - $(modules-execstack-$(have-z-execstack)) \ + $(modules-execstack-$(have-z-execstack)$(have-cc-trampoline)) \ $(tlsmod17a-modules) \ $(tlsmod18a-modules) \ $(tst-tls-many-dynamic-modules) \ @@ -1021,7 +1021,7 @@ tests-pie += vismain CFLAGS-vismain.c += $(PIE-ccflag) endif endif -modules-execstack-yes = tst-execstack-mod +modules-execstack-yesyes = tst-execstack-mod extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) # filtmod1.so, tst-big-note-lib.so, tst-ro-dynamic-mod.so have special @@ -1808,7 +1808,7 @@ $(objpfx)unload8.out: $(objpfx)unload8mod1.so $(objpfx)unload8mod1x.so $(objpfx)tst-tls9-static.out: $(objpfx)tst-tlsmod5.so $(objpfx)tst-tlsmod6.so -ifeq ($(have-z-execstack),yes) +ifeq ($(have-z-execstack)$(have-cc-trampoline),yesyes) $(objpfx)tst-execstack.out: $(objpfx)tst-execstack-mod.so CPPFLAGS-tst-execstack.c += -DUSE_PTHREADS=0 LDFLAGS-tst-execstack = -Wl,-z,noexecstack diff --git a/nptl/Makefile b/nptl/Makefile index 3d2ce8af8a..6f1ce4e394 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -386,7 +386,7 @@ tests += tst-cancelx7 tst-cancelx17 ifeq ($(build-shared),yes) tests += tst-compat-forwarder tst-audit-threads tests-internal += tst-tls3 tst-tls3-malloc tst-tls5 tst-stackguard1 -ifeq ($(have-z-execstack),yes) +ifeq ($(have-z-execstack)$(have-cc-trampoline),yesyes) tests += tst-execstack endif endif @@ -394,9 +394,11 @@ endif modules-names = tst-tls3mod \ tst-tls5mod tst-tls5moda tst-tls5modb tst-tls5modc \ tst-tls5modd tst-tls5mode tst-tls5modf tst-stack4mod \ - tst-execstack-mod \ tst-compat-forwarder-mod tst-audit-threads-mod1 \ tst-audit-threads-mod2 +ifeq ($(have-z-execstack)$(have-cc-trampoline),yesyes) +modules-names += tst-execstack-mod +endif extra-test-objs += $(addsuffix .os,$(strip $(modules-names))) \ tst-cleanup4aux.o tst-cleanupx4aux.o test-extras += tst-cleanup4aux tst-cleanupx4aux