From 57d16fa90a4cc983bfbf68a3d6b9b342f0fd8dcd Mon Sep 17 00:00:00 2001 From: Morgan Thomas Date: Wed, 3 Apr 2024 23:18:13 -0400 Subject: [PATCH] wip: ELF file support --- elf/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elf/src/lib.rs b/elf/src/lib.rs index bf188e6..8bcb019 100644 --- a/elf/src/lib.rs +++ b/elf/src/lib.rs @@ -75,7 +75,8 @@ pub fn load_elf_object_file(file: Vec) -> Program { let mut data: BTreeMap> = BTreeMap::new(); for (section_header, section_data) in data_sections { for i in 0 .. (section_header.sh_size / 4) as usize { - data.insert(section_header.sh_addr.try_into().unwrap(), + data.insert(>::try_into(section_header.sh_addr).unwrap() + + >::try_into(i*4).unwrap(), Word([section_data[i*4], section_data[i*4+1], section_data[i*4+2], section_data[i*4+3]])); } }