From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id AE02938344DB; Thu, 9 Jun 2022 13:19:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE02938344DB 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: 7b3a9e6e02e4e3f6432eb22815f6be1c7e789644 X-Git-Newrev: 418ec1178fa235a5db7aa4528e8b54fe4805f480 Message-Id: <20220609131938.AE02938344DB@sourceware.org> Date: Thu, 9 Jun 2022 13:19:38 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jun 2022 13:19:38 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=418ec1178fa235a5db7aa4528e8b54fe4805f480 commit 418ec1178fa235a5db7aa4528e8b54fe4805f480 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 c8ec3471d4..709a572377 100755 --- a/configure +++ b/configure @@ -6595,6 +6595,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 996d674399..8c9c70fca3 100644 --- a/configure.ac +++ b/configure.ac @@ -1589,6 +1589,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 \ @@ -626,7 +626,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 \ @@ -968,7 +968,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) \ @@ -1032,7 +1032,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 @@ -1818,7 +1818,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 b585663974..dbbe0ae737 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -387,7 +387,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 @@ -395,9 +395,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