From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id 5B4933857716 for ; Thu, 14 Sep 2023 08:40:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5B4933857716 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1c3aa44c0faso1584005ad.1 for ; Thu, 14 Sep 2023 01:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694680842; x=1695285642; 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=jQ/+9Sd8IdvroiNScdQ0Fx7HOnvGcrzGWWZ+YVe28zg=; b=FLVltRXjTliwEpstUeUr4MR7iZagl08OvvGnuvrIuHqweiYTH950OFL4HJ0OcJZ3Gx VJGtQfb6iLAvAIYK/cubcExWcL1Ye2cusoAF4Du0U67awdv6Uioz79qBEaR1FV5kwsQj vTanzeTfnsgl7aKEGiIaPD3Ex3xmRT3n++LUOLeDAzZEd2ILYbOFcZCKoMyj4VZQHZsK geJNpSCELNl6wcBWtAq5TfnA75CrFN2GWQ+chXOr3Yz4VDnVqK17BqZo5EqPz4dtvznv si5kT56CDmSxaBC0BU8tnox36IjOmWwVl45BTJAaO1AKa6CcLX342f2n94od0rbBfWcB 3qNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694680842; x=1695285642; 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=jQ/+9Sd8IdvroiNScdQ0Fx7HOnvGcrzGWWZ+YVe28zg=; b=HtbAbgBmzQwd32bQTzHoahG7KCC0LGWdMYrIPSyi2u6fmz81MgPk3hFT7wo+ImLWJP Su8pcNtBr4pijQiiLGuYgIc+rB9nUwm/UwU+3JKBPKy6SMpglDwb/y/DLrUxo2pwaHGV UQ6clQGzWsudrAJ+z663WNX2TzONq6UqhNBZezdfxq+OdjrfumgMOgXQqU0Ra+kGSQSs hf0hhWszXio5AZljTS+2RT9dn1kJVuJt3rdFDd6/6wBoqBX9CDzZ00BVH3OrUTwMUWOk Dc1xGJ7VS8HN2obGSlVvZMp7gxNfxsg1tJU/8lzcTWd5KNuW3s7EC/ZzhPwa2d23pUNr VWtA== X-Gm-Message-State: AOJu0YwSvOCkMyUJYBuxNZNxO78/A96bzYRa2U1xxZL45UmGX/i2eemW 8QGN8b8dJvTpZbUJa9Ek9wI= X-Google-Smtp-Source: AGHT+IFDx7zpsZ/KltMGYOrzChI1arl/uPklPTOd5McYymyvTXuE1AbbFLfpbQSpEdkULdxMke8Hag== X-Received: by 2002:a17:902:e552:b0:1b8:2ba0:c9a8 with SMTP id n18-20020a170902e55200b001b82ba0c9a8mr5533365plf.2.1694680842338; Thu, 14 Sep 2023 01:40:42 -0700 (PDT) Received: from localhost (zz20184013906F627101.userreverse.dion.ne.jp. [111.98.113.1]) by smtp.gmail.com with ESMTPSA id 13-20020a170902c20d00b001b87d3e845bsm994740pll.149.2023.09.14.01.40.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 01:40:41 -0700 (PDT) From: Tatsuyuki Ishi To: ishitatsuyuki@gmail.com Cc: libc-alpha@sourceware.org, rui314@gmail.com, ruiu@bluewhale.systems, schwab@linux-m68k.org, adhemerval.zanella@linaro.org, andrew@sifive.com Subject: [PATCH v4 0/3] RISC-V: Implement TLS Descriptors. Date: Thu, 14 Sep 2023 17:40:30 +0900 Message-ID: <20230914084033.222120-1-ishitatsuyuki@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230817181228.122674-2-ishitatsuyuki@gmail.com> References: <20230817181228.122674-2-ishitatsuyuki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This patchset implements TLS Descriptors (TLSDESC) for RISC-V targets, per the ratified specification at [1]. The latest version of related binutils and gcc patches are at [2,3]. Passes binutils and gcc tests for rv64gc. For glibc I only tested elf/ as other subsystems sometimes doesn't work well under qemu. These are the regressions: - elf/tst-tls1-static - elf/tst-tls1-static-non-pie The TLSDESC relocations always needs to be handled by the dynamic linker, but the process is skipped for static executables. I will look into changing binutils to always relax TLSDESC to LE such that we can avoid this issue. This contribution is made on behalf of Blue Whale Systems, which has copyright assignment on file with the FSF. v2: Fix end-of-file newlines. v3: Fix segfaulting on the slow path of TLSDESC resolver. Fix handling of lazy relocations. v4: Fix compiler warnings. Fix fast path stack alignment pointed out by Andrew. Fix style issues pointed out by Adhemerval. Include 2 missing prerequisite commits. Update localplt list. [1]: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/373 [2]: https://inbox.sourceware.org/binutils/20230831171345.49052-1-ishitatsuyuki@gmail.com/ [3]: https://inbox.sourceware.org/gcc-patches/20230908104923.31154-1-ishitatsuyuki@gmail.com/ Tatsuyuki Ishi (3): RISC-V: Add include guard for dl-tls.h. RISC-V: Add TLSDESC reloc definitions. RISC-V: Implement TLS Descriptors. elf/elf.h | 5 + sysdeps/riscv/Makefile | 13 ++ sysdeps/riscv/dl-lookupcfg.h | 27 +++ sysdeps/riscv/dl-machine.h | 50 ++++- sysdeps/riscv/dl-tls.h | 4 + sysdeps/riscv/dl-tlsdesc.S | 205 ++++++++++++++++++++ sysdeps/riscv/dl-tlsdesc.h | 48 +++++ sysdeps/riscv/linkmap.h | 1 + sysdeps/riscv/tlsdesc.c | 38 ++++ sysdeps/riscv/tlsdesc.sym | 19 ++ sysdeps/unix/sysv/linux/riscv/localplt.data | 2 + 11 files changed, 411 insertions(+), 1 deletion(-) create mode 100644 sysdeps/riscv/dl-lookupcfg.h create mode 100644 sysdeps/riscv/dl-tlsdesc.S create mode 100644 sysdeps/riscv/dl-tlsdesc.h create mode 100644 sysdeps/riscv/tlsdesc.c create mode 100644 sysdeps/riscv/tlsdesc.sym -- 2.42.0