diff options
author | Tatsuyuki Ishi <ishitatsuyuki@gmail.com> | 2024-02-21 02:55:48 +0900 |
---|---|---|
committer | Nelson Chu <nelson@rivosinc.com> | 2024-02-21 14:58:43 +0800 |
commit | 0ac6b8701fc8fcdec83edac91f44c9c5bb8d2952 (patch) | |
tree | 141d70d5542c44e296c353132b8747d126842b5a /gdb/python | |
parent | af514e5f6d1d0233a251a3ae17f7cb8d9ba8e36b (diff) | |
download | binutils-0ac6b8701fc8fcdec83edac91f44c9c5bb8d2952.zip binutils-0ac6b8701fc8fcdec83edac91f44c9c5bb8d2952.tar.gz binutils-0ac6b8701fc8fcdec83edac91f44c9c5bb8d2952.tar.bz2 |
RISC-V: Fix local GOT and reloc size calculation for TLS.
The previous code did not account correctly for two cases:
* A TLS symbol can be referenced with multiple TLS types (although rare),
in which case it only allocated the maximum slot size among the types,
instead of the sum.
* TLS relocations are only needed for DLLs, unlike normal symbols which
requires relocations for all PIE code.
Modify the logic to account for the two cases, so this fixes the redundant
dynamic R_RISCV_NONE in .rela.dyn when using --no-pie for TLS GD and IE.
Passed the gcc/binutils regressions of riscv-gnu-toolchain.
bfd/
* elfnn-riscv.c (riscv_elf_size_dynamic_sections): Handle relocation
sizing for TLS and non-TLS symbols differently, with the former
requiring relocs on DLL while the latter requiring on PIE.
Allocate GOT slots and relocation slots for each TLS type separately,
accounting for the possibility of a TLS variable getting referenced by
multiple symbols.
ld/
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
* testsuite/ld-riscv-elf/tls*: New testcase for TLS GD and IE, with
symbols referred by both types and global and local symbols.
Diffstat (limited to 'gdb/python')
0 files changed, 0 insertions, 0 deletions