mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-17 13:10:12 +08:00
With a simple test case: .globl ifunc .globl ifunc_hidden .hidden ifunc_hidden .type ifunc, %gnu_indirect_function .type ifunc_hidden, %gnu_indirect_function .text .align 2 ifunc: ret ifunc_hidden: ret test: bl ifunc bl ifunc_hidden "ld -shared" produces a shared object with one R_LARCH_NONE (instead of R_LARCH_JUMP_SLOT as we expect) to relocate the GOT entry of "ifunc". It's because the indices in .plt and .rela.plt mismatches for STV_DEFAULT STT_IFUNC symbols when another PLT entry exists for a STV_HIDDEN STT_IFUNC symbol, and such a mismatch breaks the logic of loongarch_elf_finish_dynamic_symbol. Fix the issue by reordering .plt so the indices no longer mismatch. Signed-off-by: Xi Ruoyao <xry111@xry111.site>
56 lines
798 B
ArmAsm
56 lines
798 B
ArmAsm
.globl foo
|
|
.globl foo_hidden1
|
|
.globl foo_hidden2
|
|
.globl foo_protected
|
|
|
|
.type foo, %gnu_indirect_function
|
|
.type foo_hidden1, %gnu_indirect_function
|
|
.type foo_hidden2, %gnu_indirect_function
|
|
.type foo_protected, %gnu_indirect_function
|
|
.type foo_internal, %gnu_indirect_function
|
|
|
|
.hidden foo_hidden1
|
|
.hidden foo_hidden2
|
|
|
|
.protected foo_protected
|
|
|
|
.globl ext_ifunc1
|
|
.globl ext_ifunc2
|
|
.type ext_ifunc1, %gnu_indirect_function
|
|
.type ext_ifunc2, %gnu_indirect_function
|
|
|
|
.text
|
|
.align 2
|
|
foo:
|
|
ret
|
|
|
|
foo_hidden1:
|
|
ret
|
|
|
|
foo_hidden2:
|
|
ret
|
|
|
|
foo_protected:
|
|
ret
|
|
|
|
foo_internal:
|
|
ret
|
|
|
|
test:
|
|
la.got $a0, num
|
|
# The order is deliberately shuffled.
|
|
bl ext_ifunc1
|
|
bl foo
|
|
bl foo_hidden1
|
|
bl ext_func1
|
|
bl foo_protected
|
|
bl foo_internal
|
|
bl foo_hidden2
|
|
bl ext_func2
|
|
bl ext_ifunc2
|
|
|
|
.data
|
|
.align 3
|
|
num:
|
|
.quad 114514
|