xref: /netbsd-src/external/gpl3/binutils/dist/gas/config/tc-bpf.h (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
1 /* tc-bpf.h -- Header file for tc-ebpf.c.
2    Copyright (C) 2019-2024 Free Software Foundation, Inc.
3    Contributed by Oracle, Inc.
4 
5    This file is part of GAS, the GNU Assembler.
6 
7    GAS is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3, or (at your option)
10    any later version.
11 
12    GAS is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with GAS; see the file COPYING.  If not, write to the Free
19    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
20    02110-1301, USA.  */
21 
22 #define TC_BPF
23 
24 #define LISTING_HEADER "BPF GAS "
25 
26 /* The target BFD architecture.  */
27 #define TARGET_ARCH bfd_arch_bpf
28 #define TARGET_MACH 0 /* The default.  */
29 
30 #define TARGET_FORMAT                                                   \
31   (target_big_endian ? "elf64-bpfbe" : "elf64-bpfle")
32 
33 /* This is used to set the default value for `target_big_endian'.  */
34 #ifndef TARGET_BYTES_BIG_ENDIAN
35 #define TARGET_BYTES_BIG_ENDIAN 0
36 #endif
37 
38 /* Permit // comments.  */
39 #define DOUBLESLASH_LINE_COMMENTS 1
40 
41 /* .-foo gets turned into PC relative relocs.  */
42 #define DIFF_EXPR_OK    1
43 
44 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
45 #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)
46 
47 /* We don't need to handle .word strangely.  */
48 #define WORKING_DOT_WORD
49 
50 /* Values passed to md_apply_fix don't include the symbol value.  */
51 #define MD_APPLY_SYM_VALUE(FIX) 0
52 
53 /* The Linux kernel verifier expects NOPs to be encoded in this way;
54    a jump to offset 0 means jump to the next instruction.  */
55 #define md_single_noop_insn "ja 0"
56 
57 #define md_parse_name(name, exp, mode, c) \
58   bpf_parse_name (name, exp, mode)
59 bool bpf_parse_name (const char *, struct expressionS *, enum expr_mode);
60 
61 #define TC_EQUAL_IN_INSN(c, s) bpf_tc_equal_in_insn ((c), (s))
62 extern bool bpf_tc_equal_in_insn (int, char *);
63 
64 #define elf_tc_final_processing bpf_elf_final_processing
65 extern void bpf_elf_final_processing (void);
66