From 2198478cd22cec4ea2b645d4e9f31ee9c2508ff5 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Tue, 9 Oct 2018 08:49:46 +0300 Subject: push for remote work --- spec/elf.fspec | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'spec/elf.fspec') diff --git a/spec/elf.fspec b/spec/elf.fspec index 6f70459..a9eb1a0 100644 --- a/spec/elf.fspec +++ b/spec/elf.fspec @@ -198,9 +198,23 @@ struct elf { u16 e_shnum; u16 e_shstrndx; - // TODO: need to handle offsets - struct program_header e_ph[e_phnum:e_phentsize]; - struct section_header e_sh[e_shnum:e_shentsize]; + // TODO: would be nicer if we didn't need this select + select (e_ident.ei_class) { + e_ident.CLASS_32) + struct { + seek(arch.elf32.e_phoff); + struct program_header e_ph[e_phnum:e_phentsize]; + seek(arch.elf32.e_shoff); + struct section_header e_sh[e_shnum:e_shentsize]; + } elf32; + e_ident.CLASS_64) + struct { + seek(arch.elf64.e_phoff); + struct program_header e_ph[e_phnum:e_phentsize]; + seek(arch.elf64.e_shoff); + struct section_header e_sh[e_shnum:e_shentsize]; + } elf64; + } headers; }; select (e_ident.ei_data) { -- cgit v1.2.3