aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog17
-rw-r--r--ld/testsuite/ld-bpf/call-2.d20
-rw-r--r--ld/testsuite/ld-bpf/call-2.s3
-rw-r--r--ld/testsuite/ld-bpf/reloc-data-be.d11
-rw-r--r--ld/testsuite/ld-bpf/reloc-data-le.d11
-rw-r--r--ld/testsuite/ld-bpf/reloc-data.s16
-rw-r--r--ld/testsuite/ld-bpf/reloc-insn-external-be.d16
-rw-r--r--ld/testsuite/ld-bpf/reloc-insn-external-le.d16
-rw-r--r--ld/testsuite/ld-bpf/reloc-insn-external.s5
-rw-r--r--ld/testsuite/ld-bpf/reloc-insn32-be.d19
-rw-r--r--ld/testsuite/ld-bpf/reloc-insn32-le.d19
-rw-r--r--ld/testsuite/ld-bpf/reloc-insn32.s20
-rw-r--r--ld/testsuite/ld-bpf/reloc-insn64-be.d12
-rw-r--r--ld/testsuite/ld-bpf/reloc-insn64-le.d12
-rw-r--r--ld/testsuite/ld-bpf/reloc-insn64.s9
15 files changed, 206 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index b413418..d46e976 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,20 @@
+2020-08-05 David Faust <david.faust@oracle.com>
+
+ * testsuite/ld-bpf/call-2.s: New file.
+ * testsuite/ld-bpf/call-2.d: Likewise.
+ * testsuite/ld-bpf/reloc-data-be.d: Likewise.
+ * testsuite/ld-bpf/reloc-data-le.d: Likewise.
+ * testsuite/ld-bpf/reloc-data.s: Likewise.
+ * testsuite/ld-bpf/reloc-insn-external-be.d: Likewise.
+ * testsuite/ld-bpf/reloc-insn-external-le.d: Likewise.
+ * testsuite/ld-bpf/reloc-insn-external.s: Likewise.
+ * testsuite/ld-bpf/reloc-insn32-be.d: Likewise.
+ * testsuite/ld-bpf/reloc-insn32-le.d: Likewise.
+ * testsuite/ld-bpf/reloc-insn32.s: Likewise.
+ * testsuite/ld-bpf/reloc-insn64-be.d: Likewise.
+ * testsuite/ld-bpf/reloc-insn64-le.d: Likewise.
+ * testsuite/ld-bpf/reloc-insn64.s: Likewise.
+
2020-08-06 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* emultempl/msp430.em (change_output_section): Update the tail
diff --git a/ld/testsuite/ld-bpf/call-2.d b/ld/testsuite/ld-bpf/call-2.d
new file mode 100644
index 0000000..3d09095
--- /dev/null
+++ b/ld/testsuite/ld-bpf/call-2.d
@@ -0,0 +1,20 @@
+#as: --EL
+#source: call-2.s
+#source: bar.s
+#objdump: -dr
+#ld: -EL
+#name: CALL with disp32 reloc and addend
+
+.*: +file format .*bpf.*
+
+Disassembly of section .text:
+
+[0-9a-f]+ <.*>:
+ *[0-9a-f]+: b7 01 00 00 01 00 00 00 mov %r1,1
+ *[0-9a-f]+: 85 10 00 00 02 00 00 00 call 2
+ *[0-9a-f]+: 95 00 00 00 00 00 00 00 exit
+
+[0-9a-f]+ <bar>:
+ *[0-9a-f]+: bf 21 00 00 00 00 00 00 mov %r1,%r2
+ *[0-9a-f]+: bf 13 00 00 00 00 00 00 mov %r3,%r1
+ *[0-9a-f]+: 95 00 00 00 00 00 00 00 exit
diff --git a/ld/testsuite/ld-bpf/call-2.s b/ld/testsuite/ld-bpf/call-2.s
new file mode 100644
index 0000000..e2a5b90
--- /dev/null
+++ b/ld/testsuite/ld-bpf/call-2.s
@@ -0,0 +1,3 @@
+ mov %r1, 1
+ call bar + 0x1
+ exit
diff --git a/ld/testsuite/ld-bpf/reloc-data-be.d b/ld/testsuite/ld-bpf/reloc-data-be.d
new file mode 100644
index 0000000..4d793e2
--- /dev/null
+++ b/ld/testsuite/ld-bpf/reloc-data-be.d
@@ -0,0 +1,11 @@
+#as: --EB
+#source: reloc-data.s
+#objdump: -s
+#ld: -Tdata=0x20 -EB
+#name: data relocs BE
+
+.*: file format .*-bpfbe
+
+Contents of section \.data:
+ 0020 666f6f00 62617200 00000000 00000020 .*
+ 0030 00000028 003034 .*
diff --git a/ld/testsuite/ld-bpf/reloc-data-le.d b/ld/testsuite/ld-bpf/reloc-data-le.d
new file mode 100644
index 0000000..97cb1b3
--- /dev/null
+++ b/ld/testsuite/ld-bpf/reloc-data-le.d
@@ -0,0 +1,11 @@
+#as: --EL
+#source: reloc-data.s
+#objdump: -s
+#ld: -Tdata=0x20 -EL
+#name: data relocs LE
+
+.*: file format .*-bpfle
+
+Contents of section \.data:
+ 0020 666f6f00 62617200 20000000 00000000 .*
+ 0030 28000000 300034 .*
diff --git a/ld/testsuite/ld-bpf/reloc-data.s b/ld/testsuite/ld-bpf/reloc-data.s
new file mode 100644
index 0000000..431ef5a
--- /dev/null
+++ b/ld/testsuite/ld-bpf/reloc-data.s
@@ -0,0 +1,16 @@
+ .data
+foo:
+ .string "foo"
+
+ .global bar
+bar:
+ .string "bar"
+
+d64:
+ .quad foo
+d32:
+ .word d64
+d16:
+ .half d32
+d8:
+ .byte d16
diff --git a/ld/testsuite/ld-bpf/reloc-insn-external-be.d b/ld/testsuite/ld-bpf/reloc-insn-external-be.d
new file mode 100644
index 0000000..032d364
--- /dev/null
+++ b/ld/testsuite/ld-bpf/reloc-insn-external-be.d
@@ -0,0 +1,16 @@
+#as: --EB
+#source: reloc-data.s
+#source: reloc-insn-external.s
+#objdump: -dr
+#ld: -Tdata=0x20 -EB
+#name: reloc insn external BE
+
+.*: +file format .*bpfbe
+
+Disassembly of section .text:
+
+[0-9a-f]+ <.*>:
+ *[0-9a-f]+: 18 10 00 00 00 00 00 28[ ]*lddw %r1,0x28
+ *[0-9a-f]+: 00 00 00 00 00 00 00 00[ ]*
+ *[0-9a-f]+: b7 20 00 00 00 00 00 26[ ]*mov %r2,0x26
+ *[0-9a-f]+: 61 34 00 24 00 00 00 00[ ]*ldxw %r3,\[%r4\+0x24\]
diff --git a/ld/testsuite/ld-bpf/reloc-insn-external-le.d b/ld/testsuite/ld-bpf/reloc-insn-external-le.d
new file mode 100644
index 0000000..d351376
--- /dev/null
+++ b/ld/testsuite/ld-bpf/reloc-insn-external-le.d
@@ -0,0 +1,16 @@
+#as: --EL
+#source: reloc-data.s
+#source: reloc-insn-external.s
+#objdump: -dr
+#ld: -Tdata=0x20 -EL
+#name: reloc insn external LE
+
+.*: +file format .*bpfle
+
+Disassembly of section .text:
+
+[0-9a-f]+ <.*>:
+ *[0-9a-f]+: 18 01 00 00 28 00 00 00[ ]*lddw %r1,0x28
+ *[0-9a-f]+: 00 00 00 00 00 00 00 00[ ]*
+ *[0-9a-f]+: b7 02 00 00 26 00 00 00[ ]*mov %r2,0x26
+ *[0-9a-f]+: 61 43 24 00 00 00 00 00[ ]*ldxw %r3,\[%r4\+0x24\]
diff --git a/ld/testsuite/ld-bpf/reloc-insn-external.s b/ld/testsuite/ld-bpf/reloc-insn-external.s
new file mode 100644
index 0000000..be12813
--- /dev/null
+++ b/ld/testsuite/ld-bpf/reloc-insn-external.s
@@ -0,0 +1,5 @@
+
+ lddw %r1, bar + 4
+ mov %r2, bar + 2
+
+ ldxw %r3, [%r4 + bar]
diff --git a/ld/testsuite/ld-bpf/reloc-insn32-be.d b/ld/testsuite/ld-bpf/reloc-insn32-be.d
new file mode 100644
index 0000000..27d592d
--- /dev/null
+++ b/ld/testsuite/ld-bpf/reloc-insn32-be.d
@@ -0,0 +1,19 @@
+#as: --EB
+#source: reloc-insn32.s
+#objdump: -d
+#ld: -Tdata=0xdabeef -EB
+#name: reloc INSN32 BE
+
+.*: +file format .*bpfbe
+
+Disassembly of section .text:
+
+[0-9a-f]+ <main>:
+ *[0-9a-f]+: b7 10 00 00 00 da be f3[ ]*mov %r1,0xdabef3
+ *[0-9a-f]+: 16 10 00 02 00 da be f3[ ]*jeq32 %r1,0xdabef3,2
+ *[0-9a-f]+: 38 00 00 00 00 da be ff[ ]*ldabsdw 0xdabeff
+ *[0-9a-f]+: 95 00 00 00 00 00 00 00[ ]*exit
+
+[0-9a-f]+ <baz>:
+ *[0-9a-f]+: 07 10 00 00 00 da be ef[ ]*add %r1,0xdabeef
+ *[0-9a-f]+: 62 20 00 08 00 da be f7[ ]*stw \[%r2\+8\],0xdabef7
diff --git a/ld/testsuite/ld-bpf/reloc-insn32-le.d b/ld/testsuite/ld-bpf/reloc-insn32-le.d
new file mode 100644
index 0000000..bdbb45f
--- /dev/null
+++ b/ld/testsuite/ld-bpf/reloc-insn32-le.d
@@ -0,0 +1,19 @@
+#as: --EL
+#source: reloc-insn32.s
+#objdump: -d
+#ld: -Tdata=0xdabeef -EL
+#name: reloc INSN32 LE
+
+.*: +file format .*bpfle
+
+Disassembly of section .text:
+
+[0-9a-f]+ <main>:
+ *[0-9a-f]+: b7 01 00 00 f3 be da 00[ ]*mov %r1,0xdabef3
+ *[0-9a-f]+: 16 01 02 00 f3 be da 00[ ]*jeq32 %r1,0xdabef3,2
+ *[0-9a-f]+: 38 00 00 00 ff be da 00[ ]*ldabsdw 0xdabeff
+ *[0-9a-f]+: 95 00 00 00 00 00 00 00[ ]*exit
+
+[0-9a-f]+ <baz>:
+ *[0-9a-f]+: 07 01 00 00 ef be da 00[ ]*add %r1,0xdabeef
+ *[0-9a-f]+: 62 02 08 00 f7 be da 00[ ]*stw \[%r2\+8\],0xdabef7
diff --git a/ld/testsuite/ld-bpf/reloc-insn32.s b/ld/testsuite/ld-bpf/reloc-insn32.s
new file mode 100644
index 0000000..a53a0dc
--- /dev/null
+++ b/ld/testsuite/ld-bpf/reloc-insn32.s
@@ -0,0 +1,20 @@
+ .data
+foo:
+ .string "foo"
+bar:
+ .string "bar"
+d64:
+ .dword bar
+d32:
+ .word d64
+
+ .text
+main:
+ mov %r1, bar
+ jeq32 %r1, bar, baz
+ ldabsdw d32
+ exit
+
+baz:
+ add %r1, foo
+ stw [%r2 + 8], d64
diff --git a/ld/testsuite/ld-bpf/reloc-insn64-be.d b/ld/testsuite/ld-bpf/reloc-insn64-be.d
new file mode 100644
index 0000000..ca74e33
--- /dev/null
+++ b/ld/testsuite/ld-bpf/reloc-insn64-be.d
@@ -0,0 +1,12 @@
+#as: --EB
+#source: reloc-insn64.s
+#objdump: -s
+#ld: -Tdata=0xdeadbeef1234 -EB
+#name: reloc INSN64 big-endian
+
+.*: file format .*-bpfbe
+
+#...
+Contents of section \.text:
+[ ][0-9a-f]+ 18100000 beef1238 00000000 0000dead .*
+#pass
diff --git a/ld/testsuite/ld-bpf/reloc-insn64-le.d b/ld/testsuite/ld-bpf/reloc-insn64-le.d
new file mode 100644
index 0000000..63dcce3
--- /dev/null
+++ b/ld/testsuite/ld-bpf/reloc-insn64-le.d
@@ -0,0 +1,12 @@
+#as: --EL
+#source: reloc-insn64.s
+#objdump: -s
+#ld: -Tdata=0xdeadbeef1234 -EL
+#name: reloc INSN64 little-endian
+
+.*: file format .*-bpfle
+
+#...
+Contents of section \.text:
+[ ][0-9a-f]+ 18010000 3812efbe 00000000 adde0000 .*
+#pass
diff --git a/ld/testsuite/ld-bpf/reloc-insn64.s b/ld/testsuite/ld-bpf/reloc-insn64.s
new file mode 100644
index 0000000..8cb1d9f
--- /dev/null
+++ b/ld/testsuite/ld-bpf/reloc-insn64.s
@@ -0,0 +1,9 @@
+ .data
+x:
+ .string "foo"
+y:
+ .string "bar"
+
+ .text
+main:
+ lddw %r1, y