From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id F1E4A3858CD1; Tue, 2 Apr 2024 15:56:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F1E4A3858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1712073385; bh=3Ee2MJ3PQG7sYOZMNLmMGp54qtpouC+t0er497/G8AE=; h=From:To:Subject:Date:From; b=I638PLO6erenWRYMd6ATvnGbAswncGlfTDuPWqZF7GHvRJ+MzMGW5Q4oNkaSSPkiN gH5lUCpbfqbFWWjTDOmgX8lGZ3laliTZu8/2ki0LkGXWZWGWEwmeSVdmFogOjl3QVg pawjNXUbbZSwJo7ABr/Kd3xFsVayn6jhYE+Jukjs= 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: 464431cbad19955aa720a6fc34ca6108e32cdf2c X-Git-Newrev: 17539fa209560f8b1fb84ff2ebd90917b9444a19 Message-Id: <20240402155625.F1E4A3858CD1@sourceware.org> Date: Tue, 2 Apr 2024 15:56:25 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=17539fa209560f8b1fb84ff2ebd90917b9444a19 commit 17539fa209560f8b1fb84ff2ebd90917b9444a19 Author: Adhemerval Zanella Date: Fri Mar 25 08:58:03 2022 -0300 Use check tests with trampolines iff compiler supports it Diff: --- configure | 33 +++++++++++++++++++++++++++++++++ configure.ac | 20 ++++++++++++++++++++ elf/Makefile | 10 +++++----- nptl/Makefile | 8 ++++++-- 4 files changed, 64 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 252b4373c0..1ff91a6810 100755 --- a/configure +++ b/configure @@ -7454,6 +7454,39 @@ if test $libc_cv_cc_loop_to_function = yes; then fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC has support for trampolines" >&5 +printf %s "checking if $CC has support for trampolines... " >&6; } +if test ${libc_cv_cc_trampoline+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat > conftest.c <&5 + (eval $ac_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then + libc_cv_cc_trampoline=yes +fi +rm -f conftest* +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_trampoline" >&5 +printf "%s\n" "$libc_cv_cc_trampoline" >&6; } +config_vars="$config_vars +have-cc-trampoline = $libc_cv_cc_trampoline" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libgd" >&5 printf %s "checking for libgd... " >&6; } if test "$with_gd" != "no"; then diff --git a/configure.ac b/configure.ac index 2f90025a1a..99a0ea1bbb 100644 --- a/configure.ac +++ b/configure.ac @@ -1526,6 +1526,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 \ @@ -621,7 +621,7 @@ $(objpfx)tst-valgrind-smoke.out: tst-valgrind-smoke.sh $(objpfx)ld.so $(objpfx)v '$(run-program-env)' '$(rpath-link)' $(objpfx)valgrind-test \ '$(valgrind-suppressions-tst-valgrind-smoke)' > $@; $(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 \ @@ -985,7 +985,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) \ @@ -1034,7 +1034,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 @@ -1825,7 +1825,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 bf09603e7b..7f62dec2fa 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -465,7 +465,7 @@ tests-internal += \ tst-tls3-malloc \ tst-tls5 \ # tests-internal -ifeq ($(have-z-execstack),yes) +ifeq ($(have-z-execstack)$(have-cc-trampoline),yesyes) tests += tst-execstack-threads endif endif @@ -474,7 +474,6 @@ modules-names = \ tst-audit-threads-mod1 \ tst-audit-threads-mod2 \ tst-compat-forwarder-mod \ - tst-execstack-threads-mod \ tst-stack4mod \ tst-tls3mod \ tst-tls5mod \ @@ -485,6 +484,11 @@ modules-names = \ tst-tls5mode \ tst-tls5modf \ # modules-names +ifeq ($(have-z-execstack)$(have-cc-trampoline),yesyes) +modules-names += \ + tst-execstack-threads-mod \ + # modules-names +endif extra-test-objs += \ $(addsuffix .os,$(strip $(modules-names))) \ tst-cleanup4aux.o \