aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-or1k
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite/ld-or1k')
-rw-r--r--ld/testsuite/ld-or1k/gotha1.dd34
-rw-r--r--ld/testsuite/ld-or1k/gotha1.s24
-rw-r--r--ld/testsuite/ld-or1k/gotha2.dd21
-rw-r--r--ld/testsuite/ld-or1k/gotha2.s22
-rw-r--r--ld/testsuite/ld-or1k/or1k.exp8
-rw-r--r--ld/testsuite/ld-or1k/pltlib.s1
6 files changed, 110 insertions, 0 deletions
diff --git a/ld/testsuite/ld-or1k/gotha1.dd b/ld/testsuite/ld-or1k/gotha1.dd
new file mode 100644
index 0000000..0ad1f8f
--- /dev/null
+++ b/ld/testsuite/ld-or1k/gotha1.dd
@@ -0,0 +1,34 @@
+
+.*\.x: file format elf32-or1k
+
+
+Disassembly of section \.plt:
+
+[0-9a-f]+ <\.plt>:
+ +[0-9a-f]+: 19 80 00 00 l\.movhi r12,0x0
+ +[0-9a-f]+: 85 ec [0-9a-f]+ [0-9a-f]+ l\.lwz r15,[0-9]+\(r12\)
+ +[0-9a-f]+: 44 00 78 00 l\.jr r15
+ +[0-9a-f]+: 85 8c [0-9a-f]+ [0-9a-f]+ l\.lwz r12,[0-9]+\(r12\)
+ +[0-9a-f]+: 19 80 00 00 l\.movhi r12,0x0
+ +[0-9a-f]+: 85 8c [0-9a-f]+ [0-9a-f]+ l\.lwz r12,[0-9]+\(r12\)
+ +[0-9a-f]+: 44 00 60 00 l\.jr r12
+ +[0-9a-f]+: a9 60 00 00 l\.ori r11,r0,0x0
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <_start>:
+ +[0-9a-f]+: 9c 21 ff fc l\.addi r1,r1,-4
+ +[0-9a-f]+: d4 01 48 00 l\.sw 0\(r1\),r9
+ +[0-9a-f]+: 04 00 00 02 l\.jal [0-9a-f]+ <_start\+0x10>
+ +[0-9a-f]+: 1a 60 00 00 l\.movhi r19,0x0
+ +[0-9a-f]+: aa 73 [0-9a-f]+ [0-9a-f]+ l\.ori r19,r19,0x[0-9a-f]+
+ +[0-9a-f]+: e2 73 48 00 l\.add r19,r19,r9
+ +[0-9a-f]+: 1a 20 00 00 l\.movhi r17,0x0
+ +[0-9a-f]+: e2 31 98 00 l\.add r17,r17,r19
+ +[0-9a-f]+: 86 31 00 10 l\.lwz r17,16\(r17\)
+ +[0-9a-f]+: 84 71 00 00 l\.lwz r3,0\(r17\)
+ +[0-9a-f]+: 07 ff ff f2 l\.jal [0-9a-f]+ <\.plt\+0x10>
+ +[0-9a-f]+: 15 00 00 00 l\.nop 0x0
+ +[0-9a-f]+: 85 21 00 00 l\.lwz r9,0\(r1\)
+ +[0-9a-f]+: 44 00 48 00 l\.jr r9
+ +[0-9a-f]+: 9c 21 00 04 l\.addi r1,r1,4
diff --git a/ld/testsuite/ld-or1k/gotha1.s b/ld/testsuite/ld-or1k/gotha1.s
new file mode 100644
index 0000000..42b16db
--- /dev/null
+++ b/ld/testsuite/ld-or1k/gotha1.s
@@ -0,0 +1,24 @@
+ .data
+ .p2align 16
+
+ .text
+ .globl _start
+_start:
+ l.addi r1, r1, -4
+ l.sw 0(r1), r9
+
+ l.jal 8
+ l.movhi r19, gotpchi(_GLOBAL_OFFSET_TABLE_-4)
+ l.ori r19, r19, gotpclo(_GLOBAL_OFFSET_TABLE_+0)
+ l.add r19, r19, r9
+
+ l.movhi r17, gotha(x)
+ l.add r17, r17, r19
+ l.lwz r17, got(x)(r17)
+ l.lwz r3, 0(r17)
+
+ l.jal plt(func)
+ l.nop
+ l.lwz r9, 0(r1)
+ l.jr r9
+ l.addi r1, r1, 4
diff --git a/ld/testsuite/ld-or1k/gotha2.dd b/ld/testsuite/ld-or1k/gotha2.dd
new file mode 100644
index 0000000..fe09da5
--- /dev/null
+++ b/ld/testsuite/ld-or1k/gotha2.dd
@@ -0,0 +1,21 @@
+
+.*\.x: file format elf32-or1k
+
+
+Disassembly of section \.text:
+
+[0-9a-f]+ <test>:
+ +[0-9a-f]+: 9c 21 ff f8 l\.addi r1,r1,-8
+ +[0-9a-f]+: d4 01 80 00 l\.sw 0\(r1\),r16
+ +[0-9a-f]+: d4 01 48 04 l\.sw 4\(r1\),r9
+ +[0-9a-f]+: 04 00 [0-9a-f]+ [0-9a-f]+ l\.jal [0-9a-f]+ <test\+0x14>
+ +[0-9a-f]+: 1a 00 00 00 l\.movhi r16,0x0
+ +[0-9a-f]+: aa 10 [0-9a-f]+ [0-9a-f]+ l\.ori r16,r16,0x[0-9a-f]+
+ +[0-9a-f]+: e2 10 48 00 l\.add r16,r16,r9
+ +[0-9a-f]+: 1a 20 00 00 l\.movhi r17,0x0
+ +[0-9a-f]+: e2 31 80 00 l\.add r17,r17,r16
+ +[0-9a-f]+: 86 31 00 0c l\.lwz r17,12\(r17\)
+ +[0-9a-f]+: 85 21 00 04 l\.lwz r9,4\(r1\)
+ +[0-9a-f]+: 86 01 00 00 l\.lwz r16,0\(r1\)
+ +[0-9a-f]+: 44 00 48 00 l\.jr r9
+ +[0-9a-f]+: 9c 21 00 08 l\.addi r1,r1,8
diff --git a/ld/testsuite/ld-or1k/gotha2.s b/ld/testsuite/ld-or1k/gotha2.s
new file mode 100644
index 0000000..164b282
--- /dev/null
+++ b/ld/testsuite/ld-or1k/gotha2.s
@@ -0,0 +1,22 @@
+ .section .text
+ .align 4
+ .global test
+ .type test, @function
+test:
+ l.addi r1, r1, -8
+ l.sw 0(r1), r16
+ l.sw 4(r1), r9
+
+ l.jal 8
+ l.movhi r16, gotpchi(_GLOBAL_OFFSET_TABLE_-4)
+ l.ori r16, r16, gotpclo(_GLOBAL_OFFSET_TABLE_+0)
+ l.add r16, r16, r9
+
+ l.movhi r17, gotha(i)
+ l.add r17, r17, r16
+ l.lwz r17, got(i)(r17)
+
+ l.lwz r9, 4(r1)
+ l.lwz r16, 0(r1)
+ l.jr r9
+ l.addi r1, r1, 8
diff --git a/ld/testsuite/ld-or1k/or1k.exp b/ld/testsuite/ld-or1k/or1k.exp
index 8bb943a..f10949e 100644
--- a/ld/testsuite/ld-or1k/or1k.exp
+++ b/ld/testsuite/ld-or1k/or1k.exp
@@ -53,6 +53,14 @@ set or1kplttests {
"" {plt1.s}
{{objdump -dr plt1.x.dd}}
"plt1.x"}
+ {"gotha exec plt" "tmpdir/libpltlib.so" ""
+ "" {gotha1.s}
+ {{objdump -dr gotha1.dd}}
+ "gotha1.x"}
+ {"gotha -fpic -shared" "-fpic -shared" ""
+ "" {gotha2.s}
+ {{objdump -dr gotha2.dd}}
+ "gotha2.x"}
}
# Not implemented yet
diff --git a/ld/testsuite/ld-or1k/pltlib.s b/ld/testsuite/ld-or1k/pltlib.s
index baf76ca..8b4d7ba 100644
--- a/ld/testsuite/ld-or1k/pltlib.s
+++ b/ld/testsuite/ld-or1k/pltlib.s
@@ -1,5 +1,6 @@
.section .data
.globl x, y
+ .size x, 4
x: .long 33
y: .long 44