aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-bpf.h
diff options
context:
space:
mode:
authorJose E. Marchesi <jose.marchesi@oracle.com>2019-05-23 19:05:12 +0200
committerJose E. Marchesi <jose.marchesi@oracle.com>2019-05-23 19:34:04 +0200
commitf8861f5dc2391e0c46dd118370195e7730ec46ca (patch)
treee348f2208eef2eb8d714c4a4224e65b997cfea94 /gas/config/tc-bpf.h
parent79472b45328232b083e897a511d4160a6dde0463 (diff)
downloadbinutils-f8861f5dc2391e0c46dd118370195e7730ec46ca.zip
binutils-f8861f5dc2391e0c46dd118370195e7730ec46ca.tar.gz
binutils-f8861f5dc2391e0c46dd118370195e7730ec46ca.tar.bz2
gas: add support for eBPF
This patch adds a port for the Linux kernel eBPF to the GNU assembler. A testsuite and documentation updates are included. gas/ChangeLog: 2019-05-23 Jose E. Marchesi <jose.marchesi@oracle.com> * configure.ac: Handle bpf-*-* targets. * configure.tgt (generic_target): Likewise. * configure: Regenerate. * Makefile.am (TARGET_CPU_CFILES): Add tc-bpf.c. (TARGET_CPU_HFILES): Add tc-bpf.h. * Makefile.in: Regenerated. * config/tc-bpf.c: New file. * config/tc-bpf.h: Likewise. * doc/Makefile.am (CPU_DOCS): Add c-bpf.texi. * doc/Makefile.in: Regenerated. * doc/all.texi: set BPF. * doc/as.texi: Add eBPF contents. * doc/c-bpf.texi: New file. * testsuite/gas/bpf/alu.d: New file. * testsuite/gas/bpf/mem-be.d: Likewise. * testsuite/gas/bpf/mem.s: Likewise. * testsuite/gas/bpf/mem.d: Likewise. * testsuite/gas/bpf/lddw-be.d: Likewise. * testsuite/gas/bpf/lddw.s: Likewise. * testsuite/gas/bpf/lddw.d: Likewise. * testsuite/gas/bpf/jump-be.d: Likewise. * testsuite/gas/bpf/jump.s: Likewise. * testsuite/gas/bpf/jump.d: Likewise. * testsuite/gas/bpf/exit-be.d: Likewise. * testsuite/gas/bpf/exit.s: Likewise. * testsuite/gas/bpf/exit.d: Likewise. * testsuite/gas/bpf/call-be.d: Likewise. * testsuite/gas/bpf/call.s: Likewise. * testsuite/gas/bpf/call.d: Likewise. * testsuite/gas/bpf/bpf.exp: Likewise. * testsuite/gas/bpf/atomic-be.d: Likewise. * testsuite/gas/bpf/atomic.s: Likewise. * testsuite/gas/bpf/atomic.d: Likewise. * testsuite/gas/bpf/alu-be.d: Likewise. * testsuite/gas/bpf/alu32-be.d: Likewise. * testsuite/gas/bpf/alu32.s: Likewise. * testsuite/gas/bpf/alu32.d: Likewise. * testsuite/gas/bpf/alu.s: Likewise. * testsuite/gas/all/gas.exp: Introduce a nop_type for eBPF. * testsuite/gas/all/org-1.s: Support nop_type 6. * testsuite/gas/all/org-1.l: Updated to reflect changes in org-1.s.
Diffstat (limited to 'gas/config/tc-bpf.h')
-rw-r--r--gas/config/tc-bpf.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/gas/config/tc-bpf.h b/gas/config/tc-bpf.h
new file mode 100644
index 0000000..310cbc0
--- /dev/null
+++ b/gas/config/tc-bpf.h
@@ -0,0 +1,51 @@
+/* tc-bpf.h -- Header file for tc-ebpf.c.
+ Copyright (C) 2019 Free Software Foundation, Inc.
+ Contributed by Oracle, Inc.
+
+ This file is part of GAS, the GNU Assembler.
+
+ GAS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ GAS is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GAS; see the file COPYING. If not, write to the Free
+ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
+ 02110-1301, USA. */
+
+#define TC_BPF
+
+#define LISTING_HEADER "BPF GAS "
+
+/* The target BFD architecture. */
+#define TARGET_ARCH bfd_arch_bpf
+#define TARGET_MACH 0 /* The default. */
+
+#define TARGET_FORMAT \
+ (target_big_endian ? "elf64-bpfbe" : "elf64-bpfle")
+
+/* This is used to set the default value for `target_big_endian'. */
+#ifndef TARGET_BYTES_BIG_ENDIAN
+#define TARGET_BYTES_BIG_ENDIAN 0
+#endif
+
+/* .-foo gets turned into PC relative relocs. */
+#define DIFF_EXPR_OK 1
+#define GAS_CGEN_PCREL_R_TYPE(R_TYPE) gas_cgen_pcrel_r_type (R_TYPE)
+
+/* Call md_pcrel_from_section(), not md_pcrel_from(). */
+#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)
+extern long md_pcrel_from_section (struct fix *, segT);
+
+/* We don't need to handle .word strangely. */
+#define WORKING_DOT_WORD
+
+/* Values passed to md_apply_fix don't include the symbol value. */
+#define MD_APPLY_SYM_VALUE(FIX) 0
+