Skip to content

Commit d345393

Browse files
authored
wasm-merge: Validate at the very end (#7962)
Doing this at the end can catch more issues. For finding issues in the middle, pass-debug mode already does that.
1 parent 5a31d38 commit d345393

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/tools/wasm-merge.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -778,14 +778,6 @@ Input source maps can be specified by adding an -ism option right after the modu
778778
}
779779
}
780780

781-
// If we didn't validate after each merged module, validate once at the very
782-
// end. This won't catch problems at the earliest point, but is still useful.
783-
if (!PassRunner::getPassDebug() && options.passOptions.validate &&
784-
!WasmValidator().validate(merged)) {
785-
std::cout << merged << '\n';
786-
Fatal() << "error in validating final merged";
787-
}
788-
789781
// Fuse imports and exports now that everything is all together in the merged
790782
// module.
791783
fuseImportsAndExports(options.passOptions);
@@ -808,6 +800,13 @@ Input source maps can be specified by adding an -ism option right after the modu
808800
passRunner.run();
809801
}
810802

803+
// Without pass-debug mode, validate once at the very end.
804+
if (!PassRunner::getPassDebug() && options.passOptions.validate &&
805+
!WasmValidator().validate(merged)) {
806+
std::cout << merged << '\n';
807+
Fatal() << "error in validating final merged";
808+
}
809+
811810
// Output.
812811
if (options.extra.count("output") > 0) {
813812
ModuleWriter writer(options.passOptions);

0 commit comments

Comments
 (0)