mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-17 10:51:21 +00:00
Support multiple custom sections with the same name
This commit is contained in:
@ -78,7 +78,7 @@ pub struct ModuleInfo {
|
|||||||
pub em_symbol_map: Option<HashMap<u32, String>>,
|
pub em_symbol_map: Option<HashMap<u32, String>>,
|
||||||
|
|
||||||
/// Custom sections.
|
/// Custom sections.
|
||||||
pub custom_sections: HashMap<String, Vec<u8>>,
|
pub custom_sections: HashMap<String, Vec<Vec<u8>>>,
|
||||||
|
|
||||||
/// Flag controlling whether or not debug information for use in a debugger
|
/// Flag controlling whether or not debug information for use in a debugger
|
||||||
/// will be generated.
|
/// will be generated.
|
||||||
@ -102,7 +102,8 @@ impl ModuleInfo {
|
|||||||
let bytes = reader.read_bytes(len)?;
|
let bytes = reader.read_bytes(len)?;
|
||||||
let data = bytes.to_vec();
|
let data = bytes.to_vec();
|
||||||
let name = name.to_string();
|
let name = name.to_string();
|
||||||
self.custom_sections.insert(name, data);
|
let entry: &mut Vec<Vec<u8>> = self.custom_sections.entry(name).or_default();
|
||||||
|
entry.push(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Reference in New Issue
Block a user