aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp3
-rw-r--r--ld/testsuite/ld-riscv-elf/pcgp-relax-01.d (renamed from ld/testsuite/ld-riscv-elf/pcgp-relax.d)2
-rw-r--r--ld/testsuite/ld-riscv-elf/pcgp-relax-01.s (renamed from ld/testsuite/ld-riscv-elf/pcgp-relax.s)0
-rw-r--r--ld/testsuite/ld-riscv-elf/pcgp-relax-02.d15
-rw-r--r--ld/testsuite/ld-riscv-elf/pcgp-relax-02.s18
5 files changed, 36 insertions, 2 deletions
diff --git a/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp b/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
index 20ca3bd..78a7134 100644
--- a/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
+++ b/ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp
@@ -121,7 +121,8 @@ proc run_relax_twice_test {} {
if [istarget "riscv*-*-*"] {
run_dump_test "align-small-region"
run_dump_test "call-relax"
- run_dump_test "pcgp-relax"
+ run_dump_test "pcgp-relax-01"
+ run_dump_test "pcgp-relax-02"
run_dump_test "c-lui"
run_dump_test "c-lui-2"
run_dump_test "disas-jalr"
diff --git a/ld/testsuite/ld-riscv-elf/pcgp-relax.d b/ld/testsuite/ld-riscv-elf/pcgp-relax-01.d
index dae2b62..f942567 100644
--- a/ld/testsuite/ld-riscv-elf/pcgp-relax.d
+++ b/ld/testsuite/ld-riscv-elf/pcgp-relax-01.d
@@ -1,4 +1,4 @@
-#source: pcgp-relax.s
+#source: pcgp-relax-01.s
#ld: --relax
#objdump: -d -Mno-aliases
diff --git a/ld/testsuite/ld-riscv-elf/pcgp-relax.s b/ld/testsuite/ld-riscv-elf/pcgp-relax-01.s
index fab6a5b..fab6a5b 100644
--- a/ld/testsuite/ld-riscv-elf/pcgp-relax.s
+++ b/ld/testsuite/ld-riscv-elf/pcgp-relax-01.s
diff --git a/ld/testsuite/ld-riscv-elf/pcgp-relax-02.d b/ld/testsuite/ld-riscv-elf/pcgp-relax-02.d
new file mode 100644
index 0000000..c6c73c5
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/pcgp-relax-02.d
@@ -0,0 +1,15 @@
+#source: pcgp-relax-02.s
+#as:
+#ld: --relax
+#objdump: -d
+
+.*:[ ]+file format .*
+
+
+Disassembly of section .text:
+
+[0-9a-f]+ <_start>:
+.*:[ ]+[0-9a-f]+[ ]+auipc[ ]+a1.*
+.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a0,gp.*<data_a>
+.*:[ ]+[0-9a-f]+[ ]+addi[ ]+a1,a1.*<data_b>
+#pass
diff --git a/ld/testsuite/ld-riscv-elf/pcgp-relax-02.s b/ld/testsuite/ld-riscv-elf/pcgp-relax-02.s
new file mode 100644
index 0000000..ca4aa1f
--- /dev/null
+++ b/ld/testsuite/ld-riscv-elf/pcgp-relax-02.s
@@ -0,0 +1,18 @@
+ .text
+ .globl _start
+_start:
+.L1: auipc a0, %pcrel_hi(data_a)
+.L2: auipc a1, %pcrel_hi(data_b)
+ addi a0, a0, %pcrel_lo(.L1)
+ addi a1, a1, %pcrel_lo(.L2)
+
+ .data
+ .word 0x0
+ .globl data_a
+data_a:
+ .word 0x1
+
+ .section .rodata
+ .globl data_b
+data_b:
+ .word 0x2