]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
RISC-V: Fixed overwritten IRELATIVE relocs in the .rel.iplt for data reloc.
authorNelson Chu <nelson@rivosinc.com>
Mon, 27 May 2024 17:22:13 +0000 (01:22 +0800)
committerNelson Chu <nelson@rivosinc.com>
Mon, 27 May 2024 17:38:26 +0000 (01:38 +0800)
commite8c26825728385e24990bb7c2968e79908b02410
treea70952d3eac58c803524746645232c34837a6e50
parent1d7a877a0f74a7b90d70ca8cc3c0db9461619b1a
RISC-V: Fixed overwritten IRELATIVE relocs in the .rel.iplt for data reloc.

This was originally reported by Hau Hsu <hau.hsu@sifive.com>.

Similar to commit 51a8a7c2e3cc0730831963651a55d23d1fae624d

We shouldn't use riscv_elf_append_rela to add dynamic relocs into .rela.iplt
in the riscv_elf_relocate_section when handling ifunc data reloc R_RISCV_32/64.
This just like what did in the riscv_elf_finish_dynamic_symbol.

bfd/
* elfnn-riscv.c (riscv_elf_relocate_section): We shouldn't use
riscv_elf_append_rela to add dynamic relocs into .rela.iplt in the
riscv_elf_relocate_section when handling ifunc data reloc.
ld/
* testsuite/ld-riscv-elf/ifunc-overwrite.s: Updated and renamed.
* testsuite/ld-riscv-elf/ifunc-overwrite-exe.rd: Likewise.
* testsuite/ld-riscv-elf/ifunc-overwrite-pic.rd: Likewise.
* testsuite/ld-riscv-elf/ifunc-overwrite-pie.rd: Likewise.
* testsuite/ld-riscv-elf/ifunc-overwrite.d: Renamed.
bfd/elfnn-riscv.c
ld/testsuite/ld-riscv-elf/ifunc-overwrite-exe.rd [moved from ld/testsuite/ld-riscv-elf/ifunc-plt-got-overwrite-exe.rd with 76% similarity]
ld/testsuite/ld-riscv-elf/ifunc-overwrite-pic.rd [moved from ld/testsuite/ld-riscv-elf/ifunc-plt-got-overwrite-pic.rd with 71% similarity]
ld/testsuite/ld-riscv-elf/ifunc-overwrite-pie.rd [moved from ld/testsuite/ld-riscv-elf/ifunc-plt-got-overwrite-pie.rd with 66% similarity]
ld/testsuite/ld-riscv-elf/ifunc-overwrite.d [moved from ld/testsuite/ld-riscv-elf/ifunc-plt-got-overwrite.d with 100% similarity]
ld/testsuite/ld-riscv-elf/ifunc-overwrite.s [moved from ld/testsuite/ld-riscv-elf/ifunc-plt-got-overwrite.s with 79% similarity]
ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp