From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by sourceware.org (Postfix) with ESMTPS id EE6F63858D3C for ; Wed, 13 Dec 2023 00:27:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EE6F63858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dabbelt.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dabbelt.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EE6F63858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::12d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702427242; cv=none; b=aB53jEkjv4Y1D0wSjWl69pD7Aa1XfyTGCqSfdM27u8ZqGWrwlsUfW1tEvWTz8t8tnq8W5hjkXYdv5v3sjc6nBdUpe8gL+Xv9p6/SVGt22ISqFZpJpLnixajxmATLBds3yN3ZqXQWtPQ+QdgsBvcEiaGfctyolomJwqOTK7RVc+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702427242; c=relaxed/simple; bh=mzIksWFaAKZt+XvXg7NRPGDBodzktxuFjStGbJHt+Eo=; h=DKIM-Signature:Date:Subject:From:To:Message-ID:Mime-Version; b=q88fC4swZzO+sMTjixI1duqQW+Ug1mscOScvJ4ikrl8hgy0nMd5hUeVHP2q1Ni8AgeOkTYP3r7gYmC4cM3djeloPID4VRenbspnjtXzAHdfEzkbgR/qtTMQiiRRqO0OhRJDVkYiNA2YfKd4xQJsi1NQeeVqhnxxLLeW5q49PxGI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-35d72bc5cf2so25486875ab.1 for ; Tue, 12 Dec 2023 16:27:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20230601.gappssmtp.com; s=20230601; t=1702427239; x=1703032039; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=zY4KgaUPQv+V17LTjB11vykqiSKnruHZ3x3PC+rEUfA=; b=vXSBBoSUNcqSOOp7SowAYhNgiVnsZoHySeKcMuysJsOd2l/N/Bl+FDmX9dT0Bikd8d OJOyTh8UfgqNwBTXyMKcGr7wK3v/wCCP98/FN7EoGx1B5SS8LayL+LaUh486CiD1ZHeC L+4D0rdz22EYJFJ43A6c8SNzwbwO9WEcI+5IHNQ6xBy6Cdbje+AHZOFhS2veIXAp73X/ 72QzuLagoW06sp4+LTF9C2N1G9yUZa1zfLHAbT2QGCm966lzpQmnCRrWAExaY+Lbvjpt QdRKUTKWCnozMPGPKF11bY1nwpM3OOhgR458kiWAqc/t0gyF5EH1reVVnHIdHvuvrN+5 dmmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702427239; x=1703032039; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zY4KgaUPQv+V17LTjB11vykqiSKnruHZ3x3PC+rEUfA=; b=YMiV3LacEwyOaRrgJJfiCWIcR12fIDJpmk/0XAqi/H6ldAWYaC0mJ3C8navmImIOae Vweec6A6mhElPQujpK0nCukn5x0PC9qynCR9JnVu9pRlhqsRbBHCoxmYYVTTwMDpVuk0 N/ea6CjS57u4hBTSTM//AdEcnK1s/WAQ3/hoemLe6XD4zgs32DqHXRWy83Ny723Rjs1r lOLPL+zDUFTLxmENO4w71xcCdghsXS6OpB/9iNWhdT66StOfbYOP9nA3qvKjMRpCoADz /qdsHD4rs3ACMYEyEyyaV/+SYOj8n8TLHyEvD3kiDWj0IlPUwhQ74zX8PNVwriylIrlX a2lA== X-Gm-Message-State: AOJu0YwZANpRGw2iGVvCmxAQq/7HTrYO2QHsj2XAL8tJvmsTtxpL9Efz oAEqQjO1/XtOK+ujmL2gAPWbOg== X-Google-Smtp-Source: AGHT+IEIH5Js5bEliEqU7pm8XLbkWN/RGqMVXpbH2nxB7uJL7SMOTO/plXjmCVSAYfCCO6E/WYjgDg== X-Received: by 2002:a92:c267:0:b0:35d:65fd:184b with SMTP id h7-20020a92c267000000b0035d65fd184bmr11166743ild.4.1702427239058; Tue, 12 Dec 2023 16:27:19 -0800 (PST) Received: from localhost ([12.44.203.122]) by smtp.gmail.com with ESMTPSA id m6-20020a170902db0600b001cfce833b6fsm9162023plx.204.2023.12.12.16.27.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 16:27:18 -0800 (PST) Date: Tue, 12 Dec 2023 16:27:18 -0800 (PST) X-Google-Original-Date: Tue, 12 Dec 2023 16:27:16 PST (-0800) Subject: Re: [PATCH v3 0/9] RISC-V: Implement TLS Descriptors. In-Reply-To: CC: nelson@rivosinc.com, lazyparser@gmail.com, ishitatsuyuki@gmail.com, binutils@sourceware.org, rui314@gmail.com, ruiu@bluewhale.systems From: Palmer Dabbelt To: i@maskray.me Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,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: On Wed, 06 Dec 2023 19:35:00 PST (-0800), i@maskray.me wrote: > On Tue, Dec 5, 2023 at 4:33 PM Nelson Chu wrote: >> >> 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 thinks this is an urgent matter, please feel free to let us know, so we can switch to see these first. > > 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... > >> On Wed, Dec 6, 2023 at 12:44 AM Tatsuyuki Ishi wrote: >>> >>> > On Nov 28, 2023, at 17:51, Tatsuyuki Ishi wrote: >>> > >>> > This patchset implements TLS Descriptors (TLSDESC) for RISC-V targets, 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=elf >>> > With both -mtls-dialect=desc 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 messages. >>> > v3: Add relaxation support. This fixes tst-tls1-static in glibc. >>> >>> Would anyone like to review this? This is a prerequisite for the GCC-side >>> implementation to be useful (especially the gas part). >> >> >> For these huge features, gcc/binutils/glibc should be reviewed at the same time, since all the stuff should be bound and tested together, so "prerequisite" shouldn't apply here ;) Ya, I agree. It's super hard to review stuff like this without seeing all the code, doubly so now that the psABI has turned into a wasteland for discussions. >> >> Thanks >> Nelson > > 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=__thread&literal=1). Do you guys have a pointer to the glibc code? I can't find it, but I'm happy to poke it (or maybe find someone else who to poke it...). > >>> >>> >>> I can split up the series into bug fix / refactors and actual changes if >>> desired. >>> >>> > 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 >>> > >>>