mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
284a130902
The current PLT generation code will generate invalid code when the PLT relocation offset exceeds 64k. This fixes the issue by detecting large plt_reloc offsets and generare code sequences to create larger plt relocations. The "large" plt code needs 2 extra instructions to create 32-bit offsets. bfd/ChangeLog: PR 27746 * elf32-or1k.c (PLT_ENTRY_SIZE_LARGE, PLT_MAX_INSN_COUNT, OR1K_ADD, OR1K_ORI): New macros to help with plt creation. (elf_or1k_link_hash_table): New field plt_count. (elf_or1k_link_hash_entry): New field plt_index. (elf_or1k_plt_entry_size): New function. (or1k_write_plt_entry): Update to support variable size PLTs. (or1k_elf_finish_dynamic_sections): Use new or1k_write_plt_entry API. (or1k_elf_finish_dynamic_symbol): Update to write large PLTs when needed. (allocate_dynrelocs): Use elf_or1k_plt_entry_size to account for PLT size. ld/ChangeLog: PR 27746 testsuite/ld-or1k/or1k.exp (or1kplttests): Add tests for linking along with gotha() relocations. testsuite/ld-or1k/gotha1.dd: New file. testsuite/ld-or1k/gotha1.s: New file. testsuite/ld-or1k/gotha2.dd: New file. testsuite/ld-or1k/gotha2.s: New file testsuite/ld-or1k/pltlib.s (x): Define size to avoid link failure.
23 lines
382 B
ArmAsm
23 lines
382 B
ArmAsm
.section .text
|
|
.align 4
|
|
.global test
|
|
.type test, @function
|
|
test:
|
|
l.addi r1, r1, -8
|
|
l.sw 0(r1), r16
|
|
l.sw 4(r1), r9
|
|
|
|
l.jal 8
|
|
l.movhi r16, gotpchi(_GLOBAL_OFFSET_TABLE_-4)
|
|
l.ori r16, r16, gotpclo(_GLOBAL_OFFSET_TABLE_+0)
|
|
l.add r16, r16, r9
|
|
|
|
l.movhi r17, gotha(i)
|
|
l.add r17, r17, r16
|
|
l.lwz r17, got(i)(r17)
|
|
|
|
l.lwz r9, 4(r1)
|
|
l.lwz r16, 0(r1)
|
|
l.jr r9
|
|
l.addi r1, r1, 8
|