[PATCH] Rename have-mtls-descriptor to have-test-mtls-descriptor

Sam James sam@gentoo.org
Fri Jan 3 13:08:05 GMT 2025


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

> Since have-mtls-descriptor is only used for glibc testing, rename it to
> have-test-mtls-descriptor.  Also enable tst-gnu2-tls2-amx only if
> $(have-test-mtls-descriptor) == gnu2.
>
> Tested with GCC 14 and Clang 19/18/17 on x86-64.

Reviewed-by: Sam James <sam@gentoo.org>

>
> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> ---
>  Makefile.in                             |  2 --
>  configure                               | 42 +++++--------------------
>  configure.ac                            | 10 +++---
>  elf/Makefile                            | 34 ++++++++++----------
>  sysdeps/arm/Makefile                    |  8 ++---
>  sysdeps/unix/sysv/linux/x86_64/Makefile |  2 +-
>  6 files changed, 33 insertions(+), 65 deletions(-)
>
> diff --git a/Makefile.in b/Makefile.in
> index 0aab15ce4d..8b02cc3b03 100644
> --- a/Makefile.in
> +++ b/Makefile.in
> @@ -8,7 +8,6 @@ test-config-cflags-signaling-nans = @libc_cv_test_cc_signaling_nans@
>  test-config-cflags-wno-ignored-attributes = @libc_cv_test_wno_ignored_attributes@
>  test-enable-cet = @test_enable_cet@
>  test-have-mamx-tile = @libc_cv_test_x86_have_amx_tile@
> -test-have-mtls-descriptor = @libc_cv_test_mtls_descriptor@
>  test-have-static-pie = @libc_cv_test_static_pie@
>  test-supported-fortify = @libc_cv_test_supported_fortify_source@
>  
> @@ -29,7 +28,6 @@ check xcheck test:
>  		config-cflags-wno-ignored-attributes="$(test-config-cflags-wno-ignored-attributes)" \
>  		enable-cet="$(test-enable-cet)" \
>  		have-mamx-tile="$(test-have-mamx-tile)" \
> -		have-mtls-descriptor="$(test-have-mtls-descriptor)" \
>  		have-static-pie="$(test-have-static-pie)" \
>  		supported-fortify="$(test-supported-fortify)" \
>  		objdir=`pwd` $@
> diff --git a/configure b/configure
> index 3637b0a8da..1edf445f0a 100755
> --- a/configure
> +++ b/configure
> @@ -655,7 +655,6 @@ libc_cv_test_cc_signaling_nans
>  libc_cv_cc_submachine
>  libc_cv_cc_nofma
>  libc_cv_test_wno_ignored_attributes
> -libc_cv_test_mtls_descriptor
>  libc_cv_has_glob_dat
>  libc_cv_fpie
>  libc_cv_test_static_pie
> @@ -7423,31 +7422,6 @@ void foo (void)
>  cat > conftest.c <<EOF
>  $conftest_code
>  EOF
> -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tls descriptor support" >&5
> -printf %s "checking for tls descriptor support... " >&6; }
> -if test ${libc_cv_mtls_descriptor+y}
> -then :
> -  printf %s "(cached) " >&6
> -else case e in #(
> -  e)   if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=$mtls_descriptor -nostdlib -nostartfiles -shared conftest.c -o conftest 1>&5'
> -  { { 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_mtls_descriptor=$mtls_descriptor
> -  else
> -    libc_cv_mtls_descriptor=no
> -  fi
> - ;;
> -esac
> -fi
> -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mtls_descriptor" >&5
> -printf "%s\n" "$libc_cv_mtls_descriptor" >&6; }
> -if test "$TEST_CC" = "$CC"; then
> -  libc_cv_test_mtls_descriptor=$libc_cv_mtls_descriptor
> -else
>  
>  saved_CC="$CC"
>  CC="$TEST_CC"
> @@ -7457,17 +7431,17 @@ if test ${libc_cv_test_mtls_descriptor+y}
>  then :
>    printf %s "(cached) " >&6
>  else case e in #(
> -  e)       if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=$mtls_descriptor -nostdlib -nostartfiles -shared conftest.c -o conftest 1>&5'
> +  e)     if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=$mtls_descriptor -nostdlib -nostartfiles -shared conftest.c -o conftest 1>&5'
>    { { 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_test_mtls_descriptor=$mtls_descriptor
> -      else
> -	libc_cv_test_mtls_descriptor=no
> -      fi ;;
> +    then
> +      libc_cv_test_mtls_descriptor=$mtls_descriptor
> +    else
> +      libc_cv_test_mtls_descriptor=no
> +    fi ;;
>  esac
>  fi
>  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_test_mtls_descriptor" >&5
> @@ -7475,11 +7449,9 @@ printf "%s\n" "$libc_cv_test_mtls_descriptor" >&6; }
>  
>  CC="$saved_CC"
>  
> -fi
>  rm -f conftest*
>  config_vars="$config_vars
> -have-mtls-descriptor = $libc_cv_mtls_descriptor"
> -
> +have-test-mtls-descriptor = $libc_cv_test_mtls_descriptor"
>  
>  conftest_code="
>  void __foo (void)
> diff --git a/configure.ac b/configure.ac
> index 0088c2473e..f3b93b8d0e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1387,17 +1387,15 @@ void foo (void)
>    i = 10;
>  }
>  "
> -LIBC_TRY_CC_AND_TEST_CC_COMMAND([for tls descriptor support],
> +dnl Check if TEST_CC support tls descriptor.
> +LIBC_TRY_TEST_CC_COMMAND([for tls descriptor support],
>    [$conftest_code],
>    [-fPIC -mtls-dialect=$mtls_descriptor -nostdlib -nostartfiles -shared],
> -  libc_cv_mtls_descriptor,
> -  [libc_cv_mtls_descriptor=$mtls_descriptor],
> -  [libc_cv_mtls_descriptor=no],
>    libc_cv_test_mtls_descriptor,
>    [libc_cv_test_mtls_descriptor=$mtls_descriptor],
>    [libc_cv_test_mtls_descriptor=no])
> -LIBC_CONFIG_VAR([have-mtls-descriptor], [$libc_cv_mtls_descriptor])
> -AC_SUBST(libc_cv_test_mtls_descriptor)
> +LIBC_CONFIG_VAR([have-test-mtls-descriptor],
> +		[$libc_cv_test_mtls_descriptor])
>  
>  dnl clang emits an warning for a double alias redirection, to warn the
>  dnl original symbol is sed even when weak definition overrides it.
> diff --git a/elf/Makefile b/elf/Makefile
> index 597bb6cf4b..e3db643a30 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -1106,13 +1106,13 @@ modules-names-tests = $(filter-out ifuncmod% tst-tlsmod% \
>  # For +depfiles in Makerules.
>  extra-test-objs += tst-auditmod17.os
>  
> -ifneq (no,$(have-mtls-descriptor))
> +ifneq (no,$(have-test-mtls-descriptor))
>  tests += tst-gnu2-tls1
>  modules-names += tst-gnu2-tls1mod
>  $(objpfx)tst-gnu2-tls1: $(objpfx)tst-gnu2-tls1mod.so
>  tst-gnu2-tls1mod.so-no-z-defs = yes
> -CFLAGS-tst-gnu2-tls1mod.c += -mtls-dialect=$(have-mtls-descriptor)
> -endif # $(have-mtls-descriptor)
> +CFLAGS-tst-gnu2-tls1mod.c += -mtls-dialect=$(have-test-mtls-descriptor)
> +endif # $(have-test-mtls-descriptor)
>  
>  ifeq (yes,$(have-protected-data))
>  modules-names += tst-protected1moda tst-protected1modb
> @@ -3174,11 +3174,11 @@ $(objpfx)tst-tls-allocation-failure-static-patched.out: \
>  $(objpfx)tst-audit-tlsdesc: $(objpfx)tst-audit-tlsdesc-mod1.so \
>  			    $(objpfx)tst-audit-tlsdesc-mod2.so \
>  			    $(shared-thread-library)
> -ifneq (no,$(have-mtls-descriptor))
> +ifneq (no,$(have-test-mtls-descriptor))
>  # The test is valid for all TLS types, but we want to exercise GNU2
>  # TLS if possible.
> -CFLAGS-tst-audit-tlsdesc-mod1.c += -mtls-dialect=$(have-mtls-descriptor)
> -CFLAGS-tst-audit-tlsdesc-mod2.c += -mtls-dialect=$(have-mtls-descriptor)
> +CFLAGS-tst-audit-tlsdesc-mod1.c += -mtls-dialect=$(have-test-mtls-descriptor)
> +CFLAGS-tst-audit-tlsdesc-mod2.c += -mtls-dialect=$(have-test-mtls-descriptor)
>  endif
>  $(objpfx)tst-audit-tlsdesc-dlopen: $(shared-thread-library)
>  $(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-audit-tlsdesc-mod1.so \
> @@ -3257,13 +3257,13 @@ $(objpfx)tst-gnu2-tls2.out: \
>    $(objpfx)tst-gnu2-tls2mod1.so \
>    $(objpfx)tst-gnu2-tls2mod2.so
>  
> -ifneq (no,$(have-mtls-descriptor))
> -CFLAGS-tst-tlsgap-mod0.c += -mtls-dialect=$(have-mtls-descriptor)
> -CFLAGS-tst-tlsgap-mod1.c += -mtls-dialect=$(have-mtls-descriptor)
> -CFLAGS-tst-tlsgap-mod2.c += -mtls-dialect=$(have-mtls-descriptor)
> -CFLAGS-tst-gnu2-tls2mod0.c += -mtls-dialect=$(have-mtls-descriptor)
> -CFLAGS-tst-gnu2-tls2mod1.c += -mtls-dialect=$(have-mtls-descriptor)
> -CFLAGS-tst-gnu2-tls2mod2.c += -mtls-dialect=$(have-mtls-descriptor)
> +ifneq (no,$(have-test-mtls-descriptor))
> +CFLAGS-tst-tlsgap-mod0.c += -mtls-dialect=$(have-test-mtls-descriptor)
> +CFLAGS-tst-tlsgap-mod1.c += -mtls-dialect=$(have-test-mtls-descriptor)
> +CFLAGS-tst-tlsgap-mod2.c += -mtls-dialect=$(have-test-mtls-descriptor)
> +CFLAGS-tst-gnu2-tls2mod0.c += -mtls-dialect=$(have-test-mtls-descriptor)
> +CFLAGS-tst-gnu2-tls2mod1.c += -mtls-dialect=$(have-test-mtls-descriptor)
> +CFLAGS-tst-gnu2-tls2mod2.c += -mtls-dialect=$(have-test-mtls-descriptor)
>  endif
>  
>  $(objpfx)tst-recursive-tls: $(objpfx)tst-recursive-tlsmallocmod.so
> @@ -3342,10 +3342,10 @@ $(objpfx)tst-tls22-mod1-gnu2.so: $(objpfx)tst-tls22-mod1-gnu2.os \
>    $(objpfx)tst-tls22-mod1-vars.os $(objpfx)tst-tls22-mod2-gnu2.so
>  $(objpfx)tst-tls22-mod2-gnu2.so: $(objpfx)tst-tls22-mod2-gnu2.os \
>    $(objpfx)tst-tls22-mod2-vars.os
> -ifneq (no,$(have-mtls-descriptor))
> -CFLAGS-tst-tls22-gnu2.c += -mtls-dialect=$(have-mtls-descriptor)
> -CFLAGS-tst-tls22-mod1-gnu2.c += -mtls-dialect=$(have-mtls-descriptor)
> -CFLAGS-tst-tls22-mod2-gnu2.c += -mtls-dialect=$(have-mtls-descriptor)
> +ifneq (no,$(have-test-mtls-descriptor))
> +CFLAGS-tst-tls22-gnu2.c += -mtls-dialect=$(have-test-mtls-descriptor)
> +CFLAGS-tst-tls22-mod1-gnu2.c += -mtls-dialect=$(have-test-mtls-descriptor)
> +CFLAGS-tst-tls22-mod2-gnu2.c += -mtls-dialect=$(have-test-mtls-descriptor)
>  endif
>  # These reference symbols from the main executable.
>  tst-tls22-mod1.so-no-z-defs = yes
> diff --git a/sysdeps/arm/Makefile b/sysdeps/arm/Makefile
> index 619474eca9..9c4fd6b236 100644
> --- a/sysdeps/arm/Makefile
> +++ b/sysdeps/arm/Makefile
> @@ -13,15 +13,15 @@ $(objpfx)libgcc-stubs.a: $(objpfx)aeabi_unwind_cpp_pr1.os
>  lib-noranlib: $(objpfx)libgcc-stubs.a
>  
>  ifeq ($(build-shared),yes)
> -ifneq (no,$(have-mtls-descriptor))
> +ifneq (no,$(have-test-mtls-descriptor))
>  tests += tst-armtlsdescloc tst-armtlsdescextnow tst-armtlsdescextlazy
>  modules-names += tst-armtlsdesclocmod
>  modules-names += tst-armtlsdescextlazymod tst-armtlsdescextnowmod
>  CPPFLAGS-tst-armtlsdescextnowmod.c += -Dstatic=
>  CPPFLAGS-tst-armtlsdescextlazymod.c += -Dstatic=
> -CFLAGS-tst-armtlsdesclocmod.c += -mtls-dialect=$(have-mtls-descriptor)
> -CFLAGS-tst-armtlsdescextnowmod.c += -mtls-dialect=$(have-mtls-descriptor)
> -CFLAGS-tst-armtlsdescextlazymod.c += -mtls-dialect=$(have-mtls-descriptor)
> +CFLAGS-tst-armtlsdesclocmod.c += -mtls-dialect=$(have-test-mtls-descriptor)
> +CFLAGS-tst-armtlsdescextnowmod.c += -mtls-dialect=$(have-test-mtls-descriptor)
> +CFLAGS-tst-armtlsdescextlazymod.c += -mtls-dialect=$(have-test-mtls-descriptor)
>  LDFLAGS-tst-armtlsdescextnowmod.so += -Wl,-z,now
>  tst-armtlsdescloc-ENV = LD_BIND_NOW=1
>  tst-armtlsdescextnow-ENV = LD_BIND_NOW=1
> diff --git a/sysdeps/unix/sysv/linux/x86_64/Makefile b/sysdeps/unix/sysv/linux/x86_64/Makefile
> index fcbffd81cb..fb834a7089 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/Makefile
> +++ b/sysdeps/unix/sysv/linux/x86_64/Makefile
> @@ -67,7 +67,7 @@ $(objpfx)libx86-64-isa-level.so: $(objpfx)libx86-64-isa-level-1.so
>  	cp $< $@
>  endif
>  
> -ifeq (yes,$(have-mamx-tile))
> +ifeq (yesgnu2,$(have-mamx-tile)$(have-test-mtls-descriptor))
>  tests += \
>    tst-gnu2-tls2-amx \
>  # tests


More information about the Libc-alpha mailing list