summaryrefslogtreecommitdiff
path: root/spec/elf.fspec
diff options
context:
space:
mode:
Diffstat (limited to 'spec/elf.fspec')
-rw-r--r--spec/elf.fspec57
1 files changed, 28 insertions, 29 deletions
diff --git a/spec/elf.fspec b/spec/elf.fspec
index e6059c7..5bd9954 100644
--- a/spec/elf.fspec
+++ b/spec/elf.fspec
@@ -1,36 +1,35 @@
-1 + 5 + 2 * 5 / 2;
-
-enum foo {
- foo: 0x1;
- bar: 0x2;
- eaf: 0x3;
- eaf: 0xDEADBEEF;
- bar;
+struct elf32 {
+ u32 e_entry hex;
+ u32 e_phoff;
+ u32 e_shoff;
};
struct elf64 {
- e_entry: u64 hex;
- e_phoff: u64;
- e_shoff: u64;
+ u64 e_entry hex;
+ u64 e_phoff;
+ u64 e_shoff;
};
struct elf {
- ei_magic: u8[4] | matches('\x7fELF') str;
- ei_class: u8 hex; // word size
- ei_data: u8 hex; // endianess
- ei_version: u8;
- ei_osabi: u8;
- ei_abi_version: u8;
- padding: u8[7] nul;
- e_type: u16 hex;
- e_machine: u16 hex;
- e_version: u32;
- elf64: struct elf64; // fspec needs union to parse ei_class != 2 type
- e_flags: u32 hex;
- e_ehsz: u16;
- e_phentsize: u16;
- e_phnum: u16;
- e_shentsize: u16;
- e_shnum: u16;
- e_shstrndx: u16;
+ u8 ei_magic[4] | matches('\x7fELF') str;
+ u8 ei_class hex; // word size
+ u8 ei_data hex; // endianess
+ u8 ei_version;
+ u8 ei_osabi;
+ u8 ei_abi_version;
+ u8 padding[7] nul;
+ u16 e_type hex;
+ u16 e_machine hex;
+ u32 e_version;
+ select (ei_class) {
+ 1) struct elf32 elf32;
+ 2) struct elf64 elf64;
+ } arch;
+ u32 e_flags hex;
+ u16 e_ehsz;
+ u16 e_phentsize;
+ u16 e_phnum;
+ u16 e_shentsize;
+ u16 e_shnum;
+ u16 e_shstrndx;
};