From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <> Received: from fx306.security-mail.net (smtpout30.security-mail.net [85.31.212.37]) by sourceware.org (Postfix) with ESMTPS id 3753A384F020 for ; Tue, 10 Aug 2021 21:03:58 +0000 (GMT) Authentication-Results: sourceware.org; dkim=permerror (bad message/signature format) Received: by fx306.security-mail.net (Postfix) id 55A6C3993DA; Tue, 10 Aug 2021 23:03:57 +0200 (CEST) Date: Tue, 10 Aug 2021 23:03:57 +0200 (CEST) From: MAILER-DAEMON (Mail Delivery System) Subject: Undelivered Mail Returned to Sender To: libc-alpha@sourceware.org Auto-Submitted: auto-replied MIME-Version: 1.0 Content-Type: multipart/report; report-type=delivery-status; boundary="14039398FE0.1628629437/fx306.security-mail.net" Message-Id: <20210810210357.55A6C3993DA@fx306.security-mail.net> X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, HTML_MESSAGE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Aug 2021 21:04:08 -0000 This is a MIME-encapsulated message. --14039398FE0.1628629437/fx306.security-mail.net Content-Description: Notification Content-Type: text/plain; charset=us-ascii This is the mail system at host fx306.security-mail.net. I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below. For further assistance, please send mail to postmaster. If you do so, please include this problem report. You can delete your own text from the attached returned message. The mail system : host zimbra2.kalray.eu[195.135.97.26] said: 550 5.1.1 : Recipient address rejected: User unknown in virtual mailbox table (in reply to RCPT TO command) --14039398FE0.1628629437/fx306.security-mail.net Content-Description: Delivery report Content-Type: message/delivery-status Reporting-MTA: dns; fx306.security-mail.net X-Postfix-Queue-ID: 14039398FE0 X-Postfix-Sender: rfc822; libc-alpha@sourceware.org Arrival-Date: Tue, 10 Aug 2021 23:03:51 +0200 (CEST) Final-Recipient: rfc822; mpoulhies@kalray.eu Original-Recipient: rfc822;mpoulhies@kalray.eu Action: failed Status: 5.1.1 Remote-MTA: dns; zimbra2.kalray.eu Diagnostic-Code: smtp; 550 5.1.1 : Recipient address rejected: User unknown in virtual mailbox table --14039398FE0.1628629437/fx306.security-mail.net Content-Description: Undelivered Message Content-Type: message/rfc822 Return-Path: Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) by fx306.security-mail.net (Postfix) with ESMTPS id 89599398EC8 for ; Tue, 10 Aug 2021 23:03:48 +0200 (CEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 22BBA384F00C for ; Tue, 10 Aug 2021 21:03:47 +0000 (GMT) Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by sourceware.org (Postfix) with ESMTPS id C8D773853819 for ; Tue, 10 Aug 2021 21:03:23 +0000 (GMT) Received: by mail-yb1-xb4a.google.com with SMTP id f8-20020a2585480000b02905937897e3daso170067ybn.2 for ; Tue, 10 Aug 2021 14:03:23 -0700 (PDT) X-Quarantine-ID: X-Virus-Scanned: E-securemail, by Secumail X-Spam-Status: No, score=-2.586 tagged_above=-1000 required=7.5 tests=[AB_ENVFROM_LONG_40=0.5, AB_FAKE_WORD_1=0.2, AB_LONG_SUBJ_30=0.001, AB_SUBJ_HASHID_EO_TAG=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-1, DKIM_VALID_AU=-0.1, FSL_RCVD_EX_3=0.01, FSL_RCVD_UT_3=0.01, HEAD_NEWS=-0.5, HK_MUCHMONEY=0.001, MISSING_MID=0.14, MM_ENVFROM_BOUNCE=1, RCVD_IN_DNSWL_MED=-1.3, RDNS_DYNAMIC=0.363, S_FROM_GREY_MINUS_2=-2, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Authentication-Results: fx306.security-mail.net (amavisd-new); dkim=pass (1024-bit key) header.d=sourceware.org Secumail-id: DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 22BBA384F00C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1628629427; bh=nfX/HfaeerLXPBFJ9rD0/2YIk36YPhiK0yoNCrAqcJk=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=bvuHVa/BM/cPap09xl8EhPmUG+1wPXdad42cL4C4D2+JWVm1TEIsVzbWPWvCTRo3f 5DU82VHTXoH8zeeCUB0oTmd5vkGS6MROQqz/HjRzwSI7MtUcDylBI/qOr50AReQzSX SgNkp7e4EkPknlb9gyIPVTvzw+IyeSnF2j4YKpVs= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C8D773853819 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=nfX/HfaeerLXPBFJ9rD0/2YIk36YPhiK0yoNCrAqcJk=; b=cIDdZOnWmQ7AdMbdwspDLB/6pOL8cqDapTOrOrYiyUXYSjdLisJJlGAF9xIDVsRpBh 7/Cgj5meEpy8CSoacyjIAmoVkRxxJdEN6/HUXD6qLrZKcuns05/AlZKdXeOe8HAQVXfS kQ45X3LMDTgz0mn/Alvxhgx4XHBnMhc+mFFytcFdowSxM2eEOt5GpxnjZq3t+Snm2vgm zlRnIX5ILZ1096/WNL1W166DE+hm3I0ocoGKPCW9HFUK8ECJgU4Q2bhVoP6vvb3RDcD9 9D+mVng1v+ZgmVl0Qn7sB5bev15AgsLA+t2pfONv5xALAWnSF+m1tI5cPTm3lBy90lms 7zxw== X-Gm-Message-State: AOAM532DXUuw7XM2P+jnnkgabQMo3/ODH53n5rs21LH5gVefdaaEkeGB ajtfhXjW2PUM5MKC6VTBbryk7FuD8rAJQ87oplKPImvaAcRzzPaaN/E8U6LQhN6YELiN22TS04v EOMzbE+PQ8xwQOMvU16imn2d7G+hvLt/+EVwl0oZ5Wb2A723Rc5QJxCyoxsYRhTr2U6Wd X-Google-Smtp-Source: ABdhPJwbLdVNMQePwKAyzbYCklv0vRmtwYMk7RMuaVb+zSGSlkNmry9YJ4q6TmUjO+AbCw34kXBJZwjM7WKd X-Received: from maskray1.svl.corp.google.com ([2620:15c:2ce:200:69a6:3e8d:f42c:7450]) (user=maskray job=sendgmr) by 2002:a25:814f:: with SMTP id j15mr40155685ybm.358.1628629403296; Tue, 10 Aug 2021 14:03:23 -0700 (PDT) Date: Tue, 10 Aug 2021 14:02:47 -0700 Message-ID: <20210810210247.676100-1-maskray@google.com> MIME-Version: 1.0 Subject: [PATCH v2] aarch64: Skip traditional GD/LD TLS which are unsupported by Clang and LLD [BZ #28205] To: libc-alpha@sourceware.org, Adhemerval Zanella , Szabolcs Nagy X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Fangrui Song via Libc-alpha Reply-To: Fangrui Song Errors-To: libc-alpha-bounces+mpoulhies=kalray.eu@sourceware.org Sender: Libc-alpha X-ALTERMIMEV2_in: done Content-Type: text/plain; charset=utf-8 TLSDESC is the default on aarch64. Clang doesn't support -mtls-dialect=trad. Its integrated assembler doesn't support the marker. LLD's doesn't support R_AARCH64_TLSGD_*/R_AARCH64_TLSLD_* relocations. Just skip the tests. With https://sourceware.org/pipermail/libc-alpha/2021-August/129966.html ("aarch64: Make elf_machine_{load_address, dynamic} robust [BZ #28203]"), if we allow LLD in configure.ac, `make check` test results of LLD are on par with GNU ld. --- config.h.in | 3 +++ elf/tst-tls1.c | 7 +++++-- elf/tst-tls2.c | 6 ++++-- elf/tst-tls3.c | 8 ++++---- elf/tst-tlsmod1.c | 6 ++++-- elf/tst-tlsmod2.c | 4 +++- elf/tst-tlsmod3.c | 5 ++++- elf/tst-tlsmod4.c | 4 +++- sysdeps/aarch64/configure | 30 ++++++++++++++++++++++++++++++ sysdeps/aarch64/configure.ac | 18 ++++++++++++++++++ 10 files changed, 78 insertions(+), 13 deletions(-) diff --git a/config.h.in b/config.h.in index 0d92504f65..7dcce4d3a4 100644 --- a/config.h.in +++ b/config.h.in @@ -198,6 +198,9 @@ /* Define if CC supports attribute retain. */ #undef HAVE_GNU_RETAIN +/* Define if CC and LD support traditional TLS GD/LD models. */ +#define HAVE_TRAD_TLS 1 + /* Define to 1 if the assembler needs intermediate aliases to define multiple symbol versions for one symbol. */ #define SYMVER_NEEDS_ALIAS 0 diff --git a/elf/tst-tls1.c b/elf/tst-tls1.c index c31da56ce9..57d5ea2485 100644 --- a/elf/tst-tls1.c +++ b/elf/tst-tls1.c @@ -39,7 +39,8 @@ do_test (void) result = 1; } - + /* Clang and LLD do not support traditional GD/LD TLS on aarch64. */ +#ifdef HAVE_TRAD_TLS /* Get variables using local dynamic model. */ fputs ("get sum of foo and bar (LD)", stdout); ap = TLS_LD (foo); @@ -56,8 +57,9 @@ do_test (void) printf ("bar = %d\n", *bp); result = 1; } +#endif - +#ifdef HAVE_TRAD_TLS /* Get variables using generic dynamic model. */ fputs ("get sum of foo and bar (GD)", stdout); ap = TLS_GD (foo); @@ -74,6 +76,7 @@ do_test (void) printf ("bar = %d\n", *bp); result = 1; } +#endif return result; } diff --git a/elf/tst-tls2.c b/elf/tst-tls2.c index 963b8d6c88..c9dcc084e3 100644 --- a/elf/tst-tls2.c +++ b/elf/tst-tls2.c @@ -39,7 +39,7 @@ do_test (void) result = 1; } - +#ifdef HAVE_TRAD_TLS /* Get variables using local dynamic model. */ fputs ("get sum of foo and bar (LD)", stdout); ap = TLS_LD (foo); @@ -56,8 +56,9 @@ do_test (void) printf ("bar = %d\n", *bp); result = 1; } +#endif - +#ifdef HAVE_TRAD_TLS /* Get variables using generic dynamic model. */ fputs ("get sum of foo and bar (GD)", stdout); ap = TLS_GD (foo); @@ -74,6 +75,7 @@ do_test (void) printf ("bar = %d\n", *bp); result = 1; } +#endif return result; } diff --git a/elf/tst-tls3.c b/elf/tst-tls3.c index 7e0abb4c58..6f2e144a7f 100644 --- a/elf/tst-tls3.c +++ b/elf/tst-tls3.c @@ -17,8 +17,7 @@ static int do_test (void) { int result = 0; - int *ap, *bp, *cp; - + int *ap, *bp; /* Set the variable using the local exec model. */ puts ("set baz to 3 (LE)"); @@ -33,7 +32,8 @@ do_test (void) bp = TLS_IE (bar); *bp = 2; - +#ifdef HAVE_TRAD_TLS + int *cp; /* Get variables using local dynamic model. */ fputs ("get sum of foo, bar (GD) and baz (LD)", stdout); ap = TLS_GD (foo); @@ -56,7 +56,7 @@ do_test (void) printf ("baz = %d\n", *cp); result = 1; } - +#endif result |= in_dso (); diff --git a/elf/tst-tlsmod1.c b/elf/tst-tlsmod1.c index 8d9156791b..9f48e36af4 100644 --- a/elf/tst-tlsmod1.c +++ b/elf/tst-tlsmod1.c @@ -14,7 +14,7 @@ int in_dso (void) { int result = 0; - int *ap, *bp, *cp; + int *ap, *bp; /* Get variables using initial exec model. */ fputs ("get sum of foo and bar (IE)", stdout); @@ -34,7 +34,8 @@ in_dso (void) result = 1; } - +#ifdef HAVE_TRAD_TLS + int *cp; /* Get variables using generic dynamic model. */ fputs ("get sum of foo and bar and baz (GD)", stdout); ap = TLS_GD (foo); @@ -57,6 +58,7 @@ in_dso (void) printf ("baz = %d\n", *cp); result = 1; } +#endif return result; } diff --git a/elf/tst-tlsmod2.c b/elf/tst-tlsmod2.c index 40eb1407f8..78578ebcc2 100644 --- a/elf/tst-tlsmod2.c +++ b/elf/tst-tlsmod2.c @@ -9,9 +9,10 @@ COMMON_INT_DEF(foo); int in_dso (int n, int *caller_foop) { - int *foop; int result = 0; +#ifdef HAVE_TRAD_TLS + int *foop; puts ("foo"); /* Make sure PLT is used before macros. */ asm ("" ::: "memory"); @@ -29,6 +30,7 @@ in_dso (int n, int *caller_foop) } *foop = 16; +#endif return result; } diff --git a/elf/tst-tlsmod3.c b/elf/tst-tlsmod3.c index 6d186c47ee..d9f17dbb6f 100644 --- a/elf/tst-tlsmod3.c +++ b/elf/tst-tlsmod3.c @@ -12,8 +12,10 @@ COMMON_INT_DEF(comm_n); int in_dso2 (void) { - int *foop; int result = 0; + +#ifdef HAVE_TRAD_TLS + int *foop; static int n; int *np; @@ -32,6 +34,7 @@ in_dso2 (void) result |= in_dso (*foop = 42 + n++, foop); *foop = 16; +#endif return result; } diff --git a/elf/tst-tlsmod4.c b/elf/tst-tlsmod4.c index 86889aac7e..27baaaf501 100644 --- a/elf/tst-tlsmod4.c +++ b/elf/tst-tlsmod4.c @@ -9,9 +9,10 @@ COMMON_INT_DEF(baz); int in_dso (int n, int *caller_bazp) { - int *bazp; int result = 0; +#ifdef HAVE_TRAD_TLS + int *bazp; puts ("foo"); /* Make sure PLT is used before macros. */ asm ("" ::: "memory"); @@ -29,6 +30,7 @@ in_dso (int n, int *caller_bazp) } *bazp = 16; +#endif return result; } diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure index 4c1fac49f3..eb62e68010 100644 --- a/sysdeps/aarch64/configure +++ b/sysdeps/aarch64/configure @@ -332,3 +332,33 @@ if test $libc_cv_aarch64_sve_asm = yes; then $as_echo "#define HAVE_AARCH64_SVE_ASM 1" >>confdefs.h fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -mtls-dialect=trad" >&5 +$as_echo_n "checking for -mtls-dialect=trad... " >&6; } +if ${libc_cv_aarch64_trad_tls+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.c <&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + libc_cv_aarch64_trad_tls=yes + else + libc_cv_aarch64_trad_tls=no + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_aarch64_trad_tls" >&5 +$as_echo "$libc_cv_aarch64_trad_tls" >&6; } +if test $libc_cv_aarch64_trad_tls = no; then + $as_echo "#define HAVE_TRAD_TLS 0" >>confdefs.h + +fi diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac index 3347c13fa1..6d3b412acc 100644 --- a/sysdeps/aarch64/configure.ac +++ b/sysdeps/aarch64/configure.ac @@ -105,3 +105,21 @@ rm -f conftest*]) if test $libc_cv_aarch64_sve_asm = yes; then AC_DEFINE(HAVE_AARCH64_SVE_ASM) fi + +# Check if both CC and LD support traditional TLS GD/LD models. +AC_CACHE_CHECK([for -mtls-dialect=trad], libc_cv_aarch64_trad_tls, [dnl +cat > conftest.c <