aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorJose E. Marchesi <jose.marchesi@oracle.com>2019-07-17 22:57:23 +0200
committerJose E. Marchesi <jose.marchesi@oracle.com>2019-07-17 22:57:23 +0200
commite0b989a6d74efbcdadac4974d0b8520ac31cd9b6 (patch)
tree5585c1fc5c6229a0c2415ea411cacb50349773c2 /gas/testsuite
parentd8f68fcb9378b5ab1c945fa676e11da15be56dd6 (diff)
downloadfsf-binutils-gdb-e0b989a6d74efbcdadac4974d0b8520ac31cd9b6.zip
fsf-binutils-gdb-e0b989a6d74efbcdadac4974d0b8520ac31cd9b6.tar.gz
fsf-binutils-gdb-e0b989a6d74efbcdadac4974d0b8520ac31cd9b6.tar.bz2
gas: support .half, .word and .dword directives in eBPF
This little patch adds support to the eBPF port of GAS for a few data directives. The names for the directives have been chosen to be coherent with the suffixes used in eBPF instructions: b, h, w and dw for 8, 16, 32 and 64-bit values respectively. Documentation and tests included. Tested in a x86_64 host. gas/ChangeLog: 2019-07-17 Jose E. Marchesi <jose.marchesi@oracle.com> * config/tc-bpf.c (md_pseudo_table): .half, .word and .dword. * testsuite/gas/bpf/data.s: New file. * testsuite/gas/bpf/data.d: Likewise. * testsuite/gas/bpf/data-be.d: Likewise. * testsuite/gas/bpf/bpf.exp: Run data and data-be. * doc/c-bpf.texi (BPF Directives): New section.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/bpf/bpf.exp2
-rw-r--r--gas/testsuite/gas/bpf/data-be.d9
-rw-r--r--gas/testsuite/gas/bpf/data.d8
-rw-r--r--gas/testsuite/gas/bpf/data.s4
4 files changed, 23 insertions, 0 deletions
diff --git a/gas/testsuite/gas/bpf/bpf.exp b/gas/testsuite/gas/bpf/bpf.exp
index e228fd4..f0b24ea 100644
--- a/gas/testsuite/gas/bpf/bpf.exp
+++ b/gas/testsuite/gas/bpf/bpf.exp
@@ -26,6 +26,7 @@ if {[istarget bpf*-*-*]} {
run_dump_test call
run_dump_test exit
run_dump_test atomic
+ run_dump_test data
run_dump_test lddw-be
run_dump_test alu-be
@@ -35,4 +36,5 @@ if {[istarget bpf*-*-*]} {
run_dump_test call-be
run_dump_test exit-be
run_dump_test atomic-be
+ run_dump_test data-be
}
diff --git a/gas/testsuite/gas/bpf/data-be.d b/gas/testsuite/gas/bpf/data-be.d
new file mode 100644
index 0000000..010f08f
--- /dev/null
+++ b/gas/testsuite/gas/bpf/data-be.d
@@ -0,0 +1,9 @@
+#as: --EB
+#source: data.s
+#objdump: -s -j .data
+#name: eBPF data directives, big endian
+
+.*: +file format .*bpf.*
+
+Contents of section \.data:
+ 0000 f00fdead beef1122 33445566 7788 .*
diff --git a/gas/testsuite/gas/bpf/data.d b/gas/testsuite/gas/bpf/data.d
new file mode 100644
index 0000000..6824e8b
--- /dev/null
+++ b/gas/testsuite/gas/bpf/data.d
@@ -0,0 +1,8 @@
+#as: --EL
+#objdump: -s -j .data
+#name: eBPF data directives
+
+.*: +file format .*bpf.*
+
+Contents of section \.data:
+ 0000 0ff0efbe adde8877 66554433 2211 .*
diff --git a/gas/testsuite/gas/bpf/data.s b/gas/testsuite/gas/bpf/data.s
new file mode 100644
index 0000000..b6e5528
--- /dev/null
+++ b/gas/testsuite/gas/bpf/data.s
@@ -0,0 +1,4 @@
+ .section .data
+ .half 0xf00f
+ .word 0xdeadbeef
+ .dword 0x1122334455667788