[PATCH] Disable execstack tests for Clang

Sam James sam@gentoo.org
Fri Dec 20 03:22:05 GMT 2024


"H.J. Lu" <hjl.tools@gmail.com> writes:

> Since Clang doesn't support nested function which is required to test
> execstack, disable execstack tests for Clang.
>

LGTM. It could maybe be simplified with the -Wl,z,execstack bits but I'm
not going to worry about it for now.

> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> ---
>  elf/Makefile  |  6 ++++++
>  nptl/Makefile | 11 ++++++++++-
>  2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/elf/Makefile b/elf/Makefile
> index 9172d7306e..68fde4f226 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -557,12 +557,16 @@ endif
>  selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
>  
>  ifneq ($(selinux-enabled),1)
> +# NB: Clang doesn't support nested function which is needed to test
> +# execstack.
> +ifneq ($(have-test-clang),yes)
>  tests-execstack-yes = \
>    tst-execstack \
>    tst-execstack-needed \
>    tst-execstack-prog \
>    # tests-execstack-yes
>  endif
> +endif
>  ifeq ($(have-depaudit),yes)
>  tests += \
>    tst-audit14 \
> @@ -1146,7 +1150,9 @@ tests-pie += vismain
>  CFLAGS-vismain.c += $(PIE-ccflag)
>  endif
>  endif
> +ifneq ($(have-test-clang),yes)
>  modules-execstack-yes = tst-execstack-mod
> +endif
>  extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
>  
>  # filtmod1.so, tst-big-note-lib.so, tst-ro-dynamic-mod.so have special
> diff --git a/nptl/Makefile b/nptl/Makefile
> index 88077e27bb..ca112f684f 100644
> --- a/nptl/Makefile
> +++ b/nptl/Makefile
> @@ -475,15 +475,18 @@ tests-internal += \
>    tst-tls5 \
>    # tests-internal
>  ifeq ($(have-z-execstack),yes)
> +# NB: Clang doesn't support nested function which is needed to test
> +# execstack.
> +ifneq ($(have-test-clang),yes)
>  tests += tst-execstack-threads
>  endif
>  endif
> +endif
>  
>  modules-names = \
>    tst-audit-threads-mod1 \
>    tst-audit-threads-mod2 \
>    tst-compat-forwarder-mod \
> -  tst-execstack-threads-mod \
>    tst-stack4mod \
>    tst-tls3mod \
>    tst-tls5mod \
> @@ -504,6 +507,12 @@ test-extras += \
>    tst-cleanupx4aux \
>    # test-extras
>  
> +ifneq ($(have-test-clang),yes)
> +modules-names += \
> +  tst-execstack-threads-mod \
> +  # modules-names
> +endif
> +
>  # This test exercises compat symbols removed in glibc 2.34.
>  ifdef have-GLIBC_2.33
>  tests += tst-cleanup4


More information about the Libc-alpha mailing list