Skip to content

Commit 248e061

Browse files
author
Mark McCaskey
committed
Support multiple custom sections with the same name
1 parent 04754aa commit 248e061

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/runtime-core/src/module.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ pub struct ModuleInfo {
7878
pub em_symbol_map: Option<HashMap<u32, String>>,
7979

8080
/// Custom sections.
81-
pub custom_sections: HashMap<String, Vec<u8>>,
81+
pub custom_sections: HashMap<String, Vec<Vec<u8>>>,
8282

8383
/// Flag controlling whether or not debug information for use in a debugger
8484
/// will be generated.
@@ -102,7 +102,8 @@ impl ModuleInfo {
102102
let bytes = reader.read_bytes(len)?;
103103
let data = bytes.to_vec();
104104
let name = name.to_string();
105-
self.custom_sections.insert(name, data);
105+
let entry: &mut Vec<Vec<u8>> = self.custom_sections.entry(name).or_default();
106+
entry.push(data);
106107
}
107108
}
108109
Ok(())

0 commit comments

Comments
 (0)