[v4,0/9] RISC-V: Implement TLS Descriptors.

Message ID 20240220175556.304692-1-ishitatsuyuki@gmail.com
Headers
Series RISC-V: Implement TLS Descriptors. |

Message

Tatsuyuki Ishi Feb. 20, 2024, 5:55 p.m. UTC
  This patchset implements TLS Descriptors (TLSDESC) for RISC-V targets, per
the specification (merged) at [1].

Tested on rv32gc & 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.
v4: Fix issues pointed out in review (thanks Nelson).

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                          | 352 ++++++++++++++++++---
 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          |  36 +++
 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, 623 insertions(+), 56 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
  

Comments

Nelson Chu Feb. 29, 2024, 7:06 a.m. UTC | #1
On Wed, Feb 21, 2024 at 1:56 AM Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
wrote:

> This patchset implements TLS Descriptors (TLSDESC) for RISC-V targets, per
> the specification (merged) at [1].
>
> Tested on rv32gc & 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.
> v4: Fix issues pointed out in review (thanks Nelson).
>
> 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.
>

Committed the above five patches since reviewed and passed the gcc/binutils
regressions of riscv-gnu-toolchain.


>   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.
>

Ongoing...

Thanks
Nelson
  
Tatsuyuki Ishi Feb. 29, 2024, 7:14 a.m. UTC | #2
> On Feb 29, 2024, at 16:06, Nelson Chu <nelson@rivosinc.com> wrote:
> 
> 
> 
> On Wed, Feb 21, 2024 at 1:56 AM Tatsuyuki Ishi <ishitatsuyuki@gmail.com <mailto:ishitatsuyuki@gmail.com>> wrote:
>> This patchset implements TLS Descriptors (TLSDESC) for RISC-V targets, per
>> the specification (merged) at [1].
>> 
>> Tested on rv32gc & 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.
>> v4: Fix issues pointed out in review (thanks Nelson).
>> 
>> 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.
> 
> Committed the above five patches since reviewed and passed the gcc/binutils regressions of riscv-gnu-toolchain.

Thanks a lot for the review!

>>   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.
> 
> Ongoing... 

Acknowledged, I will keep working on glibc revisions in the meantime.

Tatsuyuki

> 
> Thanks
> Nelson