From ced4b184b70015bd78db9b36ac9fdde6309983af Mon Sep 17 00:00:00 2001
From: David Li
Date: Mon, 11 Jan 2016 09:48:14 -0700
Subject: Load all ELF sections marked ALLOC
---
src/main.rs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
(limited to 'src')
diff --git a/src/main.rs b/src/main.rs
index e6b6385..143fcc8 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -54,8 +54,7 @@ fn load_program(memory: &mut memory::Memory,
let start = elf.file_header().entry as isa::Address;
for p in elf.section_headers() {
- let name = elf.section_name(p);
- if name == ".text" || name == ".sdata" || name == ".rodata" {
+ if p.flags.0 & elfloader::elf::SHF_ALLOC.0 != 0 {
memory.write_segment(mmu, elf.section_data(p), p.addr as usize);
}
}
--
cgit v1.2.3