Merge branch 'master' into features/global-value-offset

This commit is contained in:
Syrus Akbary 2018-11-18 21:05:55 -08:00
commit 39e1f59311

View File

@ -120,9 +120,9 @@ pub struct InstanceOptions {
pub isa: Box<TargetIsa>, pub isa: Box<TargetIsa>,
} }
// extern fn mock_fn() -> i32 { extern fn mock_fn() -> i32 {
// return 0; return 0;
// } }
impl Instance { impl Instance {
pub const TABLES_OFFSET: usize = 0; // 0 on 64-bit | 0 on 32-bit pub const TABLES_OFFSET: usize = 0; // 0 on 64-bit | 0 on 32-bit
@ -161,19 +161,19 @@ impl Instance {
for (module, field) in module.info.imported_funcs.iter() { for (module, field) in module.info.imported_funcs.iter() {
let imported = import_object let imported = import_object
.get(&module.as_str(), &field.as_str()); .get(&module.as_str(), &field.as_str());
let function = match imported { let function: &*const u8 = match imported {
Some(ImportValue::Func(f)) => f, Some(ImportValue::Func(f)) => f,
None => { None => {
// if options.mock_missing_imports { if options.mock_missing_imports {
// debug!("The import {}.{} is not provided, therefore will be mocked.", module, field); debug!("The import {}.{} is not provided, therefore will be mocked.", module, field);
// mock_fn as *const u8 &(mock_fn as *const u8)
// } }
// else { else {
return Err(ErrorKind::LinkError(format!( return Err(ErrorKind::LinkError(format!(
"Imported function {}.{} was not provided in the import_functions", "Imported function {}.{} was not provided in the import_functions",
module, field module, field
))); )));
// } }
}, },
other => panic!("Expected function import, received {:?}", other) other => panic!("Expected function import, received {:?}", other)
}; };