mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-21 04:42:53 +08:00
b679fb488a
There are two improvements, which are all referenced to aarch64, * R_RISCV_32 with non ABS symbol cannot be used under RV64 when making shard objects. * Don't need dynamic relocation for R_RISCV_32/64 under RV32/RV64 when making shared objects, if the referenced symbol is local ABS symbol. However, considering this link, https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/341 Seems like we should makes all R_RISCV_32/64 relocs with ABS symbol that don't need any dynamic relocations when making the shared objects. But anyway, I just sync the current behavior as aarch64 ld, in case there are any unexpected behaviors happen. Passed the gcc/binutils regressions in riscv-gnu-toolchain. bfd/ * elfnn-riscv.c (riscv_elf_check_relocs): Only allow R_RISCV_32 with ABS symbol under RV64. (riscv_elf_relocate_section): R_RISCV_32/64 with local ABS symbol under RV32/RV64 doesn't need any dynamic relocation when making shared objects. I just make the implementations similar to other targets, so that will be more easy to mainatain. ld/ * testsuite/ld-riscv-elf/data-reloc*: New testcases. * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Added new data-reloc* testcases, and need to make ifunc-seperate* testcases work for rv32. * testsuite/ld-riscv-elf/ifunc-seperate-caller-nonplt.s: Likewise. * testsuite/ld-riscv-elf/ifunc-seperate-caller-plt.s: Likewise.
24 lines
337 B
ArmAsm
24 lines
337 B
ArmAsm
.text
|
|
|
|
# Call the IFUNC `foo` which is defined in the other modules.
|
|
.globl foo
|
|
.type foo, %function
|
|
|
|
.globl main
|
|
.type main, @function
|
|
main:
|
|
.L1:
|
|
auipc x1, %got_pcrel_hi (foo)
|
|
addi x1, x1, %pcrel_lo (.L1)
|
|
|
|
.L2:
|
|
auipc x2, %pcrel_hi (foo_addr)
|
|
addi x2, x2, %pcrel_lo (.L2)
|
|
|
|
ret
|
|
.size main, .-main
|
|
|
|
.data
|
|
foo_addr:
|
|
.quad foo
|