Projects
home:lf14:branches:Mega:23.09
glibc
_service:tar_scm:backport-clang-0042-Use-check-...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:backport-clang-0042-Use-check-tests-with-trampolines-iff-compiler-supports-it.patch of Package glibc
From 3fc760aaca630876f44cdc6368f359c96f8de4ba Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella <adhemerval.zanella@linaro.org> Date: Fri, 25 Mar 2022 08:58:03 -0300 Subject: [PATCH] Use check tests with trampolines iff compiler supports it --- 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 7605653d58..289d1efdaa 100755 --- a/configure +++ b/configure @@ -7576,6 +7576,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 <<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=$? + 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 188aa8749f..b7ae62ce6f 100644 --- a/configure.ac +++ b/configure.ac @@ -1588,6 +1588,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 9176cbf1e3..a8d933ef43 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -523,7 +523,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 \ @@ -607,7 +607,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 \ @@ -962,7 +962,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) \ @@ -1011,7 +1011,7 @@ tests-pie += vismain tst-dlopen-self-pie tests-pie += tst-pie1 tst-pie2 tst-dlopen-tlsmodid-pie tst-dlopen-self-pie 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 @@ -1816,7 +1816,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 ffa5722e48..d0b1510e63 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 endif endif @@ -474,7 +474,6 @@ modules-names = \ tst-audit-threads-mod1 \ tst-audit-threads-mod2 \ tst-compat-forwarder-mod \ - tst-execstack-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-mod + # modules-names +endif extra-test-objs += \ $(addsuffix .os,$(strip $(modules-names))) \ tst-cleanup4aux.o \ -- 2.39.3
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2