Skip to content

Commit 3fceedb

Browse files
committed
wasm-builder(cherry-pick): Also set mcpu for c deps (paritytech#3777)
1 parent 89e89d5 commit 3fceedb

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

substrate/utils/wasm-builder/src/wasm_project.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,12 @@ fn maybe_compact_and_compress_wasm(
245245
compact_blob_path.as_ref().and_then(|p| try_compress_blob(&p.0, blob_name));
246246
(compact_blob_path, compact_compressed_blob_path)
247247
} else {
248+
// We at least want to lower the `sign-ext` code to `mvp`.
249+
wasm_opt::OptimizationOptions::new_opt_level_0()
250+
.add_pass(wasm_opt::Pass::SignextLowering)
251+
.run(bloaty_blob_binary.bloaty_path(), bloaty_blob_binary.bloaty_path())
252+
.expect("Failed to lower sign-ext in WASM binary.");
253+
248254
(None, None)
249255
};
250256

@@ -783,18 +789,15 @@ impl BuildConfiguration {
783789
(None, false) => {
784790
let profile = Profile::Release;
785791
build_helper::warning!(
786-
"Unknown cargo profile `{}`. Defaulted to `{:?}` for the runtime build.",
787-
name,
788-
profile,
792+
"Unknown cargo profile `{name}`. Defaulted to `{profile:?}` for the runtime build.",
789793
);
790794
profile
791795
},
792796
// Invalid profile specified.
793797
(None, true) => {
794798
// We use println! + exit instead of a panic in order to have a cleaner output.
795799
println!(
796-
"Unexpected profile name: `{}`. One of the following is expected: {:?}",
797-
name,
800+
"Unexpected profile name: `{name}`. One of the following is expected: {:?}",
798801
Profile::iter().map(|p| p.directory()).collect::<Vec<_>>(),
799802
);
800803
process::exit(1);
@@ -963,13 +966,16 @@ fn compact_wasm(
963966
.mvp_features_only()
964967
.debug_info(true)
965968
.add_pass(wasm_opt::Pass::StripDwarf)
969+
.add_pass(wasm_opt::Pass::SignextLowering)
966970
.run(bloaty_binary.bloaty_path(), &wasm_compact_path)
967971
.expect("Failed to compact generated WASM binary.");
972+
968973
println!(
969974
"{} {}",
970975
colorize_info_message("Compacted wasm in"),
971976
colorize_info_message(format!("{:?}", start.elapsed()).as_str())
972977
);
978+
973979
Some(WasmBinary(wasm_compact_path))
974980
}
975981

0 commit comments

Comments
 (0)