diff options
author | Jiong Wang <jiong.wang@arm.com> | 2014-08-26 15:48:47 +0100 |
---|---|---|
committer | Jiong Wang <jiong.wang@arm.com> | 2014-08-26 15:48:47 +0100 |
commit | 614b09cefb3bafa840fe5ed06c58024b0ff9c1cb (patch) | |
tree | 8f81648e5f08f7309aeb9a379e38e78a3b14ae56 /ld | |
parent | 2836a869c4607fd1200b928986092ffed20c1d32 (diff) | |
download | gdb-614b09cefb3bafa840fe5ed06c58024b0ff9c1cb.zip gdb-614b09cefb3bafa840fe5ed06c58024b0ff9c1cb.tar.gz gdb-614b09cefb3bafa840fe5ed06c58024b0ff9c1cb.tar.bz2 |
[AArch64] Improve copy relocation support on four absolute relocation types
2014-08-26 Jiong Wang <jiong.wang@arm.com>
bfd/
* elfnn-aarch64.c (elfNN_aarch64_check_relocs): Initialize non_got_ref
properly for MOVW_G0/1/2_NC and MOVW_G3. Reject them when linking
shared library.
(elfNN_aarch64_gc_sweep_hook): Add check on these relocs.
ld/testsuite/
* ld-aarch64/copy-relocs-so.s: New test file.
* ld-aarch64/copy-relocs-exe.s: Likewise.
* ld-aarch64/copy-relocs.d: New expectation file.
* ld-aarch64/emit-relocs-264-bad.d: New test file.
* ld-aarch64/emit-relocs-266-bad.d: Likewise.
* ld-aarch64/emit-relocs-268-bad.d: Likewise.
* ld-aarch64/emit-relocs-269-bad.d: Likewise.
* ld-aarch64/aarch64-elf.exp: Run new added test.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ChangeLog | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/aarch64-elf.exp | 13 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/copy-reloc-exe.s | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/copy-reloc-so.s | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/copy-reloc.d | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/emit-relocs-264-bad.d | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/emit-relocs-266-bad.d | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/emit-relocs-268-bad.d | 3 | ||||
-rw-r--r-- | ld/testsuite/ld-aarch64/emit-relocs-269-bad.d | 3 |
9 files changed, 53 insertions, 0 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 203fcc5..6f5ff5e 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2014-08-26 Jiong Wang <jiong.wang@arm.com> + + * ld-aarch64/copy-relocs-so.s: New test file. + * ld-aarch64/copy-relocs-exe.s: Likewise. + * ld-aarch64/copy-relocs.d: New expectation file. + * ld-aarch64/emit-relocs-264-bad.d: New test file. + * ld-aarch64/emit-relocs-266-bad.d: Likewise. + * ld-aarch64/emit-relocs-268-bad.d: Likewise. + * ld-aarch64/emit-relocs-269-bad.d: Likewise. + * ld-aarch64/aarch64-elf.exp: Run new added test. + 2014-08-26 Nick Clifton <nickc@redhat.com> * ld-aarch64/eh-frame-foo.s: Use 8-byte offset for X30. diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp index 36babf3..b3f6eb5 100644 --- a/ld/testsuite/ld-aarch64/aarch64-elf.exp +++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp @@ -51,11 +51,15 @@ run_dump_test "emit-relocs-260-be" run_dump_test "emit-relocs-262" run_dump_test "emit-relocs-263" run_dump_test "emit-relocs-264" +run_dump_test "emit-relocs-264-bad" run_dump_test "emit-relocs-265" run_dump_test "emit-relocs-266" +run_dump_test "emit-relocs-266-bad" run_dump_test "emit-relocs-267" run_dump_test "emit-relocs-268" +run_dump_test "emit-relocs-268-bad" run_dump_test "emit-relocs-269" +run_dump_test "emit-relocs-269-bad" run_dump_test "emit-relocs-270" run_dump_test "emit-relocs-270-bad" run_dump_test "emit-relocs-271" @@ -163,3 +167,12 @@ run_dump_test "ifunc-21" run_dump_test "ifunc-22" run_dump_test "relasz" + +set aarch64elflinktests { + {"ld-aarch64/so with global symbol" "-shared" "" "" {copy-reloc-so.s} + {} "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"} +} + +run_ld_link_tests $aarch64elflinktests diff --git a/ld/testsuite/ld-aarch64/copy-reloc-exe.s b/ld/testsuite/ld-aarch64/copy-reloc-exe.s new file mode 100644 index 0000000..cafc700 --- /dev/null +++ b/ld/testsuite/ld-aarch64/copy-reloc-exe.s @@ -0,0 +1,7 @@ + .text + .global main +main: + movz x0,:abs_g0_nc:global_a + movk x0,:abs_g1_nc:global_a + movk x0,:abs_g2_nc:global_a + movk x0,:abs_g3:global_a diff --git a/ld/testsuite/ld-aarch64/copy-reloc-so.s b/ld/testsuite/ld-aarch64/copy-reloc-so.s new file mode 100644 index 0000000..07ec44a --- /dev/null +++ b/ld/testsuite/ld-aarch64/copy-reloc-so.s @@ -0,0 +1,6 @@ + .global global_a + .type global_a, %object + .size global_a, 4 + .data +global_a: + .word 0xcafedead diff --git a/ld/testsuite/ld-aarch64/copy-reloc.d b/ld/testsuite/ld-aarch64/copy-reloc.d new file mode 100644 index 0000000..c4eed84 --- /dev/null +++ b/ld/testsuite/ld-aarch64/copy-reloc.d @@ -0,0 +1,4 @@ +.* +DYNAMIC RELOCATION RECORDS +OFFSET.*TYPE.*VALUE.* +.*R_AARCH64_COPY.*global_a diff --git a/ld/testsuite/ld-aarch64/emit-relocs-264-bad.d b/ld/testsuite/ld-aarch64/emit-relocs-264-bad.d new file mode 100644 index 0000000..22718ca --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-264-bad.d @@ -0,0 +1,3 @@ +#source: emit-relocs-264.s +#ld: -T relocs.ld --defsym tempy=0x11000 --defsym tempy2=0x45000 --defsym tempy3=0x1234 -e0 -shared +#error: .*relocation R_AARCH64_MOVW_UABS_G0_NC.*can not.*shared object.*fPIC diff --git a/ld/testsuite/ld-aarch64/emit-relocs-266-bad.d b/ld/testsuite/ld-aarch64/emit-relocs-266-bad.d new file mode 100644 index 0000000..886494d --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-266-bad.d @@ -0,0 +1,3 @@ +#source: emit-relocs-266.s +#ld: -T relocs.ld --defsym tempy=0x11000 --defsym tempy2=0x45000 --defsym tempy3=0x1234 -e0 -shared +#error: .*relocation R_AARCH64_MOVW_UABS_G1_NC.*can not.*shared object.*fPIC diff --git a/ld/testsuite/ld-aarch64/emit-relocs-268-bad.d b/ld/testsuite/ld-aarch64/emit-relocs-268-bad.d new file mode 100644 index 0000000..ea97541 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-268-bad.d @@ -0,0 +1,3 @@ +#source: emit-relocs-268.s +#ld: -T relocs.ld --defsym tempy=0x11000 --defsym tempy2=0x45000 --defsym tempy3=0x1234 -e0 -shared +#error: .*relocation R_AARCH64_MOVW_UABS_G2_NC.*can not.*shared object.*fPIC diff --git a/ld/testsuite/ld-aarch64/emit-relocs-269-bad.d b/ld/testsuite/ld-aarch64/emit-relocs-269-bad.d new file mode 100644 index 0000000..9292855 --- /dev/null +++ b/ld/testsuite/ld-aarch64/emit-relocs-269-bad.d @@ -0,0 +1,3 @@ +#source: emit-relocs-269.s +#ld: -T relocs.ld --defsym tempy=0x11000 --defsym tempy2=0x45000 --defsym tempy3=0x1234 -e0 -shared +#error: .*relocation R_AARCH64_MOVW_UABS_G3.*can not.*shared object.*fPIC |