aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddesh.poyarekar@arm.com>2020-05-19 11:07:52 +0100
committerNick Clifton <nickc@redhat.com>2020-05-19 11:07:52 +0100
commit7e05773767820b441b23a16628b55c98cb1aef46 (patch)
tree76a372538e574c4de9168c05126acc4908be6f81 /ld
parent607b483327fdfc75fb193870b3c4e7445ce3f64d (diff)
downloadgdb-7e05773767820b441b23a16628b55c98cb1aef46.zip
gdb-7e05773767820b441b23a16628b55c98cb1aef46.tar.gz
gdb-7e05773767820b441b23a16628b55c98cb1aef46.tar.bz2
[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.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog7
-rw-r--r--ld/testsuite/ld-aarch64/aarch64-elf.exp1
-rw-r--r--ld/testsuite/ld-aarch64/emit-relocs-560.d8
-rw-r--r--ld/testsuite/ld-aarch64/emit-relocs-560.s3
4 files changed, 19 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 7305171..cf566b3 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,10 @@
+2020-05-19 Siddhesh Poyarekar <siddesh.poyarekar@arm.com>
+
+ * 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.
+
2020-05-19 Alan Modra <amodra@gmail.com>
* emultempl/beos.em (sort_by_file_name): Use bfd_get_filename
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index 297a3e9..4c44fa1 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -236,6 +236,7 @@ run_dump_test_lp64 "emit-relocs-557"
run_dump_test_lp64 "emit-relocs-558"
run_dump_test_lp64 "emit-relocs-558-overflow"
run_dump_test_lp64 "emit-relocs-559"
+run_dump_test_lp64 "emit-relocs-560"
run_dump_test "reloc-overflow-bad"
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-560.d b/ld/testsuite/ld-aarch64/emit-relocs-560.d
new file mode 100644
index 0000000..1535324
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-560.d
@@ -0,0 +1,8 @@
+#source: emit-relocs-560.s
+#ld: -shared
+#readelf: -r
+
+Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 2 entries:
+ Offset Info Type Sym. Value Sym. Name \+ Addend
+[0-9a-f]+ 000100000402 R_AARCH64_JUMP_SL 0000000000000000 baz \+ 0
+[0-9a-f]+ 000200000402 R_AARCH64_JUMP_SL 0000000000000000 bar \+ 0
diff --git a/ld/testsuite/ld-aarch64/emit-relocs-560.s b/ld/testsuite/ld-aarch64/emit-relocs-560.s
new file mode 100644
index 0000000..9529e8f
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/emit-relocs-560.s
@@ -0,0 +1,3 @@
+foo:
+ tbz x0, 1, bar
+ cbnz x1, baz