From: Nelson Chu <nelson@rivosinc.com>
To: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
Cc: binutils@sourceware.org, i@maskray.me, rui314@gmail.com,
ruiu@bluewhale.systems
Subject: Re: [PATCH v3 2/9] RISC-V: Add TLSDESC reloc definitions.
Date: Mon, 19 Feb 2024 08:49:04 +0800 [thread overview]
Message-ID: <CAPpQWtDbodkRvmwQjwY-2a12t9sthV9Sz+AZxt8Scwh2TK9vZw@mail.gmail.com> (raw)
In-Reply-To: <20231128085109.28422-3-ishitatsuyuki@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 8648 bytes --]
On Tue, Nov 28, 2023 at 4:51 PM Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
wrote:
> bfd/
> * elfxx-riscv.c: Add 5 TLSDESC reloc descriptions.
> * reloc.c: Likewise.
> * libbfd.h: Regenerate.
> * bfd-in2.h: Regenerate.
> include/
> * elf/riscv.h: Add 5 TLSDESC reloc descriptions.
> ---
> bfd/bfd-in2.h | 4 +++
> bfd/elfxx-riscv.c | 75 ++++++++++++++++++++++++++++++++++++++++++++-
> bfd/libbfd.h | 4 +++
> bfd/reloc.c | 8 +++++
> include/elf/riscv.h | 5 +++
> 5 files changed, 95 insertions(+), 1 deletion(-)
>
> diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
> index 040d5560cdf..9bc6b9885ff 100644
> --- a/bfd/bfd-in2.h
> +++ b/bfd/bfd-in2.h
> @@ -5407,6 +5407,10 @@ enum bfd_reloc_code_real
> BFD_RELOC_RISCV_TLS_DTPREL64,
> BFD_RELOC_RISCV_TLS_TPREL32,
> BFD_RELOC_RISCV_TLS_TPREL64,
> + BFD_RELOC_RISCV_TLSDESC_HI20,
> + BFD_RELOC_RISCV_TLSDESC_LOAD_LO12,
> + BFD_RELOC_RISCV_TLSDESC_ADD_LO12,
> + BFD_RELOC_RISCV_TLSDESC_CALL,
> BFD_RELOC_RISCV_ALIGN,
> BFD_RELOC_RISCV_RVC_BRANCH,
> BFD_RELOC_RISCV_RVC_JUMP,
> diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
> index 567631e7d96..65d676b06b1 100644
> --- a/bfd/elfxx-riscv.c
> +++ b/bfd/elfxx-riscv.c
> @@ -218,7 +218,20 @@ static reloc_howto_type howto_table[] =
> MINUS_ONE, /* dst_mask */
> false), /* pcrel_offset */
>
> - EMPTY_HOWTO (12),
> + HOWTO (R_RISCV_TLSDESC, /* type */
> + 0, /* rightshift */
> + 0, /* size is handled by dynamic
> linker */
> + 0, /* bitsize */
> + false, /* pc_relative */
> + 0, /* bitpos */
> + complain_overflow_dont, /* complain_on_overflow */
> + bfd_elf_generic_reloc, /* special_function */
> + "R_RISCV_TLSDESC", /* name */
> + false, /* partial_inplace */
> + 0, /* src_mask */
> + MINUS_ONE, /* dst_mask */
> + false), /* pcrel_offset */
> +
> EMPTY_HOWTO (13),
> EMPTY_HOWTO (14),
> EMPTY_HOWTO (15),
> @@ -808,6 +821,62 @@ static reloc_howto_type howto_table[] =
> 0, /* src_mask */
> 0, /* dst_mask */
> false), /* pcrel_offset */
> +
> + HOWTO (R_RISCV_TLSDESC_HI20, /* type */
> + 0, /* rightshift */
> + 4, /* size */
> + 32, /* bitsize */
> + true, /* pc_relative */
> + 0, /* bitpos */
> + complain_overflow_signed, /* complain_on_overflow */
> + bfd_elf_generic_reloc, /* special_function */
> + "R_RISCV_TLSDESC_HI20", /* name */
> + true, /* partial_inplace */
> + 0, /* src_mask */
> + ENCODE_UTYPE_IMM (-1U), /* dst_mask */
> + false), /* pcrel_offset */
>
complain_overflow_dont?
> + HOWTO (R_RISCV_TLSDESC_LOAD_LO12, /* type */
> + 0, /* rightshift */
> + 4, /* size */
> + 32, /* bitsize */
> + false, /* pc_relative */
> + 0, /* bitpos */
> + complain_overflow_signed, /* complain_on_overflow */
> + bfd_elf_generic_reloc, /* special_function */
> + "R_RISCV_TLSDESC_LOAD_LO12", /* name */
> + false, /* partial_inplace */
> + 0, /* src_mask */
> + ENCODE_ITYPE_IMM (-1U), /* dst_mask */
> + false), /* pcrel_offset */
>
Likewise.
> + HOWTO (R_RISCV_TLSDESC_ADD_LO12, /* type */
> + 0, /* rightshift */
> + 4, /* size */
> + 32, /* bitsize */
> + false, /* pc_relative */
> + 0, /* bitpos */
> + complain_overflow_signed, /* complain_on_overflow */
> + bfd_elf_generic_reloc, /* special_function */
> + "R_RISCV_TLSDESC_ADD_LO12", /* name */
> + false, /* partial_inplace */
> + 0, /* src_mask */
> + ENCODE_ITYPE_IMM (-1U), /* dst_mask */
> + false), /* pcrel_offset */
>
Likewise.
> + HOWTO (R_RISCV_TLSDESC_CALL, /* type */
> + 0, /* rightshift */
> + 0, /* size */
> + 0, /* bitsize */
> + false, /* pc_relative */
> + 0, /* bitpos */
> + complain_overflow_dont, /* complain_on_overflow */
> + bfd_elf_generic_reloc, /* special_function */
> + "R_RISCV_TLSDESC_CALL", /* name */
> + false, /* partial_inplace */
> + 0, /* src_mask */
> + ENCODE_ITYPE_IMM (-1U), /* dst_mask */
> + false) /* pcrel_offset */
> };
>
> static reloc_howto_type howto_table_internal[] =
> @@ -935,6 +1004,10 @@ static const struct elf_reloc_map riscv_reloc_map[] =
> { BFD_RELOC_RISCV_TPREL_LO12_I, R_RISCV_TPREL_LO12_I },
> { BFD_RELOC_RISCV_TLS_GOT_HI20, R_RISCV_TLS_GOT_HI20 },
> { BFD_RELOC_RISCV_TLS_GD_HI20, R_RISCV_TLS_GD_HI20 },
> + { BFD_RELOC_RISCV_TLSDESC_HI20, R_RISCV_TLSDESC_HI20 },
> + { BFD_RELOC_RISCV_TLSDESC_LOAD_LO12, R_RISCV_TLSDESC_LOAD_LO12 },
> + { BFD_RELOC_RISCV_TLSDESC_ADD_LO12, R_RISCV_TLSDESC_ADD_LO12 },
> + { BFD_RELOC_RISCV_TLSDESC_CALL, R_RISCV_TLSDESC_CALL },
> { BFD_RELOC_RISCV_ALIGN, R_RISCV_ALIGN },
> { BFD_RELOC_RISCV_RVC_BRANCH, R_RISCV_RVC_BRANCH },
> { BFD_RELOC_RISCV_RVC_JUMP, R_RISCV_RVC_JUMP },
> diff --git a/bfd/libbfd.h b/bfd/libbfd.h
> index cc432677a81..919b63d51a1 100644
> --- a/bfd/libbfd.h
> +++ b/bfd/libbfd.h
> @@ -2400,6 +2400,10 @@ static const char *const
> bfd_reloc_code_real_names[] = { "@@uninitialized@@",
> "BFD_RELOC_RISCV_TLS_DTPREL64",
> "BFD_RELOC_RISCV_TLS_TPREL32",
> "BFD_RELOC_RISCV_TLS_TPREL64",
> + "BFD_RELOC_RISCV_TLSDESC_HI20",
> + "BFD_RELOC_RISCV_TLSDESC_LOAD_LO12",
> + "BFD_RELOC_RISCV_TLSDESC_ADD_LO12",
> + "BFD_RELOC_RISCV_TLSDESC_CALL",
> "BFD_RELOC_RISCV_ALIGN",
> "BFD_RELOC_RISCV_RVC_BRANCH",
> "BFD_RELOC_RISCV_RVC_JUMP",
> diff --git a/bfd/reloc.c b/bfd/reloc.c
> index 93ebad879e0..345f444d17a 100644
> --- a/bfd/reloc.c
> +++ b/bfd/reloc.c
> @@ -4984,6 +4984,14 @@ ENUMX
> BFD_RELOC_RISCV_TLS_TPREL32
> ENUMX
> BFD_RELOC_RISCV_TLS_TPREL64
> +ENUMX
> + BFD_RELOC_RISCV_TLSDESC_HI20
> +ENUMX
> + BFD_RELOC_RISCV_TLSDESC_LOAD_LO12
> +ENUMX
> + BFD_RELOC_RISCV_TLSDESC_ADD_LO12
> +ENUMX
> + BFD_RELOC_RISCV_TLSDESC_CALL
> ENUMX
> BFD_RELOC_RISCV_ALIGN
> ENUMX
> diff --git a/include/elf/riscv.h b/include/elf/riscv.h
> index 56d419c665b..7f5c0407ac8 100644
> --- a/include/elf/riscv.h
> +++ b/include/elf/riscv.h
> @@ -44,6 +44,7 @@ START_RELOC_NUMBERS (elf_riscv_reloc_type)
> RELOC_NUMBER (R_RISCV_TLS_DTPREL64, 9)
> RELOC_NUMBER (R_RISCV_TLS_TPREL32, 10)
> RELOC_NUMBER (R_RISCV_TLS_TPREL64, 11)
> + RELOC_NUMBER (R_RISCV_TLSDESC, 12)
>
> /* Relocation types not used by the dynamic linker. */
> RELOC_NUMBER (R_RISCV_BRANCH, 16)
> @@ -90,6 +91,10 @@ START_RELOC_NUMBERS (elf_riscv_reloc_type)
> /* Reserved 59 for R_RISCV_PLT32. */
> RELOC_NUMBER (R_RISCV_SET_ULEB128, 60)
> RELOC_NUMBER (R_RISCV_SUB_ULEB128, 61)
> + RELOC_NUMBER (R_RISCV_TLSDESC_HI20, 62)
> + RELOC_NUMBER (R_RISCV_TLSDESC_LOAD_LO12, 63)
> + RELOC_NUMBER (R_RISCV_TLSDESC_ADD_LO12, 64)
> + RELOC_NUMBER (R_RISCV_TLSDESC_CALL, 65)
> END_RELOC_NUMBERS (R_RISCV_max)
>
> /* Internal relocations used exclusively by the relaxation pass. */
> --
> 2.43.0
>
>
next prev parent reply other threads:[~2024-02-19 0:49 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-17 18:08 [PATCH 0/4] RISC-V: Implement TLS Descriptors Tatsuyuki Ishi
2023-08-17 18:08 ` [PATCH 1/4] RISC-V: Add TLSDESC reloc definitions Tatsuyuki Ishi
2023-08-17 18:08 ` [PATCH 2/4] RISC-V: Add assembly support for TLSDESC Tatsuyuki Ishi
2023-08-17 18:08 ` [PATCH 3/4] RISC-V: Define and use GOT entry size constants for TLS Tatsuyuki Ishi
2023-08-17 18:08 ` [PATCH 4/4] RISC-V: Initial ld.bfd support for TLSDESC Tatsuyuki Ishi
2023-08-18 0:22 ` [PATCH 0/4] RISC-V: Implement TLS Descriptors Nelson Chu
2023-08-18 7:13 ` Fangrui Song
2023-08-31 17:13 ` [PATCH v2 0/5] " Tatsuyuki Ishi
2023-08-31 17:13 ` [PATCH v2 1/5] RISC-V: Fix local GOT and reloc size calculation for TLS Tatsuyuki Ishi
2024-02-21 0:49 ` Nelson Chu
2024-02-21 7:04 ` Nelson Chu
2023-08-31 17:13 ` [PATCH v2 2/5] RISC-V: Add TLSDESC reloc definitions Tatsuyuki Ishi
2023-08-31 17:13 ` [PATCH v2 3/5] RISC-V: Add assembly support for TLSDESC Tatsuyuki Ishi
2023-08-31 17:13 ` [PATCH v2 4/5] RISC-V: Define and use GOT entry size constants for TLS Tatsuyuki Ishi
2023-08-31 17:13 ` [PATCH v2 5/5] RISC-V: Initial ld.bfd support for TLSDESC Tatsuyuki Ishi
2023-11-28 8:51 ` [PATCH v3 0/9] RISC-V: Implement TLS Descriptors Tatsuyuki Ishi
2023-11-28 8:51 ` [PATCH v3 1/9] RISC-V: Fix local GOT and reloc size calculation for TLS Tatsuyuki Ishi
2023-11-28 8:51 ` [PATCH v3 2/9] RISC-V: Add TLSDESC reloc definitions Tatsuyuki Ishi
2024-02-19 0:49 ` Nelson Chu [this message]
2024-02-20 17:28 ` Tatsuyuki Ishi
2023-11-28 8:51 ` [PATCH v3 3/9] RISC-V: Add assembly support for TLSDESC Tatsuyuki Ishi
2024-02-19 1:44 ` Nelson Chu
2024-02-20 17:29 ` Tatsuyuki Ishi
2023-11-28 8:51 ` [PATCH v3 4/9] RISC-V: Define and use GOT entry size constants for TLS Tatsuyuki Ishi
2024-02-19 1:57 ` Nelson Chu
2024-02-20 17:32 ` Tatsuyuki Ishi
2023-11-28 8:51 ` [PATCH v3 5/9] RISC-V: Initial ld.bfd support for TLSDESC Tatsuyuki Ishi
2024-02-19 4:33 ` Nelson Chu
2024-02-20 17:36 ` Tatsuyuki Ishi
2023-11-28 8:51 ` [PATCH v3 6/9] RISC-V: Move STATIC_TLS handling into record_tls_type Tatsuyuki Ishi
2023-11-28 8:51 ` [PATCH v3 7/9] RISC-V: Unify TLS handling in check_relocs Tatsuyuki Ishi
2023-11-28 8:51 ` [PATCH v3 8/9] RISC-V: Add elf_link_hash_entry to relax_func args Tatsuyuki Ishi
2023-11-28 8:51 ` [PATCH v3 9/9] RISC-V: Introduce TLSDESC relaxation Tatsuyuki Ishi
2023-12-05 16:44 ` [PATCH v3 0/9] RISC-V: Implement TLS Descriptors Tatsuyuki Ishi
2023-12-06 0:33 ` Nelson Chu
2023-12-07 3:35 ` Fangrui Song
2023-12-13 0:27 ` Palmer Dabbelt
2023-12-13 1:53 ` Tatsuyuki Ishi
2024-01-27 0:57 ` Fangrui Song
2024-02-20 17:55 ` [PATCH v4 " Tatsuyuki Ishi
2024-02-20 17:55 ` [PATCH v4 1/9] RISC-V: Fix local GOT and reloc size calculation for TLS Tatsuyuki Ishi
2024-02-20 17:55 ` [PATCH v4 2/9] RISC-V: Add TLSDESC reloc definitions Tatsuyuki Ishi
2024-02-20 17:55 ` [PATCH v4 3/9] RISC-V: Add assembly support for TLSDESC Tatsuyuki Ishi
2024-02-20 17:55 ` [PATCH v4 4/9] RISC-V: Define and use GOT entry size constants for TLS Tatsuyuki Ishi
2024-02-20 17:55 ` [PATCH v4 5/9] RISC-V: Initial ld.bfd support for TLSDESC Tatsuyuki Ishi
2024-02-20 17:55 ` [PATCH v4 6/9] RISC-V: Move STATIC_TLS handling into record_tls_type Tatsuyuki Ishi
2024-02-20 17:55 ` [PATCH v4 7/9] RISC-V: Unify TLS handling in check_relocs Tatsuyuki Ishi
2024-02-20 17:55 ` [PATCH v4 8/9] RISC-V: Add elf_link_hash_entry to relax_func args Tatsuyuki Ishi
2024-02-20 17:55 ` [PATCH v4 9/9] RISC-V: Introduce TLSDESC relaxation Tatsuyuki Ishi
2024-02-29 7:06 ` [PATCH v4 0/9] RISC-V: Implement TLS Descriptors Nelson Chu
2024-02-29 7:14 ` Tatsuyuki Ishi
2024-03-29 6:22 ` Tatsuyuki Ishi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPpQWtDbodkRvmwQjwY-2a12t9sthV9Sz+AZxt8Scwh2TK9vZw@mail.gmail.com \
--to=nelson@rivosinc.com \
--cc=binutils@sourceware.org \
--cc=i@maskray.me \
--cc=ishitatsuyuki@gmail.com \
--cc=rui314@gmail.com \
--cc=ruiu@bluewhale.systems \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).