mirror of
https://github.com/pezkuwichain/wasm-instrument.git
synced 2026-06-17 00:41:02 +00:00
make unknown-unknown primary
This commit is contained in:
+6
-11
@@ -14,7 +14,7 @@ use std::path::PathBuf;
|
||||
use clap::{App, Arg};
|
||||
use parity_wasm::elements;
|
||||
|
||||
use wasm_utils::{CREATE_SYMBOL, CALL_SYMBOL, underscore_funcs};
|
||||
use wasm_utils::{CREATE_SYMBOL, CALL_SYMBOL, MEMORY_SYMBOL, ununderscore_funcs};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {
|
||||
@@ -125,15 +125,7 @@ fn main() {
|
||||
let mut module = parity_wasm::deserialize_file(&path).unwrap();
|
||||
|
||||
if let source::SourceTarget::Unknown = source_input.target() {
|
||||
module = underscore_funcs(module);
|
||||
// Removes the start section for 'wasm32-unknown-unknown' target if exists
|
||||
module.sections_mut().retain(|section| {
|
||||
if let &elements::Section::Start(ref _a) = section {
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
});
|
||||
module = ununderscore_funcs(module);
|
||||
}
|
||||
|
||||
if let Some(runtime_type) = matches.value_of("runtime_type") {
|
||||
@@ -149,7 +141,10 @@ fn main() {
|
||||
let mut ctor_module = module.clone();
|
||||
|
||||
if !matches.is_present("skip_optimization") {
|
||||
wasm_utils::optimize(&mut module, vec![CALL_SYMBOL]).expect("Optimizer to finish without errors");
|
||||
wasm_utils::optimize(
|
||||
&mut module,
|
||||
vec![CALL_SYMBOL, MEMORY_SYMBOL]
|
||||
).expect("Optimizer to finish without errors");
|
||||
}
|
||||
|
||||
if let Some(save_raw_path) = matches.value_of("save_raw") {
|
||||
|
||||
Reference in New Issue
Block a user