From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by sourceware.org (Postfix) with ESMTPS id D21A63858418 for ; Mon, 1 Apr 2024 20:23:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D21A63858418 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D21A63858418 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712003021; cv=none; b=uaHgX+adpDcLDbLQifolZeT1GnUt/p6CcCympaX1XjjObl0q5aUVgMECxEtaM+GynZgG8iPdhe2JQ7XclbABc9SFhczisIa1QSWjyz1VkqGGS0J8aFQGbdUhjc1q0eE3oWA0jnTZLLJs0e36YPvmHyZ0ZRtGV1VfcKhe07m7Tb0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712003021; c=relaxed/simple; bh=dsvhqWEaf2HDW6jhrW7MhrZPwK+Zm9TcSmKx4O1ti5Y=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Dme4CdF6qat0/Q4r1IIRDssgufqrqMTFNqfij4qAHBgCNrdk4Pob6NgTqK/NNLYCa3BC/pYldAlgDW+ZP0EgDJAs/pt1GXZgsjbM4+qC+4JLdRj5fZjhr0RrjdQFW+obaEUAgyVKsNjejgxT6HPVOK04rhnjbpQpIl/0vkVD/O4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5dca1efad59so3053915a12.2 for ; Mon, 01 Apr 2024 13:23:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712003017; x=1712607817; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=w5/Z7AChsrcrF7kSBv3pgTvR3c4VjO7goxncVBfphhI=; b=KnC7abQlWsvb/wr2g4hgw3Ht9CERHw3kbVg3L5aCKKpYWULYPEWp9qVUwBu/7y/B7x btEqHspD7UUaCltaFA8s4lxBiRP/pYhhiNWcvSoBh2uuXochDiM7gXxBUE2P2rc5cTj6 Tq91RMdmaRL4bRMPCIzJxmYnXKAqViFpSVC1ty9n1Dk7jaDl5OTaJ/ISt7X0uPbjwsPF 3ZQtuvJJndF9cSVZZljT5wYAstKH1PUNEX2qmNkBb7FmkuyWfqu1eZ89dHUQ7m/Xa5LT IPrQXwL0/gudloSXiXBbudu14lLoFr0vBgg8TJ26UkQEbvTxKOFeMHzrtCTSvjogwiEG k/2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712003017; x=1712607817; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w5/Z7AChsrcrF7kSBv3pgTvR3c4VjO7goxncVBfphhI=; b=hHuZX/bEIXS33mpLbuvc/ljjBXbEHa1jxun4akxNJpLaLRFw5HoNwEV5VUdEgTBumx XhOuTic48F/Lc49mLgJEipSyKHXRO2SDoiyqNQNrghX9MnyFde5m2GGGYlO/k1NU5Ue1 xKbQkPd3PRcEfPUx2E8/Tkr6oxvZSvfmnN+CFda28sV0OwoK+hrgClMca4LtOG5l7qwP J37i7EjmVVtuDiLog8eiwgu2e5qV6y2oAwR4C0wnkfXkqs6RTQijwqxFFL6VgvsZeIJi oO+2IPaugq52JspJO+bvXwueBZ/UHMm63pcAvyi8sA6wWpu937MCrfdAvj1Zv/cNdKaw 4v5w== X-Gm-Message-State: AOJu0YxYgMHjJhvRcWWFwi2lq9xcc1Ubc+X6HTRjbhtq81ncJxomNiR6 PvjMwvIiG96w4dN3Ayhr4Elx7sZ02VsXHGBh3yl0/ZmiwNtQATlN X-Google-Smtp-Source: AGHT+IHuQ9jU4SoY+GZUUeS3N2UiDOfmHrhTzOaz2DA40hE/555pskKXqVcrD9uWVcnJeAAbyAkhNA== X-Received: by 2002:a17:90b:1d07:b0:2a2:2f0a:eabd with SMTP id on7-20020a17090b1d0700b002a22f0aeabdmr3933059pjb.13.1712003016770; Mon, 01 Apr 2024 13:23:36 -0700 (PDT) Received: from gnu-cfl-3.localdomain ([172.58.89.72]) by smtp.gmail.com with ESMTPSA id c1-20020a17090a490100b002a04eef22c5sm8911029pjh.44.2024.04.01.13.23.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 13:23:36 -0700 (PDT) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id F0992740754; Mon, 1 Apr 2024 13:23:31 -0700 (PDT) From: "H.J. Lu" To: libc-stable@sourceware.org Cc: fweimer@redhat.com, adhemerval.zanella@linaro.org Subject: [Backport: 6/6] elf: Enable TLS descriptor tests on aarch64 Date: Mon, 1 Apr 2024 13:23:19 -0700 Message-ID: <20240401202319.690253-7-hjl.tools@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240401202319.690253-1-hjl.tools@gmail.com> References: <20240401202319.690253-1-hjl.tools@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3020.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Adhemerval Zanella The aarch64 uses 'trad' for traditional tls and 'desc' for tls descriptors, but unlike other targets it defaults to 'desc'. The gnutls2 configure check does not set aarch64 as an ABI that uses TLS descriptors, which then disable somes stests. Also rename the internal machinery fron gnu2 to tls descriptors. Checked on aarch64-linux-gnu. Reviewed-by: H.J. Lu (cherry picked from commit 3d53d18fc71c5d9ef4773b8bce04d54b80181926) --- configure | 23 +++++++++++++---------- configure.ac | 15 +++++++++------ elf/Makefile | 26 +++++++++++++------------- sysdeps/aarch64/preconfigure | 1 + sysdeps/arm/Makefile | 8 ++++---- 5 files changed, 40 insertions(+), 33 deletions(-) diff --git a/configure b/configure index 117b48a421..432e40a592 100755 --- a/configure +++ b/configure @@ -653,7 +653,7 @@ LIBGD libc_cv_cc_loop_to_function libc_cv_cc_submachine libc_cv_cc_nofma -libc_cv_mtls_dialect_gnu2 +libc_cv_mtls_descriptor libc_cv_has_glob_dat libc_cv_fpie libc_cv_z_execstack @@ -4760,6 +4760,9 @@ libc_config_ok=no # whether to use such directories. with_fp_cond=1 +# A preconfigure script may define another name to TLS descriptor variant +mtls_descriptor=gnu2 + if frags=`ls -d $srcdir/sysdeps/*/preconfigure 2> /dev/null` then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sysdeps preconfigure fragments" >&5 @@ -7006,9 +7009,9 @@ fi printf "%s\n" "$libc_cv_has_glob_dat" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -mtls-dialect=gnu2" >&5 -printf %s "checking for -mtls-dialect=gnu2... " >&6; } -if test ${libc_cv_mtls_dialect_gnu2+y} +{ 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 $as_nop @@ -7019,7 +7022,7 @@ void foo (void) i = 10; } EOF -if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles +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 @@ -7027,17 +7030,17 @@ if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nost printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } then - libc_cv_mtls_dialect_gnu2=yes + libc_cv_mtls_descriptor=$mtls_descriptor else - libc_cv_mtls_dialect_gnu2=no + libc_cv_mtls_descriptor=no fi rm -f conftest* fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mtls_dialect_gnu2" >&5 -printf "%s\n" "$libc_cv_mtls_dialect_gnu2" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mtls_descriptor" >&5 +printf "%s\n" "$libc_cv_mtls_descriptor" >&6; } config_vars="$config_vars -have-mtls-dialect-gnu2 = $libc_cv_mtls_dialect_gnu2" +have-mtls-descriptor = $libc_cv_mtls_descriptor" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if -Wno-ignored-attributes is required for aliases" >&5 printf %s "checking if -Wno-ignored-attributes is required for aliases... " >&6; } diff --git a/configure.ac b/configure.ac index 19b88a47a5..bdc385d03c 100644 --- a/configure.ac +++ b/configure.ac @@ -442,6 +442,9 @@ libc_config_ok=no # whether to use such directories. with_fp_cond=1 +# A preconfigure script may define another name to TLS descriptor variant +mtls_descriptor=gnu2 + dnl Let sysdeps/*/preconfigure act here. LIBC_PRECONFIGURE([$srcdir], [for sysdeps]) @@ -1287,7 +1290,7 @@ fi rm -f conftest*]) AC_SUBST(libc_cv_has_glob_dat) -AC_CACHE_CHECK([for -mtls-dialect=gnu2], libc_cv_mtls_dialect_gnu2, +AC_CACHE_CHECK([for tls descriptor support], libc_cv_mtls_descriptor, [dnl cat > conftest.c <&AS_MESSAGE_LOG_FD]) then - libc_cv_mtls_dialect_gnu2=yes + libc_cv_mtls_descriptor=$mtls_descriptor else - libc_cv_mtls_dialect_gnu2=no + libc_cv_mtls_descriptor=no fi rm -f conftest*]) -AC_SUBST(libc_cv_mtls_dialect_gnu2) -LIBC_CONFIG_VAR([have-mtls-dialect-gnu2], [$libc_cv_mtls_dialect_gnu2]) +AC_SUBST(libc_cv_mtls_descriptor) +LIBC_CONFIG_VAR([have-mtls-descriptor], [$libc_cv_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 030db4d207..69aa423c4b 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -999,13 +999,13 @@ modules-names-tests = $(filter-out ifuncmod% tst-tlsmod%,\ # For +depfiles in Makerules. extra-test-objs += tst-auditmod17.os -ifeq (yes,$(have-mtls-dialect-gnu2)) +ifneq (no,$(have-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=gnu2 -endif # $(have-mtls-dialect-gnu2) +CFLAGS-tst-gnu2-tls1mod.c += -mtls-dialect=$(have-mtls-descriptor) +endif # $(have-mtls-descriptor) ifeq (yes,$(have-protected-data)) modules-names += tst-protected1moda tst-protected1modb @@ -2972,11 +2972,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) -ifeq (yes,$(have-mtls-dialect-gnu2)) +ifneq (no,$(have-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=gnu2 -CFLAGS-tst-audit-tlsdesc-mod2.c += -mtls-dialect=gnu2 +CFLAGS-tst-audit-tlsdesc-mod1.c += -mtls-dialect=$(have-mtls-descriptor) +CFLAGS-tst-audit-tlsdesc-mod2.c += -mtls-dialect=$(have-mtls-descriptor) endif $(objpfx)tst-audit-tlsdesc-dlopen: $(shared-thread-library) $(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-audit-tlsdesc-mod1.so \ @@ -3055,11 +3055,11 @@ $(objpfx)tst-gnu2-tls2.out: \ $(objpfx)tst-gnu2-tls2mod1.so \ $(objpfx)tst-gnu2-tls2mod2.so -ifeq (yes,$(have-mtls-dialect-gnu2)) -CFLAGS-tst-tlsgap-mod0.c += -mtls-dialect=gnu2 -CFLAGS-tst-tlsgap-mod1.c += -mtls-dialect=gnu2 -CFLAGS-tst-tlsgap-mod2.c += -mtls-dialect=gnu2 -CFLAGS-tst-gnu2-tls2mod0.c += -mtls-dialect=gnu2 -CFLAGS-tst-gnu2-tls2mod1.c += -mtls-dialect=gnu2 -CFLAGS-tst-gnu2-tls2mod2.c += -mtls-dialect=gnu2 +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) endif diff --git a/sysdeps/aarch64/preconfigure b/sysdeps/aarch64/preconfigure index d9bd1f8558..19657b627b 100644 --- a/sysdeps/aarch64/preconfigure +++ b/sysdeps/aarch64/preconfigure @@ -2,5 +2,6 @@ case "$machine" in aarch64*) base_machine=aarch64 machine=aarch64 + mtls_descriptor=desc ;; esac diff --git a/sysdeps/arm/Makefile b/sysdeps/arm/Makefile index d5cea717a9..619474eca9 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) -ifeq (yes,$(have-mtls-dialect-gnu2)) +ifneq (no,$(have-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=gnu2 -CFLAGS-tst-armtlsdescextnowmod.c += -mtls-dialect=gnu2 -CFLAGS-tst-armtlsdescextlazymod.c += -mtls-dialect=gnu2 +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) LDFLAGS-tst-armtlsdescextnowmod.so += -Wl,-z,now tst-armtlsdescloc-ENV = LD_BIND_NOW=1 tst-armtlsdescextnow-ENV = LD_BIND_NOW=1 -- 2.44.0