From patchwork Mon Nov 20 13:17:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tatsuyuki Ishi X-Patchwork-Id: 167256 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp54737vqb; Mon, 20 Nov 2023 08:32:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IEY+VdesJJBDSJafJm0crDFFBuEnPRjiuhsge/qv++g3zDfpxo3fREHKxOUji97RJZtYj4s X-Received: by 2002:ac8:5c01:0:b0:3f9:d1c3:cc45 with SMTP id i1-20020ac85c01000000b003f9d1c3cc45mr18825564qti.28.1700497977481; Mon, 20 Nov 2023 08:32:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700497977; cv=pass; d=google.com; s=arc-20160816; b=k2eqp0FAmFAqcc3sQZiJuq7QkHInuCoU2/vPRnTQDP9Wp/TcfSu3BISUUIwDDxujp0 fDRKK2132B0zqQupNyRxDuNOxtaAlkCY3c021RAdzaJvbpXiJeWOwrcVs3KomQ6X/Yhn rLLbiri+uJl5RhGr3OIC5C8FfpaYSyT+tkfNmy5wAoYoY6LP2BDU7TOswjTmtSIsI8KD Xxl/Dd61OcW2Pmzs0FJGV0urJVNu2bndn87Hh04Sfdn2GyH0fD+4Qbiw3WNyWI/ocH8m PzLAr1Zpgc/tlBAYbsPNNf9hPQLV1CgV/cRuAE7wN4iak2ndPda50D/P2QO8Xq0W0U78 JVjA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=w+Zn18jh4hi/l6MM9aC3VyDiUbXzRQZcZz3yl8Z0Lxc=; fh=FLKBA2ktXPIKbYU33X6z9OJd0Q9yBkAp7mwtYJaIcrc=; b=zCLD+mNOdbxRBQnfKcFWfd0e6dGrquMpJiLZjGzh07qsh6QVXJamBh7C1W2SbNVanB LxafiGrWV+XgRX/9sDoi9gxQ6FgcyyCWtOoKrcxmkO5rtaPxfYzXMYP1Jtqe7vRrPl+P ttAIT1C2q2kul4wpYb1lAEbqPrcEfH/GMHCo1YrS6xjZi0Jy7Dqn7/J+Jv/w7HaGtPeJ dRkwmOKcsfvHdx1mKbLr4OPFFI8Btb/LiROTkePhUeKWy5B+aJhyRWoW7CG0Ws1VnCWP Kypy20cfcfWBjTE+wIaOIQFTtSWNnogmWdXwavB9Kv9z+MIsY+edR8/GHiYleCS2TdO3 YtIw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VKT8otM7; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id i12-20020ac85c0c000000b00419785380efsi4622209qti.115.2023.11.20.08.32.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 08:32:57 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VKT8otM7; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 09D123882AC0 for ; Mon, 20 Nov 2023 13:18:01 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 56F483861852 for ; Mon, 20 Nov 2023 13:17:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 56F483861852 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 56F483861852 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700486253; cv=none; b=rUTU8LJYYNxdkRKklK6TYI4i8BId2Oj48s9R2B/6qYRv1CG2TvpJu3pNLAHGBYdMxKKxWV0W+Jff30lC5U1GLSIs7inN8SUXHjp7s4GokbGONrx4F7JDKwmLW0kPPiJG2KslbQ81H2gkVA7sQJw4kkOkiY8NLSAQL8en12MDl6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700486253; c=relaxed/simple; bh=+Ua1Xfz+DwDTTfdVIjpXof1jhu8NQwvrCydjgLplZzY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=m2+fBU88h5I2hqwKCCZbV6XOp1hadf49cFUFX6wuClNz1aEfRd71HrK/gPIdDFTjiN8rTKEFv1w3WZvocHg7dC+ZDUJ+XnHGAiO43DL03sXtIHex5MLI6Y2pxdF1HAXlJ83TpeJCBoacMq197cSt9DNDWOFUqHjv0gMj5TRnPPs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1cc4d306fe9so9990595ad.0 for ; Mon, 20 Nov 2023 05:17:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700486250; x=1701091050; darn=gcc.gnu.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=w+Zn18jh4hi/l6MM9aC3VyDiUbXzRQZcZz3yl8Z0Lxc=; b=VKT8otM7BPQYQctYBEXDiPtrb1g7aynFkjYcSkF2/FrQSbrUUyqgiQ0ctOz0NLfY2i fESmTotrSK26yelU0te1Rk78d/kmZX8xK/tsoj0gGnPEAA1u9DMmJv1ylAxoF1A16Hdu UkenAceuCRHS34cgdXlOBFLSi69Hg/Ru77BGNeXDI0MfWKAUbyzEFpj0yRaDrStQfBU5 4LI02C8tCRzQqeJO4GdCbfNR7MTKdIQ+6ghB1+bvKoQ5GRiuvwTx7L3QZ3IeBTrbhxLL hSN243LQhfNpEzZFHFq+6//OC5hoMCA47KYo/Uh9YVLA3r4SLU/BFzR3DixrGWdSl8Mp OPsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700486250; x=1701091050; 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=w+Zn18jh4hi/l6MM9aC3VyDiUbXzRQZcZz3yl8Z0Lxc=; b=MkKl7Gy7xLXyhnDOFtck7ZtWl5HTnEge/hbNNgn/WNhn6uMKLBlz7dpT0yod/XFGkT Daij9tq03NxK3HTJeSYbwfQzujNT+TzlUVZKlxz34OCNv0akMieG7mhmspFqOGKHMzOG ju83c34m2uH+HcY1kRckWwqrJT0XZ0yZjouGnOybc5wFHXpvtjhEweC7jQvqKVRVnjf1 J0UM8GI7+Eqk+JncGpCHpyR3OqaKw1wxs/1L60mxMmCdpmdvGElwrUNHGc6W2B2NNyxz M7dT9W9W6TIkGmxEVZRxZg0EEPmvmfsbCPfXm47KBdjF6K8drkmGVVqx6kPw/RB16gZt wkXA== X-Gm-Message-State: AOJu0YyI7i3HrIw+Z/XixUCbVkX0eajdYcRKUsuSHJrtHQupUdkz2lKy Bi1yPsp+z78nIqMcCKCdk+sCBbzBJNUtPut1 X-Received: by 2002:a17:903:32ca:b0:1cc:277f:b4f6 with SMTP id i10-20020a17090332ca00b001cc277fb4f6mr9304401plr.6.1700486249953; Mon, 20 Nov 2023 05:17:29 -0800 (PST) Received: from localhost (zz20184013906F627101.userreverse.dion.ne.jp. [111.98.113.1]) by smtp.gmail.com with ESMTPSA id c10-20020a170902c1ca00b001cc55bcd0c1sm6062913plc.177.2023.11.20.05.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 05:17:29 -0800 (PST) From: Tatsuyuki Ishi To: ishitatsuyuki@gmail.com Cc: gcc-patches@gcc.gnu.org, rui314@gmail.com, ruiu@bluewhale.systems, kito.cheng@gmail.com, jeffreyalaw@gmail.com Subject: [PATCH v3] RISC-V: Implement TLS Descriptors. Date: Mon, 20 Nov 2023 22:17:26 +0900 Message-ID: <20231120131726.52280-1-ishitatsuyuki@gmail.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20230817181308.122802-2-ishitatsuyuki@gmail.com> References: <20230817181308.122802-2-ishitatsuyuki@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774501063388314626 X-GMAIL-MSGID: 1783101367173928485 This implements TLS Descriptors (TLSDESC) as specified in [1]. The 4-instruction sequence is implemented as a single RTX insn for simplicity, but this can be revisited later if instruction scheduling or more flexible RA is desired. The default remains to be the traditional TLS model, but can be configured with --with_tls={trad,desc}. The choice can be revisited once toolchain and libc support ships. [1]: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/373. gcc/Changelog: * config/riscv/riscv.opt: Add -mtls-dialect to configure TLS flavor. * config.gcc: Add --with_tls configuration option to change the default TLS flavor. * config/riscv/riscv.h: Add TARGET_TLSDESC determined from -mtls-dialect and with_tls defaults. * config/riscv/riscv-opts.h: Define enum riscv_tls_type for the two TLS flavors. * config/riscv/riscv-protos.h: Define SYMBOL_TLSDESC symbol type. * config/riscv/riscv.md: Add instruction sequence for TLSDESC. * config/riscv/riscv.cc (riscv_symbol_insns): Add instruction sequence length data for TLSDESC. (riscv_legitimize_tls_address): Add lowering of TLSDESC. * doc/install.texi: Document --with-tls for RISC-V. * doc/invoke.texi: Document --mtls-dialect for RISC-V. --- No regression in gcc tests for rv64gc, tested alongside the binutils and glibc implementation. Tested with --with_tls=desc. v2: Add with_tls configuration option, and a few readability improvements. Added Changelog. v3: Add documentation per Kito's suggestion. Fix minor issues pointed out by Kito and Jeff. Thanks Kito Cheng and Jeff Law for review. I've considered gating this behind a GAS feature test, but it seems nontrivial especially for restricting the variants available at runtime. Since TLS descriptors is not selected by default, I've decided to leave it ungated. In other news, I have made some progress on binutils side, and I'll try to update the GAS / ld patch set with relaxation included, by the end of this month. gcc/config.gcc | 15 ++++++++++++++- gcc/config/riscv/riscv-opts.h | 6 ++++++ gcc/config/riscv/riscv-protos.h | 5 +++-- gcc/config/riscv/riscv.cc | 24 ++++++++++++++++++++---- gcc/config/riscv/riscv.h | 9 +++++++-- gcc/config/riscv/riscv.md | 21 ++++++++++++++++++++- gcc/config/riscv/riscv.opt | 14 ++++++++++++++ gcc/doc/install.texi | 3 +++ gcc/doc/invoke.texi | 13 ++++++++++++- 9 files changed, 99 insertions(+), 11 deletions(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index 415e0e1ebc5..2c1a7179b02 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2434,6 +2434,7 @@ riscv*-*-linux*) # Force .init_array support. The configure script cannot always # automatically detect that GAS supports it, yet we require it. gcc_cv_initfini_array=yes + with_tls=${with_tls:-trad} ;; riscv*-*-elf* | riscv*-*-rtems*) tm_file="elfos.h newlib-stdint.h ${tm_file} riscv/elf.h" @@ -2476,6 +2477,7 @@ riscv*-*-freebsd*) # Force .init_array support. The configure script cannot always # automatically detect that GAS supports it, yet we require it. gcc_cv_initfini_array=yes + with_tls=${with_tls:-trad} ;; loongarch*-*-linux*) @@ -4566,7 +4568,7 @@ case "${target}" in ;; riscv*-*-*) - supported_defaults="abi arch tune riscv_attribute isa_spec" + supported_defaults="abi arch tune riscv_attribute isa_spec tls" case "${target}" in riscv-* | riscv32*) xlen=32 ;; @@ -4694,6 +4696,17 @@ case "${target}" in ;; esac fi + # Handle --with-tls. + case "$with_tls" in + "" \ + | trad | desc) + # OK + ;; + *) + echo "Unknown TLS method used in --with-tls=$with_tls" 1>&2 + exit 1 + ;; + esac # Handle --with-multilib-list. if test "x${with_multilib_list}" != xdefault; then diff --git a/gcc/config/riscv/riscv-opts.h b/gcc/config/riscv/riscv-opts.h index 378a17699cd..db03f35430a 100644 --- a/gcc/config/riscv/riscv-opts.h +++ b/gcc/config/riscv/riscv-opts.h @@ -319,4 +319,10 @@ enum riscv_entity #define TARGET_VECTOR_VLS \ (TARGET_VECTOR && riscv_autovec_preference == RVV_SCALABLE) +/* TLS types. */ +enum riscv_tls_type { + TLS_TRADITIONAL, + TLS_DESCRIPTORS +}; + #endif /* ! GCC_RISCV_OPTS_H */ diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h index 472c00dc439..9b7471f7591 100644 --- a/gcc/config/riscv/riscv-protos.h +++ b/gcc/config/riscv/riscv-protos.h @@ -33,9 +33,10 @@ enum riscv_symbol_type { SYMBOL_TLS, SYMBOL_TLS_LE, SYMBOL_TLS_IE, - SYMBOL_TLS_GD + SYMBOL_TLS_GD, + SYMBOL_TLSDESC, }; -#define NUM_SYMBOL_TYPES (SYMBOL_TLS_GD + 1) +#define NUM_SYMBOL_TYPES (SYMBOL_TLSDESC + 1) /* Classifies an address. diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 49062bef9fc..c158e224aaa 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -799,6 +799,7 @@ static int riscv_symbol_insns (enum riscv_symbol_type type) case SYMBOL_ABSOLUTE: return 2; /* LUI + the reference. */ case SYMBOL_PCREL: return 2; /* AUIPC + the reference. */ case SYMBOL_TLS_LE: return 3; /* LUI + ADD TP + the reference. */ + case SYMBOL_TLSDESC: return 6; /* 4-instruction call + ADD TP + the reference. */ case SYMBOL_GOT_DISP: return 3; /* AUIPC + LD GOT + the reference. */ default: gcc_unreachable (); } @@ -1734,7 +1735,7 @@ riscv_call_tls_get_addr (rtx sym, rtx result) static rtx riscv_legitimize_tls_address (rtx loc) { - rtx dest, tp, tmp; + rtx dest, tp, tmp, a0; enum tls_model model = SYMBOL_REF_TLS_MODEL (loc); #if 0 @@ -1750,9 +1751,24 @@ riscv_legitimize_tls_address (rtx loc) /* Rely on section anchors for the optimization that LDM TLS provides. The anchor's address is loaded with GD TLS. */ case TLS_MODEL_GLOBAL_DYNAMIC: - tmp = gen_rtx_REG (Pmode, GP_RETURN); - dest = gen_reg_rtx (Pmode); - emit_libcall_block (riscv_call_tls_get_addr (loc, tmp), dest, tmp, loc); + if (TARGET_TLSDESC) + { + static unsigned seqno; + tp = gen_rtx_REG (Pmode, THREAD_POINTER_REGNUM); + a0 = gen_rtx_REG (Pmode, GP_ARG_FIRST); + dest = gen_reg_rtx (Pmode); + + emit_insn (gen_tlsdesc (Pmode, loc, GEN_INT (seqno))); + emit_insn (gen_add3_insn (dest, a0, tp)); + seqno++; + } + else + { + tmp = gen_rtx_REG (Pmode, GP_RETURN); + dest = gen_reg_rtx (Pmode); + emit_libcall_block (riscv_call_tls_get_addr (loc, tmp), dest, tmp, + loc); + } break; case TLS_MODEL_INITIAL_EXEC: diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h index e18a0081297..faea78f5f4c 100644 --- a/gcc/config/riscv/riscv.h +++ b/gcc/config/riscv/riscv.h @@ -59,6 +59,7 @@ extern const char *riscv_multi_lib_check (int argc, const char **argv); --with-abi is ignored if -mabi is specified. --with-tune is ignored if -mtune or -mcpu is specified. --with-isa-spec is ignored if -misa-spec is specified. + --with-tls is ignored if -mtls-dialect is specified. But using default -march/-mtune value if -mcpu don't have valid option. */ #define OPTION_DEFAULT_SPECS \ @@ -68,8 +69,9 @@ extern const char *riscv_multi_lib_check (int argc, const char **argv); {"arch", "%{!march=*:" \ " %{!mcpu=*:-march=%(VALUE)}" \ " %{mcpu=*:%:riscv_expand_arch_from_cpu(%* %(VALUE))}}" }, \ - {"abi", "%{!mabi=*:-mabi=%(VALUE)}" }, \ - {"isa_spec", "%{!misa-spec=*:-misa-spec=%(VALUE)}" }, \ + {"abi", "%{!mabi=*:-mabi=%(VALUE)}" }, \ + {"isa_spec", "%{!misa-spec=*:-misa-spec=%(VALUE)}" }, \ + {"tls", "%{!mtls-dialect=*:-mtls-dialect=%(VALUE)}"}, \ #ifdef IN_LIBGCC2 #undef TARGET_64BIT @@ -1122,4 +1124,7 @@ extern void riscv_remove_unneeded_save_restore_calls (void); #define OPTIMIZE_MODE_SWITCHING(ENTITY) (TARGET_VECTOR) #define NUM_MODES_FOR_MODE_SWITCHING {VXRM_MODE_NONE, riscv_vector::FRM_NONE} +/* Check TLS Descriptors mechanism is selected. */ +#define TARGET_TLSDESC (riscv_tls_dialect == TLS_DESCRIPTORS) + #endif /* ! GCC_RISCV_H */ diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index b456fa6abb3..7c66c64b893 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -47,7 +47,7 @@ UNSPEC_TLS_LE UNSPEC_TLS_IE UNSPEC_TLS_GD - + UNSPEC_TLSDESC ;; High part of PC-relative address. UNSPEC_AUIPC @@ -121,6 +121,7 @@ (T1_REGNUM 6) (S0_REGNUM 8) (S1_REGNUM 9) + (A0_REGNUM 10) (S2_REGNUM 18) (S3_REGNUM 19) (S4_REGNUM 20) @@ -1869,6 +1870,24 @@ [(set_attr "got" "load") (set_attr "mode" "")]) +(define_insn "@tlsdesc" + [(set (reg:P A0_REGNUM) + (unspec:P + [(match_operand:P 0 "symbolic_operand" "") + (match_operand:P 1 "const_int_operand")] + UNSPEC_TLSDESC)) + (clobber (reg:P T0_REGNUM))] + "TARGET_TLSDESC" + { + return ".LT%1: auipc\ta0, %%tlsdesc_hi(%0)\;" + "\tt0,%%tlsdesc_load_lo(.LT%1)(a0)\;" + "addi\ta0,a0,%%tlsdesc_add_lo(.LT%1)\;" + "jalr\tt0,t0,%%tlsdesc_call(.LT%1)"; + } + [(set_attr "type" "multi") + (set_attr "length" "16") + (set_attr "mode" "")]) + (define_insn "auipc" [(set (match_operand:P 0 "register_operand" "=r") (unspec:P diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt index 6304efebfd5..9ba690f8497 100644 --- a/gcc/config/riscv/riscv.opt +++ b/gcc/config/riscv/riscv.opt @@ -311,3 +311,17 @@ Enum(riscv_autovec_lmul) String(m8) Value(RVV_M8) -param=riscv-autovec-lmul= Target RejectNegative Joined Enum(riscv_autovec_lmul) Var(riscv_autovec_lmul) Init(RVV_M1) -param=riscv-autovec-lmul= Set the RVV LMUL of auto-vectorization in the RISC-V port. + +Enum +Name(tls_type) Type(enum riscv_tls_type) +The possible TLS dialects: + +EnumValue +Enum(tls_type) String(trad) Value(TLS_TRADITIONAL) + +EnumValue +Enum(tls_type) String(desc) Value(TLS_DESCRIPTORS) + +mtls-dialect= +Target RejectNegative Joined Enum(tls_type) Var(riscv_tls_dialect) Init(TLS_TRADITIONAL) Save +Specify TLS dialect. diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index e099cd0b568..6ee533c0a40 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -1174,6 +1174,9 @@ Specify the default TLS dialect, for systems were there is a choice. For ARM targets, possible values for @var{dialect} are @code{gnu} or @code{gnu2}, which select between the original GNU dialect and the GNU TLS descriptor-based dialect. +For RISC-V targets, possible values for @var{dialect} are @code{trad} or +@code{desc}, which select between the traditional GNU dialect and the GNU TLS +descriptor-based dialect. @item --enable-multiarch Specify whether to enable or disable multiarch support. The default is diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index f2c1067ab7d..77b82c46311 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1234,7 +1234,8 @@ See RS/6000 and PowerPC Options. -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} -mstack-protector-guard-offset=@var{offset} -mcsr-check -mno-csr-check --minline-atomics -mno-inline-atomics} +-minline-atomics -mno-inline-atomics +-mtls-dialect=desc -mtls-dialect=trad} @emph{RL78 Options} @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @@ -29403,6 +29404,16 @@ which register to use as base register for reading the canary, and from what offset from that base register. There is no default register or offset as this is entirely for use within the Linux kernel. + +@opindex mtls-dialect=desc +@item -mtls-dialect=desc +Use TLS descriptors as the thread-local storage mechanism for dynamic accesses +of TLS variables. + +@opindex mtls-dialect=trad +@item -mtls-dialect=trad +Use traditional TLS as the thread-local storage mechanism for dynamic accesses +of TLS variables. This is the default. @end table @node RL78 Options