[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.
Showing
- bfd/ChangeLog 7 additions, 0 deletionsbfd/ChangeLog
- bfd/elfnn-aarch64.c 18 additions, 4 deletionsbfd/elfnn-aarch64.c
- ld/ChangeLog 7 additions, 0 deletionsld/ChangeLog
- ld/testsuite/ld-aarch64/aarch64-elf.exp 1 addition, 0 deletionsld/testsuite/ld-aarch64/aarch64-elf.exp
- ld/testsuite/ld-aarch64/emit-relocs-560.d 8 additions, 0 deletionsld/testsuite/ld-aarch64/emit-relocs-560.d
- ld/testsuite/ld-aarch64/emit-relocs-560.s 3 additions, 0 deletionsld/testsuite/ld-aarch64/emit-relocs-560.s
Loading
Please register or sign in to comment