aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-02-09 09:56:21 +0000
committerPedro Alves <palves@redhat.com>2016-02-09 10:47:54 +0000
commit027e9c750c20fe8031a2b6d6272cd57bbf445df5 (patch)
tree4239dc30b45ff76536a55578194b080124302ec1 /ld/testsuite
parentc23bbc1cdae6149de4175a75aa9bf9bcbc936fa4 (diff)
downloadgdb-027e9c750c20fe8031a2b6d6272cd57bbf445df5.zip
gdb-027e9c750c20fe8031a2b6d6272cd57bbf445df5.tar.gz
gdb-027e9c750c20fe8031a2b6d6272cd57bbf445df5.tar.bz2
Add a more helpful warning message to explain why some AArch64 relocations can overflow.
bfd * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Add a more helpful warning message to explain why certain AArch64 relocs might overflow. ld * testsuite/ld-aarch64/reloc-overflow-bad.d: New test. * testsuite/ld-aarch64/reloc-overflow-1.s: New source file. * testsuite/ld-aarch64/reloc-overflow-2.s: New source file. * testsuite/ld-aarch64/aarch64-elf.exp: Run the new test.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-aarch64/aarch64-elf.exp6
-rw-r--r--ld/testsuite/ld-aarch64/reloc-overflow-1.s14
-rw-r--r--ld/testsuite/ld-aarch64/reloc-overflow-2.s5
-rw-r--r--ld/testsuite/ld-aarch64/reloc-overflow-bad.d4
4 files changed, 27 insertions, 2 deletions
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index 939539e..d0b33cf 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -159,6 +159,8 @@ run_dump_test "emit-relocs-537"
run_dump_test "emit-relocs-537-overflow"
run_dump_test "emit-relocs-538"
+run_dump_test "reloc-overflow-bad"
+
# test addend correctness when --emit-relocs specified for non-relocatable obj.
run_dump_test "emit-relocs-local-addend"
# test addend correctness when -r specified.
@@ -281,9 +283,9 @@ run_dump_test "plt_mapping_symbol"
set aarch64elflinktests {
{"ld-aarch64/so with global symbol" "-shared" "" "" {copy-reloc-so.s}
- {} "copy-reloc-so.so"}
+ {} "copy-reloc-so.so"}
{"ld-aarch64/exe with copy relocation" "-e0 tmpdir/copy-reloc-so.so" "" ""
- {copy-reloc-exe.s} {{objdump -R copy-reloc.d}} "copy-reloc"}
+ {copy-reloc-exe.s} {{objdump -R copy-reloc.d}} "copy-reloc"}
}
run_ld_link_tests $aarch64elflinktests
diff --git a/ld/testsuite/ld-aarch64/reloc-overflow-1.s b/ld/testsuite/ld-aarch64/reloc-overflow-1.s
new file mode 100644
index 0000000..9f85fd8
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/reloc-overflow-1.s
@@ -0,0 +1,14 @@
+ .file "1.c"
+ .text
+ .align 2
+ .p2align 3,,7
+ .global dec
+ .arch armv8-a+fp+simd
+ //.tune generic
+ .type dec, %function
+dec:
+ adrp x0, var_2
+ ldr w0, [x0, #:lo12:var_2]
+ ret
+ .size dec, .-dec
+ .ident "GCC: (GNU) 6.0.0 20160208 (experimental) [trunk revision 233206]"
diff --git a/ld/testsuite/ld-aarch64/reloc-overflow-2.s b/ld/testsuite/ld-aarch64/reloc-overflow-2.s
new file mode 100644
index 0000000..4956f01
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/reloc-overflow-2.s
@@ -0,0 +1,5 @@
+ .file "2.c"
+ .comm var_3,1,1
+ .comm var_2,1,1
+ .comm var_1,1,1
+ .ident "GCC: (GNU) 6.0.0 20160208 (experimental) [trunk revision 233206]"
diff --git a/ld/testsuite/ld-aarch64/reloc-overflow-bad.d b/ld/testsuite/ld-aarch64/reloc-overflow-bad.d
new file mode 100644
index 0000000..39f7e31
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/reloc-overflow-bad.d
@@ -0,0 +1,4 @@
+#source: reloc-overflow-1.s
+#source: reloc-overflow-2.s
+#ld: -e0
+#error: .*One possible cause.*