[PATCH v3] aarch64: Emit jump slot for conditional branch to undefined symbols
authorSiddhesh Poyarekar <siddesh.poyarekar@arm.com>
Tue, 19 May 2020 10:07:52 +0000 (11:07 +0100)
committerNick Clifton <nickc@redhat.com>
Tue, 19 May 2020 10:07:52 +0000 (11:07 +0100)
commit7e05773767820b441b23a16628b55c98cb1aef46
tree76a372538e574c4de9168c05126acc4908be6f81
parent607b483327fdfc75fb193870b3c4e7445ce3f64d
[PATCH v3] aarch64: Emit jump slot for conditional branch to undefined symbols

The linker silently writes out a conditional branch to 0 if the
target symbol in R_AARCH64_CONDBR19 or R_AARCH64_TSTBR14 relocations is
undefined.  Emit a PLT instead so that behaviour is the same for these
relocations as the llvm linker.

The special behaviour for undefined weak symbols, where conditional
branches to such symbols result in a branch unto themselves, has been
retained.  This is because the weak-undefined.s test explicitly checks
for that, leading me to conclude that it's expected behaviour.

bfd * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Club
BFD_RELOC_AARCH64_BRANCH19 and BFD_RELOC_AARCH64_TSTBR14
cases with BFD_RELOC_AARCH64_JUMP26.
(elfNN_aarch64_check_relocs): Likewise.

ld * testsuite/ld-aarch64/aarch64-elf.exp: New test
emit-relocs-560.
* testsuite/ld-aarch64/emit-relocs-560.d: New file.
* testsuite/ld-aarch64/emit-relocs-560.s: New file.
bfd/ChangeLog
bfd/elfnn-aarch64.c
ld/ChangeLog
ld/testsuite/ld-aarch64/aarch64-elf.exp
ld/testsuite/ld-aarch64/emit-relocs-560.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/emit-relocs-560.s [new file with mode: 0644]