From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id EE5C53858D3C for ; Wed, 13 Dec 2023 01:53:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EE5C53858D3C 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 EE5C53858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::631 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702432418; cv=none; b=LjJul93JFExDXQj+DFpAD4biTEfjhXVnMp7RTQesOGccI/i7sEm6E5Y4V2inP0X3vkbs+SVJJ/zDm6eqo74hzToSKX2ury2xkL7iKTz2YowepXxvftUlyE/o1UT2hAjyuli+v0Wc2UVgNJqVi6tUl2WBFLSS8/tyZMkqgZeZqrk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702432418; c=relaxed/simple; bh=0iiJfJ1ExtL1tC9tgfY+Uc1ICORTdKQn4GRWrgSsXio=; h=DKIM-Signature:From:Message-Id:Mime-Version:Subject:Date:To; b=Qe3ayUVGIuF/9zB63EsV2V8ZKdQuEbhJuIbaFSWct0XNNrDF2BS2xCbgY0CU6z/tEU4dgNi1no7/fLN1b0Fob41LSZFgFPk3CHUKyS1oqkiyPZX6vqCd4FLWXeSMTqC0f3HKyErNBIWlPzF67n/M+U/LWAQVbiFGgnIkhfJdMeo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1d3504e58cfso282315ad.0 for ; Tue, 12 Dec 2023 17:53:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702432414; x=1703037214; darn=sourceware.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=YnSTAU0uA86231qvvG1HznreFIiCkG/SlEezZOjtQcA=; b=Y4caGlcgpQkQ/xl4p/wiFKp96DZoM4xrJMU4UQyRTt4E8UtVMf89A4XkWn7ttRk3Ar uhVuys7FRKDoOXw0gT2sAcMoBR3xawumcVlsdLl5GcnegNhXppn3ftrwwUOqoSpFYd7k bhjSjGQ3tPBN5bS2wHjhJg1jmJ549KOpFjuCFnvwaMewkwOamhkh/EQacX/rgQpdWXXv ow6WrLHt8KuQ9jE0TCFl+riQsWHFrdeFvOk0n3JJNJZ9VumSvy7aKsAL7bavl0lJNA4l 84hSqWBfcVdXHuB39B+S6cv89aG79A+cZeNCOh7BF0szU+7CWqSZQshVdxpKM5bNo/5k 3FMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702432414; x=1703037214; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YnSTAU0uA86231qvvG1HznreFIiCkG/SlEezZOjtQcA=; b=Rhv4EAoMp9zP9SnYjL2uMr4HPXGwwI20Poqz0ZFPoNWoH5uGMVZMheUcYyTG4F/QAp a06Sus5HGn62JGbi+vmCha9h5D19VodBE5lrHZC1t2wPNwuNPXpa2ZkBKH37eo+4bWYp mVsaI6XuWU2N5CrJJiT4rs8cRubo1lORfRmPv9T+bD8AFW5MyVVev8T7dJdKFOoqKSL6 KuA9NFhB9/QQGULgFHtKAio4JafiYl7hBjDQunXvNaZk5fxgXZjlU3xzAI1HLnbFXGY5 DBWe9xFXo1wzIwZoZyid5tvjrX+lI0f61Wgspf6Yhgs3Ke4v6usSXlAw96/WudiyHMR2 A4kw== X-Gm-Message-State: AOJu0YztnpdyPtEFdxvI0LfcSbEJ9XPwCRh6tfp+fCt1pagpwV3jjxQ6 EIDrvGV6s1mIjGTm5A0WD3w= X-Google-Smtp-Source: AGHT+IEhXs0ejLFfMka/2f7kf+ChpS/pFJ4powxe72sWUrw7DuBzbEhF8jNmQAEk5EVX/FfV+Godaw== X-Received: by 2002:a17:902:ced2:b0:1d0:6bec:cdd8 with SMTP id d18-20020a170902ced200b001d06beccdd8mr13858071plg.5.1702432413573; Tue, 12 Dec 2023 17:53:33 -0800 (PST) Received: from smtpclient.apple (zz20184013906F627101.userreverse.dion.ne.jp. [111.98.113.1]) by smtp.gmail.com with ESMTPSA id a22-20020a170902b59600b001d0cd351baesm9077977pls.13.2023.12.12.17.53.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Dec 2023 17:53:32 -0800 (PST) From: Tatsuyuki Ishi Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_684A0397-34F5-4404-8997-95FEC93BF94A" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.300.61.1.2\)) Subject: Re: [PATCH v3 0/9] RISC-V: Implement TLS Descriptors. Date: Wed, 13 Dec 2023 10:53:19 +0900 In-Reply-To: Cc: i@maskray.me, nelson@rivosinc.com, lazyparser@gmail.com, binutils@sourceware.org, Rui Ueyama , ruiu@bluewhale.systems To: Palmer Dabbelt References: X-Mailer: Apple Mail (2.3774.300.61.1.2) X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,LIKELY_SPAM_BODY,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: --Apple-Mail=_684A0397-34F5-4404-8997-95FEC93BF94A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Dec 13, 2023, at 9:27, Palmer Dabbelt wrote: >=20 > On Wed, 06 Dec 2023 19:35:00 PST (-0800), i@maskray.me wrote: >> On Tue, Dec 5, 2023 at 4:33=E2=80=AFPM Nelson Chu = wrote: >>>=20 >>> Sorry that I don't familiar with the TLS stuff and TLS descriptor, so I= will need more time to figure these out if other maintainers are all busy.= Since there are other patches which are also being reviewed, if someone t= hinks this is an urgent matter, please feel free to let us know, so we can = switch to see these first. >>=20 >> I know that Android wants TLSDESC and having TLSDESC in gcc/binutils >> helps check LLVM feature parity... >> If we have TLSDESC earlier, an OS with a new RISC-V port can make >> TLSDESC part of the baseline ABI... >>=20 >>> On Wed, Dec 6, 2023 at 12:44=E2=80=AFAM Tatsuyuki Ishi wrote: >>>>=20 >>>> > On Nov 28, 2023, at 17:51, Tatsuyuki Ishi = wrote: >>>> > >>>> > This patchset implements TLS Descriptors (TLSDESC) for RISC-V target= s, per >>>> > the specification (merged) at [1]. >>>> > >>>> > Tested on rv64gc for: >>>> > - No regression (& passing new tests) in binutils >>>> > - No regression in gcc >>>> > - No regression in glibc for subdirs=3Delf >>>> > With both -mtls-dialect=3Ddesc and trad. >>>> > >>>> > This contribution is made on behalf of Blue Whale Systems, which has >>>> > copyright assignment on file with the FSF. >>>> > >>>> > [1]: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/373 >>>> > >>>> > v2: Add changelogs and tests. Minor fixes described in patch message= s. >>>> > v3: Add relaxation support. This fixes tst-tls1-static in glibc. >>>>=20 >>>> Would anyone like to review this? This is a prerequisite for the GCC-= side >>>> implementation to be useful (especially the gas part). >>>=20 >>>=20 >>> For these huge features, gcc/binutils/glibc should be reviewed at the s= ame time, since all the stuff should be bound and tested together, so "prer= equisite" shouldn't apply here ;) >=20 > Ya, I agree. It's super hard to review stuff like this without seeing al= l the code, doubly so now that the psABI has turned into a wasteland for di= scussions. >=20 >>>=20 >>> Thanks >>> Nelson >>=20 >> Agreed. I wonder whether Wei can find someone to test >> gcc/binutils/glibc patches... and some packages using TLS (e.g. >> https://codesearch.debian.net/search?q=3D__thread&literal=3D1). >=20 > Do you guys have a pointer to the glibc code? I can't find it, but I'm h= appy to poke it (or maybe find someone else who to poke it...). Hi, The glibc and gcc patches are available at [1] and [2] respectively. For glibc, I still need to implement save/restore stubs for vector ABI, but= apart from that it should be functional. [1]: https://inbox.sourceware.org/libc-alpha/20230914084033.222120-1-ishita= tsuyuki@gmail.com/ [2]: https://inbox.sourceware.org/gcc-patches/20231205070152.38360-1-ishita= tsuyuki@gmail.com/ Tatsuyuki. >>=20 >>>>=20 >>>>=20 >>>> I can split up the series into bug fix / refactors and actual changes = if >>>> desired. >>>>=20 >>>> > Tatsuyuki Ishi (9): >>>> > RISC-V: Fix local GOT and reloc size calculation for TLS. >>>> > RISC-V: Add TLSDESC reloc definitions. >>>> > RISC-V: Add assembly support for TLSDESC. >>>> > RISC-V: Define and use GOT entry size constants for TLS. >>>> > RISC-V: Initial ld.bfd support for TLSDESC. >>>> > RISC-V: Move STATIC_TLS handling into record_tls_type. >>>> > RISC-V: Unify TLS handling in check_relocs. >>>> > RISC-V: Add elf_link_hash_entry to relax_func args. >>>> > RISC-V: Introduce TLSDESC relaxation. >>>> > >>>> > bfd/bfd-in2.h | 4 + >>>> > bfd/elfnn-riscv.c | 341 ++++++++++++++++++-= -- >>>> > bfd/elfxx-riscv.c | 130 +++++++- >>>> > bfd/libbfd.h | 4 + >>>> > bfd/reloc.c | 8 + >>>> > gas/config/tc-riscv.c | 18 +- >>>> > gas/testsuite/gas/riscv/tlsdesc.d | 22 ++ >>>> > gas/testsuite/gas/riscv/tlsdesc.s | 24 ++ >>>> > include/elf/riscv.h | 21 +- >>>> > include/opcode/riscv.h | 1 + >>>> > ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp | 8 + >>>> > ld/testsuite/ld-riscv-elf/tls.d | 17 + >>>> > ld/testsuite/ld-riscv-elf/tls.s | 42 +++ >>>> > ld/testsuite/ld-riscv-elf/tlsbin.d | 7 + >>>> > ld/testsuite/ld-riscv-elf/tlslib.s | 6 + >>>> > opcodes/riscv-opc.c | 1 + >>>> > 16 files changed, 601 insertions(+), 53 deletions(-) >>>> > create mode 100644 gas/testsuite/gas/riscv/tlsdesc.d >>>> > create mode 100644 gas/testsuite/gas/riscv/tlsdesc.s >>>> > create mode 100644 ld/testsuite/ld-riscv-elf/tls.d >>>> > create mode 100644 ld/testsuite/ld-riscv-elf/tls.s >>>> > create mode 100644 ld/testsuite/ld-riscv-elf/tlsbin.d >>>> > create mode 100644 ld/testsuite/ld-riscv-elf/tlslib.s >>>> > >>>> > -- >>>> > 2.43.0 >>>> > >>>>=20 --Apple-Mail=_684A0397-34F5-4404-8997-95FEC93BF94A--