aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-aarch64/copy-reloc-2.d
diff options
context:
space:
mode:
authorJiong Wang <jiong.wang@arm.com>2017-06-15 16:51:01 +0100
committerJiong Wang <jiong.wang@arm.com>2017-06-15 17:04:04 +0100
commit6353d82b8fa825c2143f41e84b0d5d4446c6e99a (patch)
tree8acf1add319d0c4c3775adbcd3faeb7aa65429e1 /ld/testsuite/ld-aarch64/copy-reloc-2.d
parent8cac017d35ef374e65acc98818a17cf8a652cbd0 (diff)
downloadgdb-6353d82b8fa825c2143f41e84b0d5d4446c6e99a.zip
gdb-6353d82b8fa825c2143f41e84b0d5d4446c6e99a.tar.gz
gdb-6353d82b8fa825c2143f41e84b0d5d4446c6e99a.tar.bz2
[AArch64] Allow COPY relocation elimination
As discussed at the PR, this patch tries to avoid COPY relocation generation and propagate the original relocation into runtime if it was relocating on writable section. The ELIMINATE_COPY_RELOCS has been set to true and it's underlying infrastructure has been improved so that the COPY reloc elimination at least working on absoluate relocations (ABS64) on AArch64. BFD linker copy relocation elimination framwork requires the backend to always allocate dynrelocs for all those relocation types that are possible to introduce copy relocations. This is for adjust_dynamic_symbol hook to be able to get all symbol reference information. Should one symbol is referenced by more than one relocations, if there is any of them needs copy relocation then linker should generate it. bfd/ PR ld/21532 * elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1. (elfNN_aarch64_final_link_relocate): Also propagate relocations to runtime for if there needs copy relocation elimination. (need_copy_relocation_p): New function. Return true for symbol with pc-relative references and if it's against read-only sections. (elfNN_aarch64_adjust_dynamic_symbol): Use need_copy_relocation_p. (elfNN_aarch64_check_relocs): Allocate dynrelocs for relocation types that are related with accessing external objects. (elfNN_aarch64_gc_sweep_hook): Sync the relocation types with the change in elfNN_aarch64_check_relocs. ld/ * testsuite/ld-aarch64/copy-reloc-exe-2.s: New test source file. * testsuite/ld-aarch64/copy-reloc-2.d: New test. * testsuite/ld-aarch64/copy-reloc-exe-eliminate.s: New test source file. * testsuite/ld-aarch64/copy-reloc-eliminate.d: New test. * testsuite/ld-aarch64/copy-reloc-so.s: Define new global objects. * testsuite/ld-aarch64/aarch64-elf.exp: Run new tests.
Diffstat (limited to 'ld/testsuite/ld-aarch64/copy-reloc-2.d')
-rw-r--r--ld/testsuite/ld-aarch64/copy-reloc-2.d7
1 files changed, 7 insertions, 0 deletions
diff --git a/ld/testsuite/ld-aarch64/copy-reloc-2.d b/ld/testsuite/ld-aarch64/copy-reloc-2.d
new file mode 100644
index 0000000..87ddccd
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/copy-reloc-2.d
@@ -0,0 +1,7 @@
+.*
+DYNAMIC RELOCATION RECORDS
+OFFSET.*TYPE.*VALUE.*
+.*R_AARCH64_COPY.*global_[abcd]
+.*R_AARCH64_COPY.*global_[abcd]
+.*R_AARCH64_COPY.*global_[abcd]
+.*R_AARCH64_COPY.*global_[abcd]