Rename have-mtls-descriptor to have-test-mtls-descriptor

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.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
This commit is contained in:
H.J. Lu 2025-01-03 10:21:56 +08:00
parent 3674004f3f
commit 1294926da3
6 changed files with 33 additions and 65 deletions

View File

@ -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` $@

42
configure vendored
View File

@ -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
@ -7422,31 +7421,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"
@ -7456,17 +7430,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
@ -7474,11 +7448,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)

View File

@ -1386,17 +1386,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.

View File

@ -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

View File

@ -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

View File

@ -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