aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Li <li.davidm96@gmail.com>2016-01-11 09:48:14 -0700
committerDavid Li <li.davidm96@gmail.com>2016-01-11 09:48:14 -0700
commitced4b184b70015bd78db9b36ac9fdde6309983af (patch)
treeb945d74df1a61d1ef4b33230d745241239340449 /src
parent3b24e7334e0da860c69307918cbfa5ea50bf4e16 (diff)
Load all ELF sections marked ALLOC
Diffstat (limited to 'src')
-rw-r--r--src/main.rs3
1 files changed, 1 insertions, 2 deletions
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<T: memory::Mmu>(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);
}
}