binutils-gdb/ld/testsuite/ld-riscv-elf/tls.d
Tatsuyuki Ishi 159afbb761 RISC-V: Initial ld.bfd support for TLSDESC.
Only relocation handling for now; relaxation is not implemented yet.

bfd/
    * elfnn-riscv.c (riscv_elf_check_relocs): Record GOT reference and
    paired relocation for TLSDESC_HI20.
    (riscv_elf_adjust_dynamic_symbol): Allocate GOT and reloc slots for
    TLSDESC symbols.
    (riscv_elf_size_dynamic_sections): Likewise but for local symbols.
    (tlsdescoff): New helper to determine static addend for R_TLSDESC.
    (riscv_elf_relocate_section): Ignore TLSDESC_CALL reloc for now (it is
    relaxation only).
    Handle TLSDESC_{LOAD,ADD}_LO12 as paired pcrel relocs.
    For TLS GOT slot generation, generalize the logic to handle any
    combination of (GD, IE, TLSDESC).
    Add TLSDESC Rela generation.
    * ld/testsuite/ld-riscv-elf/tls*: Add TLSDESC instruction sequences
    next to the existing GD and IE sequences. Update expectations.
2024-02-29 15:02:55 +08:00

18 lines
736 B
Makefile

#source: tls.s
#ld: --shared tmpdir/tlslib.so
#readelf: -Wr
Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 7 entries:
+Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
[0-9a-f]+ +[0-9a-f]+ R_RISCV_TLS_DTPMOD64 +0
[0-9a-f]+ +[0-9a-f]+ R_RISCV_TLS_TPREL64 +4
[0-9a-f]+ +[0-9a-f]+ R_RISCV_TLSDESC +4
[0-9a-f]+ +[0-9a-f]+ R_RISCV_TLS_DTPMOD64 +0+ sg1 \+ 0
[0-9a-f]+ +[0-9a-f]+ R_RISCV_TLS_DTPREL64 +0+ sg1 \+ 0
[0-9a-f]+ +[0-9a-f]+ R_RISCV_TLS_TPREL64 +0+ sg1 \+ 0
[0-9a-f]+ +[0-9a-f]+ R_RISCV_TLSDESC +0+ sg1 \+ 0
Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entry:
+Offset +Info +Type +Symbol's Value +Symbol's Name \+ Addend
[0-9a-f]+ +[0-9a-f]+ R_RISCV_JUMP_SLOT +0+ __tls_get_addr \+ 0