Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple custom sections with the same name #1320

Merged
merged 2 commits into from
Mar 21, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/runtime-core/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub struct ModuleInfo {
pub em_symbol_map: Option<HashMap<u32, String>>,

/// 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
/// will be generated.
Expand All @@ -102,7 +102,8 @@ impl ModuleInfo {
let bytes = reader.read_bytes(len)?;
let data = bytes.to_vec();
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(())
Expand Down