From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) by sourceware.org (Postfix) with ESMTPS id 8FFD138582AD for ; Thu, 16 Nov 2023 05:37:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8FFD138582AD 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 8FFD138582AD Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4860:4864:20::2d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700113043; cv=none; b=UQJucZTryg/8egmtGoX9GEE3Em0T36uqD4uOrYM8f1v1/L7wBl4FdyMD0kKPnsmuwxaWRfodqLwJ8HWGYYfmWoobhSisOx59ls8bd7BkzwXJynj+FJf3RDQrLa5/jPPqOfK3eaWlKUbcPyISppJQKKtLWZpjHukH6126aJWZjfo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700113043; c=relaxed/simple; bh=hdyzFg8O1TL1gID8dLy33uX2IdpQzZJiIEiyP4wToSs=; h=DKIM-Signature:Mime-Version:Subject:From:Date:Message-Id:To; b=kNBM0DnR88iukURg5wnTRQjzFtYMe9I4Yt5tqsZTI8RlDp0WCfvXb9TWUST07C7/lwacNEUf9haS39UJUtshlWlp+wL/Tur1srnMpLpYHoehqyC3w/7+Nx3ZVCsl5uME8ackFkakLRZVcF0LXlSniBe+tW50+Y9Y9a5J8OxFqco= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-1d542f05b9aso72072fac.1 for ; Wed, 15 Nov 2023 21:37:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700113041; x=1700717841; darn=gcc.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=VPtqT06Wzm/MQOkjihWTlI6yqYfJq5UafDikXctJgdc=; b=KrpaZtGSCsTfW8GczhdZiUEEVIjfvvVcGPUknqyEBLJmxP45TPtQVUvcGBLFMZ7cAP xRmWhp6L5Uo9fWVFbC7YCUcZj5VLabgqwy/0ZY/WI/MIoOjsuVBT0lQcoCDtqjQ9NuUq SVtSm/2sFV3nKpHrIqajpAjvjFCDMbOcEU/TKxTUiScnTutMIZMfSwTTCGsTbEdmFdBR LYUGZg0/T9c8q4E+9HW9a4/vQ70FQL/o6d7VJZ86vSMJm+RD2oVQdq35epI4LZxuu1hV yKOIxQLqsYjcu1Ix+kSEtQriFBDFQ4IDMAW3bDoRkvmLk9NSNkPLrCeliLU6w0T1mU2C K1UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700113041; x=1700717841; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VPtqT06Wzm/MQOkjihWTlI6yqYfJq5UafDikXctJgdc=; b=C3c8NO5C2qFP+EFP4D6BjVE7S2KG0LVCxQwawVjSQnslTXvv14zpQwnRToCyALgzSN 60UlwIn1PqTk0Mt8kUVYfk372hCQTXP6Y2mpu4n9M/T9Z9czoe/mTKV036uD/Yxn5o6U KCxTe7MD2cM0KmpnB8gEGo+sYtaZH18wZNX2oaM65qTewSIRazVJ8E+YUzLWD3IHyDJJ 3iIxsZ7RSLyOCdZ7D9IZde/17INaZzgvu/Uywf2LwL2ca6yRsfKNXyg7W6mnxIVyU/wG Gs0UNKpVdXcQK7NVA+E5UXrSpnubsub8BLWYSIq14WUVVhJVmAuRucJvGO9IT9on8yLW Uibg== X-Gm-Message-State: AOJu0YzcLNqQwefLuyvdVnS0ogsU8nkc+BpWfMAnjLFDBTIzJ9ZLhctn NDHqLqMwQTJdgIOP/zmLLk4= X-Google-Smtp-Source: AGHT+IEp6TsyeZ/6h76SC+MNfKjEoH55HHEqknTEfsnTgDVoVvxIVE4osGGw9Mn7jJhq/Q3kMK2pJQ== X-Received: by 2002:a05:6870:248a:b0:1e9:adec:bf5e with SMTP id s10-20020a056870248a00b001e9adecbf5emr8136937oaq.2.1700113041507; Wed, 15 Nov 2023 21:37:21 -0800 (PST) Received: from smtpclient.apple ([157.82.128.5]) by smtp.gmail.com with ESMTPSA id s23-20020a62e717000000b0069323619f69sm3823605pfh.143.2023.11.15.21.37.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2023 21:37:20 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.200.91.1.1\)) Subject: Re: [PATCH v2] RISC-V: Implement TLS Descriptors. From: Tatsuyuki Ishi In-Reply-To: Date: Thu, 16 Nov 2023 14:37:08 +0900 Cc: gcc-patches@gcc.gnu.org, Jeff Law , Rui Ueyama , Rui Ueyama , Kito Cheng Content-Transfer-Encoding: quoted-printable Message-Id: <6C9A5D15-9EAE-4273-A4F0-03525D063F56@gmail.com> References: <20230817181308.122802-2-ishitatsuyuki@gmail.com> <20230908104923.31154-1-ishitatsuyuki@gmail.com> <54cba99d-fa53-4ecd-b850-f8f7e2c8a21a@gmail.com> <549C3D78-7D43-4D7D-B0E1-0271B1E4CBDA@gmail.com> <55ee8943-babd-4fb2-aaab-ca88e37683b7@gmail.com> To: Fangrui Song X-Mailer: Apple Mail (2.3774.200.91.1.1) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_INFOUSMEBIZ,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > On Nov 16, 2023, at 14:33, Fangrui Song wrote: >=20 > On Wed, Nov 15, 2023 at 9:23=E2=80=AFPM Jeff Law = wrote: >>=20 >>=20 >>=20 >> On 11/15/23 18:51, Tatsuyuki Ishi wrote: >>>> On Nov 16, 2023, at 10:07, Jeff Law wrote: >>=20 >>>=20 >>> Based on what I have read in the AArch64 backend, there are two ways = to >>> do this: introduce a custom calling convention, or put in a RTX insn >>> that covers the whole sequence. Ideally we should do the first, but = then >>> there=E2=80=99s the label issue and it=E2=80=99s quite a bit more = complicated. So I=E2=80=99m >>> sticking with this for now. >> As I said, I think we're OK here. We can always revamp as we get >> experience with the implementation -- I don't think any of the stuff >> we're talking about is an ABI change, they're just implementation = details. >>=20 >>>=20 >>> Sorry for all the delay on this. My progress has been (and still) >>> blocked on supporting relaxation of TLSDESC in binutils (turns out = you >>> can=E2=80=99t run static binaries without relaxing it first). But = that doesn=E2=80=99t >>> seem exactly easy to do either, because relaxation that involves GOT >>> elimination isn=E2=80=99t something we have in the RISC-V backend. >> Note that binutils is due for another release in the next month or = two. >> It'd certainly be helpful to have any issues there resolved in time = for >> that release. >>=20 >>>=20 >>> I=E2=80=99ll try to send a new version of this patch and get this = unblocked on >>> GCC side first. >> Sounds good. We can always guard its use behind a feature test for = GAS >> support. >>=20 >> Jeff >=20 > Agreed. >=20 >=20 > Tatsuyuki, could you also add some tests? For example >=20 > // end of = https://maskray.me/blog/2021-02-14-all-about-thread-local-storage > __thread int tls0; > extern __thread int tls1; > int foo() { return ++tls0 + ++tls1; } > static __thread int tls2, tls3; > int bar() { return ++tls2 + ++tls3; } >=20 > I have used this to check rtld and linker behavior. I think we need > some `scan-assembler`. > To make it a runnable test, some assembler feature check may be > needed. Perhaps Jeff can make some suggestion or contribute code! >=20 I believe there=E2=80=99s existing platform-generic TLS coverage in = gcc/testsuite/gcc.dg/torture/tls. GCC's test suite seems pretty sparse, = but a lot more testing is done by glibc=E2=80=99s testsuite (which is = also where I found the static TLS relaxation issue). Tatsuyuki. >=20 > --=20 > =E5=AE=8B=E6=96=B9=E7=9D=BF