public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] Use check tests with trampolines iff compiler supports it Date: Mon, 4 Apr 2022 12:57:15 +0000 (GMT) [thread overview] Message-ID: <20220404125715.D8552385840C@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b7ec2e4111920bbf5bf9f6e5e1f760df65b41d3c commit b7ec2e4111920bbf5bf9f6e5e1f760df65b41d3c Author: Adhemerval Zanella <adhemerval.zanella@linaro.org> 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 2b17c9cabd..2f60e8dc66 100755 --- a/configure +++ b/configure @@ -6750,6 +6750,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 <<EOF +void bar (void (*callback) (void)); +int foo (void) +{ + int var = 0; + void callback (void) { var = 1; } + bar (callback); + return var; +} +EOF +libc_cv_cc_trampoline=no +if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -Werror -c conftest.c' + { { 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_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 62e44967c1..966e12af76 100644 --- a/configure.ac +++ b/configure.ac @@ -1721,6 +1721,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 <<EOF +void bar (void (*callback) (void)); +int foo (void) +{ + int var = 0; + void callback (void) { var = 1; } + bar (callback); + return var; +} +EOF +libc_cv_cc_trampoline=no +if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Werror -c conftest.c]) +then + libc_cv_cc_trampoline=yes +fi +rm -f conftest*]) +LIBC_CONFIG_VAR([have-cc-trampoline], + [$libc_cv_cc_trampoline]) + dnl Check whether we have the gd library available. AC_MSG_CHECKING(for libgd) if test "$with_gd" != "no"; then diff --git a/elf/Makefile b/elf/Makefile index c96924e9c2..320d4c778a 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -519,7 +519,7 @@ endif selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null) ifneq ($(selinux-enabled),1) -tests-execstack-yes = \ +tests-execstack-yesyes = \ tst-execstack \ tst-execstack-needed \ tst-execstack-prog \ @@ -550,7 +550,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 \ @@ -880,7 +880,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) \ @@ -944,7 +944,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 @@ -1701,7 +1701,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
next reply other threads:[~2022-04-04 12:57 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-04 12:57 Adhemerval Zanella [this message] -- strict thread matches above, loose matches on Subject: below -- 2024-04-17 20:10 Adhemerval Zanella 2024-04-02 15:56 Adhemerval Zanella 2024-02-09 17:34 Adhemerval Zanella 2024-02-07 14:10 Adhemerval Zanella 2024-01-29 18:00 Adhemerval Zanella 2023-12-21 18:56 Adhemerval Zanella 2023-09-28 17:55 Adhemerval Zanella 2023-08-30 12:39 Adhemerval Zanella 2023-02-09 19:51 Adhemerval Zanella 2022-10-28 17:44 Adhemerval Zanella 2022-10-04 13:02 Adhemerval Zanella 2022-06-09 21:23 Adhemerval Zanella 2022-06-09 13:19 Adhemerval Zanella 2022-06-03 14:08 Adhemerval Zanella 2022-05-13 14:22 Adhemerval Zanella 2022-05-12 19:36 Adhemerval Zanella 2022-05-10 18:27 Adhemerval Zanella 2022-04-29 14:06 Adhemerval Zanella 2022-03-31 19:09 Adhemerval Zanella 2022-03-29 20:32 Adhemerval Zanella
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220404125715.D8552385840C@sourceware.org \ --to=azanella@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).