binutils-gdb/ld/testsuite/ld-loongarch-elf
Xi Ruoyao ae2e4d4035 LoongArch: Fix R_LARCH_IRELATIVE insertion after elf_link_sort_relocs
loongarch_elf_finish_dynamic_symbol is called after elf_link_sort_relocs
if -z combreloc.  elf_link_sort_relocs redistributes the contents of
.rela.* sections those would be merged into .rela.dyn, so the slot for
R_LARCH_IRELATIVE may be out of relplt->contents now.

To make things worse, the boundary check

    dyn < dyn + relplt->size / sizeof (*dyn)

is obviously wrong ("x + 10 < x"? :), causing the issue undetected
during the linking process and the resulted executable suddenly crashes
at runtime.

The issue was found during an attempt to add static-pie support to the
toolchain.

Fix it by iterating through the inputs of .rela.dyn to find the slot.
2022-09-20 17:16:06 +08:00
..
attr-ifunc-4.c
attr-ifunc-4.out
cmodel-libjirl.dd LoongArch: ld: Fix bug not generate plt when link a dso 2022-08-24 14:27:03 +08:00
cmodel.exp Re: LoongArch: ld: Fix bug not generate plt when link a dso 2022-08-25 09:41:43 +09:30
disas-jirl-32.d
disas-jirl-32.s
disas-jirl.d
disas-jirl.s
ifunc.exp
jmp_op.d opcodes: LoongArch: add "ret" instruction to reduce typing 2022-08-01 15:57:32 +08:00
jmp_op.s opcodes: LoongArch: add "ret" instruction to reduce typing 2022-08-01 15:57:32 +08:00
ld-loongarch-elf.exp LoongArch: Fix R_LARCH_IRELATIVE insertion after elf_link_sort_relocs 2022-09-20 17:16:06 +08:00
libjirl.s LoongArch: ld: Fix bug not generate plt when link a dso 2022-08-24 14:27:03 +08:00
libnopic-global.s
local-ifunc-reloc.d LoongArch: Fix R_LARCH_IRELATIVE insertion after elf_link_sort_relocs 2022-09-20 17:16:06 +08:00
local-ifunc-reloc.s LoongArch: Fix R_LARCH_IRELATIVE insertion after elf_link_sort_relocs 2022-09-20 17:16:06 +08:00
macro_op_32.d
macro_op_32.s
macro_op.d
macro_op.s
nopic-global-so.rd
nopic-global-so.sd
nopic-global.out
nopic-global.s
nopic-global.sd
nopic-global.xd
nopic-local.out
nopic-local.rd
nopic-local.s
nopic-local.sd
nopic-local.xd
nopic-weak-global-so.rd
nopic-weak-global-so.sd
nopic-weak-global.out
nopic-weak-global.s
nopic-weak-global.sd
nopic-weak-global.xd
nopic-weak-local.out
nopic-weak-local.rd
nopic-weak-local.s
nopic-weak-local.sd
nopic-weak-local.xd
pic.exp
pic.ld
syscall-0.s
syscall-1.s
syscall.d