fix also bug with externalizer

This commit is contained in:
NikVolf 2017-07-25 18:47:03 +03:00
parent b2d04ea3a9
commit de3b30dab5
2 changed files with 13 additions and 5 deletions

View File

@ -89,6 +89,14 @@ pub fn externalize(
}
}
},
&mut elements::Section::Element(ref mut elements_section) => {
for ref mut segment in elements_section.entries_mut() {
// update all indirect call addresses initial values
for func_index in segment.members_mut() {
if *func_index >= import_funcs_total as u32 { *func_index += replaces.len() as u32; }
}
}
},
_ => { }
}
}

View File

@ -256,11 +256,11 @@ pub struct Set {
}
impl Set {
fn new(entries: HashMap<InstructionType, u32>) -> Self {
pub fn new(entries: HashMap<InstructionType, u32>) -> Self {
Set { entries: entries }
}
fn process(&self, opcode: &elements::Opcode) -> u32 {
pub fn process(&self, opcode: &elements::Opcode) -> u32 {
self.entries.get(&InstructionType::op(opcode)).map(|x| *x).unwrap_or(1)
}
}