From fd170f09fb2a95e29a9a4c71e18baa265577e18b Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Wed, 26 Sep 2018 16:02:58 +0300 Subject: Nicer elf spec --- spec/elf.fspec | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'spec') diff --git a/spec/elf.fspec b/spec/elf.fspec index 5bd9954..85c4fe7 100644 --- a/spec/elf.fspec +++ b/spec/elf.fspec @@ -1,13 +1,7 @@ -struct elf32 { - u32 e_entry hex; - u32 e_phoff; - u32 e_shoff; -}; - -struct elf64 { - u64 e_entry hex; - u64 e_phoff; - u64 e_shoff; +enum { + CLASS_NONE, + CLASS_32, + CLASS_64 }; struct elf { @@ -22,8 +16,16 @@ struct elf { u16 e_machine hex; u32 e_version; select (ei_class) { - 1) struct elf32 elf32; - 2) struct elf64 elf64; + CLASS_32) struct { + u32 e_entry hex; + u32 e_phoff; + u32 e_shoff; + } elf32; + CLASS_64) struct { + u64 e_entry hex; + u64 e_phoff; + u64 e_shoff; + } elf64; } arch; u32 e_flags hex; u16 e_ehsz; -- cgit v1.2.3