aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorJiong Wang <jiong.wang@arm.com>2017-06-07 12:05:39 +0100
committerJiong Wang <jiong.wang@arm.com>2017-06-08 09:43:39 +0100
commitbc327528fd2ccdc6c29ab6ae608085dddbad5cc8 (patch)
tree638acdde987efeeca8a92b0861f0767fc0ee69d1 /ld
parent81b6fe3bf9f3be2b6b81d05d08ac58d2a6dcb760 (diff)
downloadgdb-bc327528fd2ccdc6c29ab6ae608085dddbad5cc8.zip
gdb-bc327528fd2ccdc6c29ab6ae608085dddbad5cc8.tar.gz
gdb-bc327528fd2ccdc6c29ab6ae608085dddbad5cc8.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) after this patch. bfd/ PR ld/21532 * elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1. (elfNN_aarch64_final_link_relocate): Also propagate relocations to runtime for copy relocation elimination cases. (alias_readonly_dynrelocs): New function. (elfNN_aarch64_adjust_dynamic_symbol): Keep the dynamic relocs instead of generating copy relocation if it is not against read-only sections. (elfNN_aarch64_check_relocs): Likewise. ld/ * testsuite/ld-aarch64/copy-reloc-eliminate.d: New test. * testsuite/ld-aarch64/copy-reloc-exe-eliminate.s: New test source file. * testsuite/ld-aarch64/aarch64-elf.exp: Run new testcase.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/testsuite/ld-aarch64/aarch64-elf.exp2
-rw-r--r--ld/testsuite/ld-aarch64/copy-reloc-eliminate.d4
-rw-r--r--ld/testsuite/ld-aarch64/copy-reloc-exe-eliminate.s7
4 files changed, 19 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 36fc28b..9eaa646 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2017-06-08 Jiong Wang <jiong.wang@arm.com>
+
+ * testsuite/ld-aarch64/copy-reloc-eliminate.d: New test.
+ * testsuite/ld-aarch64/copy-reloc-exe-eliminate.s: New test source file.
+ * testsuite/ld-aarch64/aarch64-elf.exp: Run new testcase.
+
2017-06-07 Alan Modra <amodra@gmail.com>
* testsuite/ld-unique/pr21529.d: xfail aarch64, arm, hppa, ia64,
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index ca21e17..66e7e64 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -335,6 +335,8 @@ set aarch64elflinktests {
{} "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"}
+ {"ld-aarch64/exe with copy relocation elimination" "-e0 tmpdir/copy-reloc-so.so" "" ""
+ {copy-reloc-exe-eliminate.s} {{objdump -R copy-reloc-eliminate.d}} "copy-reloc-elimination"}
{"ld-aarch64/so with global func" "-shared" "" "" {func-in-so.s}
{} "func-in-so.so"}
{"ld-aarch64/func sym hash opt for exe"
diff --git a/ld/testsuite/ld-aarch64/copy-reloc-eliminate.d b/ld/testsuite/ld-aarch64/copy-reloc-eliminate.d
new file mode 100644
index 0000000..9657d65
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/copy-reloc-eliminate.d
@@ -0,0 +1,4 @@
+.*
+DYNAMIC RELOCATION RECORDS
+OFFSET.*TYPE.*VALUE.*
+.*R_AARCH64_ABS64.*global_a
diff --git a/ld/testsuite/ld-aarch64/copy-reloc-exe-eliminate.s b/ld/testsuite/ld-aarch64/copy-reloc-exe-eliminate.s
new file mode 100644
index 0000000..33227aa
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/copy-reloc-exe-eliminate.s
@@ -0,0 +1,7 @@
+ .global p
+ .section .data.rel.ro,"aw",%progbits
+ .align 3
+ .type p, %object
+ .size p, 8
+p:
+ .xword global_a