From patchwork Thu Feb 29 19:46:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 86606 X-Patchwork-Delegate: arjun.is@lostca.se Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C480C3858292 for ; Thu, 29 Feb 2024 19:47:39 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by sourceware.org (Postfix) with ESMTPS id 2D4223858C39 for ; Thu, 29 Feb 2024 19:46:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2D4223858C39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2D4223858C39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709236017; cv=none; b=h84Hluv0wyPTrH3Pu9aTxIltkThud683QKsmlYI0S+1ZK6tpNq7L6b72KP2Y3Ygpgv+QQjLX1JHDP7yS01Zepy+PwsMMe/En9BzU17bYr6l44LjUEzn8mhdvkk+WKHmFESxHd3S2phyK+BacKyn+OWAcw5JLiI1Gu7rWgmQQzJU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709236017; c=relaxed/simple; bh=LjqaOgBHlzvghC5qDJ0ZYRtKH7g+tY0xfPu10/EXiOI=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=J8IK7oEFVw2W6VhSFEHO2G0+h0FJtfDJ+JrBvYE/E3gUifwZuDxru4LNgNuVmTm7mG1F98bl3F2hCVqhjhYC9ssMUg0QYoYkvLSxeM0502SWWUKMGA3a1/vIrZFsdwshlLZBEBMdNZAebwOOr3g1KuPqvA+u3O0QN+nwx8bT2WU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-5dc20645871so923318a12.1 for ; Thu, 29 Feb 2024 11:46:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709236013; x=1709840813; 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=oYtm8/IQpMJuYX6ShqWMa4f7nfeEcfn3XNXnCWrWuy0=; b=ULfiW43HojBCmt+GpGY+lwbboQeed56AIiy6JJFMQPpPlsyofVEw6Ga9/Gql9P6GrT /2HYHtVoPr/hXs6IX53HWFZye9RscareXRj9NkUEXfruBvKZO/shbuXHoTL7sVVL817w JCg2yihdV6C2QF5lQCoRRXvUvl09/LkRnG5arDDAvE+go4fCflWPR9X1JQIIsySBaJX7 pUydXv/UwoKeFE9hbpxlNMLw0CNoMOHcMgreGeiN0iQH8jj66D6pmxsO+AzX4xni8jlN 7RyC3sPyRRmBbLmkrLgYLCNeT8DbKHDrm4Rcxhj++mV/8RABdAzGcBTD2zN12R/58F4x TczA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709236013; x=1709840813; 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=oYtm8/IQpMJuYX6ShqWMa4f7nfeEcfn3XNXnCWrWuy0=; b=Z+khS0nfyy9ntmkvvNGAHjyC3JHxTqW7dxySLXTB/PqcIUsfK+Jqs1bKZBw2C+ch1e ZRfIxpxeAbA/t4GjB5XWMpsftLZQbT0yfdto/Gxbg3dCNGMZSkL3qJVckE+YuOx66BIP ROTckd4p2TShxEE89aQZbDODtuo4Jrsv1qTZEvnKUm97vEFfKXFGlJqR4qMH88GTOpSr l+hS1Wkzcquqk8Ca9OH0kejOacznVpZV3MWaFAUEMBde04npXmPcWgm29iQ66VqeC4Rh tPZkOMN1k9VCqxMsd06SDUIRkrh8mzKZqkYEI4awdaRxdx1sRqcGIx8kXoIa6tXlRSJo Ok0g== X-Gm-Message-State: AOJu0Yx0HJ+FZbwHiGocYPtvRePOWc7v6VwhLYoWSXSXVVid/hnDOCAO bl556YDUW34wTBVL+OeTadX7i4Mm0GspMjqdtfrm9La7kzjlXJq2wb+UDwZPLhg3PKR2RwcttK1 u X-Google-Smtp-Source: AGHT+IEDNFjNdwsgKPLvBSezL94Lv0yrSygBdWkEUND1IUl9ooZGsxM2RGzEi0rC22D6H2pk/pq6fQ== X-Received: by 2002:a17:90a:1f8b:b0:29b:c31:1fe1 with SMTP id x11-20020a17090a1f8b00b0029b0c311fe1mr4162277pja.10.1709236013347; Thu, 29 Feb 2024 11:46:53 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c1:3a1a:a62d:15eb:5bb4:832d]) by smtp.gmail.com with ESMTPSA id cz13-20020a17090ad44d00b0029ad44cc063sm3957206pjb.35.2024.02.29.11.46.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 11:46:52 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Szabolcs Nagy , "H . J . Lu" Subject: [PATCH 3/3] elf: Enable TLS descriptor tests on aarch64 Date: Thu, 29 Feb 2024 16:46:42 -0300 Message-Id: <20240229194642.3398122-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240229194642.3398122-1-adhemerval.zanella@linaro.org> References: <20240229194642.3398122-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org The aarch64 uses a different name than x86 and arm (trad instead os gnu2). Use it to check whether to enable the TLS descriptor tests. Also rename the internal machinery fron gnu2 to tls descriptors. Checked on aarch64-linux-gnu. --- 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 ab8a10ed92..034ac9017a 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 -Wl,--unresolved-symbols=ignore-all 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 4bb9aeef95..ddfb2876a3 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 a300cf2602..ebbe1bcf3f 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..89edb0c9a2 100644 --- a/sysdeps/aarch64/preconfigure +++ b/sysdeps/aarch64/preconfigure @@ -2,5 +2,6 @@ case "$machine" in aarch64*) base_machine=aarch64 machine=aarch64 + mtls_descriptor=trad ;; 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