From b175e75d2b247b3687061cf51174e72f8ada4aca Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Wed, 3 Apr 2019 18:15:00 -0700 Subject: Use target features section in wasm-opt (#1967) If the user does not supply features explicitly on the command line, read and use the features in the target features section for validation and passes. If the user does supply features explicitly, error if they are not a superset of the features marked as used in the target features section and the user does not explicitly handle this. --- src/tools/wasm2js.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/tools/wasm2js.cpp') diff --git a/src/tools/wasm2js.cpp b/src/tools/wasm2js.cpp index 277a4e2c9..6a55c4483 100644 --- a/src/tools/wasm2js.cpp +++ b/src/tools/wasm2js.cpp @@ -81,6 +81,7 @@ int main(int argc, const char *argv[]) { ModuleReader reader; reader.setDebug(options.debug); reader.read(input, wasm, ""); + options.calculateFeatures(wasm); } else { auto input( read_file>(options.extra["infile"], Flags::Text, options.debug ? Flags::Debug : Flags::Release)); @@ -99,7 +100,7 @@ int main(int argc, const char *argv[]) { } if (options.passOptions.validate) { - if (!WasmValidator().validate(wasm, options.getFeatures())) { + if (!WasmValidator().validate(wasm, options.passOptions.features)) { WasmPrinter::printModule(&wasm); Fatal() << "error in validating input"; } -- cgit v1.2.3