aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-aarch64/aarch64-elf.exp4
-rw-r--r--ld/testsuite/ld-aarch64/copy-reloc-2.d7
-rw-r--r--ld/testsuite/ld-aarch64/copy-reloc-eliminate.d4
-rw-r--r--ld/testsuite/ld-aarch64/copy-reloc-exe-2.s32
-rw-r--r--ld/testsuite/ld-aarch64/copy-reloc-exe-eliminate.s7
-rw-r--r--ld/testsuite/ld-aarch64/copy-reloc-so.s19
6 files changed, 73 insertions, 0 deletions
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index ca21e17..f171f6f 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -335,6 +335,10 @@ 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 2" "-e0 tmpdir/copy-reloc-so.so" "" ""
+ {copy-reloc-exe-2.s} {{objdump -R copy-reloc-2.d}} "copy-reloc-2"}
+ {"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-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]
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-2.s b/ld/testsuite/ld-aarch64/copy-reloc-exe-2.s
new file mode 100644
index 0000000..d83658c
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/copy-reloc-exe-2.s
@@ -0,0 +1,32 @@
+ # expect copy relocation for all these scenarios.
+ .global p
+ .global q
+ .global r
+ .section .data.rel.ro,"aw",%progbits
+ .align 3
+ .type p, %object
+ .size p, 8
+p:
+ .xword global_a
+
+ .type q, %object
+ .size q, 8
+q:
+ .xword global_b
+
+ .type r, %object
+ .size r, 8
+r:
+ # Any pc-rel relocation as no dynamic linker support on AArch64.
+ .xword global_c - .
+
+ .text
+ .global main
+main:
+ # Symbols are referenced by any other relocation against read-only
+ # section.
+ movz x0, :abs_g0_nc:global_a
+ adrp x1, global_b
+ # pc-rel.
+ adrp x2, global_d
+ add x2, x2, #:lo12:global_c
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
diff --git a/ld/testsuite/ld-aarch64/copy-reloc-so.s b/ld/testsuite/ld-aarch64/copy-reloc-so.s
index 07ec44a..af40f69 100644
--- a/ld/testsuite/ld-aarch64/copy-reloc-so.s
+++ b/ld/testsuite/ld-aarch64/copy-reloc-so.s
@@ -1,6 +1,25 @@
.global global_a
.type global_a, %object
.size global_a, 4
+
+ .global global_b
+ .type global_b, %object
+ .size global_b, 4
+
+ .global global_c
+ .type global_c, %object
+ .size global_c, 4
+
+ .global global_d
+ .type global_d, %object
+ .size global_d, 4
+
.data
global_a:
.word 0xcafedead
+global_b:
+ .word 0xcafecafe
+global_c:
+ .word 0xdeadcafe
+global_d:
+ .word 0xdeaddead