aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJose E. Marchesi <jose.marchesi@oracle.com>2023-07-30 22:39:30 +0200
committerJose E. Marchesi <jose.marchesi@oracle.com>2023-07-30 22:39:30 +0200
commit1e18ffc9915bb9d3bbcd934d8b3e57ae9fe82f60 (patch)
tree92abdac23f41629b636c939591747e6fe5571ad9 /include
parent0346042938539324a5052cc09023c1fe426e8b31 (diff)
downloadgdb-1e18ffc9915bb9d3bbcd934d8b3e57ae9fe82f60.zip
gdb-1e18ffc9915bb9d3bbcd934d8b3e57ae9fe82f60.tar.gz
gdb-1e18ffc9915bb9d3bbcd934d8b3e57ae9fe82f60.tar.bz2
bpf: include, bfd, opcodes: add EF_BPF_CPUVER ELF header flags
This patch adds support for EF_BPF_CPUVER bits in the ELF machine-dependent header flags. These bits encode the BPF CPU version for which the object file has been compiled for. The BPF assembler is updated so it annotates the object files it generates with these bits. The BPF disassembler is updated so it honors EF_BPF_CPUVER to use the appropriate ISA version if the user didn't specify an explicit ISA version in the command line. Note that a value of zero in EF_BPF_CPUVER is interpreted by the disassembler as "use the later supported version" (the BPF CPU versions start with v1.) The readelf utility is updated to pretty print EF_BPF_CPUVER when it prints out the ELF header: $ readelf -h a.out ELF Header: ... Flags: 0x4, CPU Version: 4 Tested in bpf-unknown-none. include/ChangeLog: 2023-07-30 Jose E. Marchesi <jose.marchesi@oracle.com> * elf/bpf.h (EF_BPF_CPUVER): Define. * opcode/bpf.h (BPF_XBPF): Change from 0xf to 0xff so it fits in EF_BPF_CPUVER. binutils/ChangeLog: 2023-07-30 Jose E. Marchesi <jose.marchesi@oracle.com> * readelf.c (get_machine_flags): Recognize and pretty print BPF machine flags. opcodes/ChangeLog: 2023-07-30 Jose E. Marchesi <jose.marchesi@oracle.com> * bpf-dis.c: Initialize asm_bpf_version to -1. (print_insn_bpf): Set BPF ISA version from the cpu version ELF header flags if no explicit version set in the command line. * disassemble.c (disassemble_init_for_target): Remove unused code. gas/ChangeLog: 2023-07-30 Jose E. Marchesi <jose.marchesi@oracle.com> * config/tc-bpf.h (elf_tc_final_processing): Define. * config/tc-bpf.c (bpf_elf_final_processing): New function.
Diffstat (limited to 'include')
-rw-r--r--include/ChangeLog6
-rw-r--r--include/elf/bpf.h5
-rw-r--r--include/opcode/bpf.h2
3 files changed, 12 insertions, 1 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index 11c1c09..4d40740 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,9 @@
+2023-07-30 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * elf/bpf.h (EF_BPF_CPUVER): Define.
+ * opcode/bpf.h (BPF_XBPF): Change from 0xf to 0xff so it fits in
+ EF_BPF_CPUVER.
+
2023-07-24 Jose E. Marchesi <jose.marchesi@oracle.com>
* opcode/bpf.h (BPF_IMM32_BSWAP16): Define.
diff --git a/include/elf/bpf.h b/include/elf/bpf.h
index d0fad08..e4d4162 100644
--- a/include/elf/bpf.h
+++ b/include/elf/bpf.h
@@ -37,4 +37,9 @@ START_RELOC_NUMBERS (elf_bpf_reloc_type)
RELOC_NUMBER (R_BPF_GNU_64_16, 256)
END_RELOC_NUMBERS (R_BPF_max)
+/* Processor specific flags for the ELF header e_flags field. */
+
+/* Version of the BPF ISA used in the file. */
+#define EF_BPF_CPUVER 0x0000000f
+
#endif /* _ELF_BPF_H */
diff --git a/include/opcode/bpf.h b/include/opcode/bpf.h
index 20e323a..6decae4 100644
--- a/include/opcode/bpf.h
+++ b/include/opcode/bpf.h
@@ -44,7 +44,7 @@ typedef uint64_t bpf_insn_word;
#define BPF_V2 0x2
#define BPF_V3 0x3
#define BPF_V4 0x4
-#define BPF_XBPF 0xff
+#define BPF_XBPF 0xf
/* Masks for the several instruction fields in a BPF instruction.
These assume big-endian BPF instructions. */