summaryrefslogtreecommitdiff
path: root/src/passes/RoundTrip.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/RoundTrip.cpp')
-rw-r--r--src/passes/RoundTrip.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/passes/RoundTrip.cpp b/src/passes/RoundTrip.cpp
index 392710617..628cc5d4e 100644
--- a/src/passes/RoundTrip.cpp
+++ b/src/passes/RoundTrip.cpp
@@ -33,13 +33,14 @@ struct RoundTrip : public Pass {
void run(PassRunner* runner, Module* module) override {
BufferWithRandomAccess buffer;
// Save features, which would not otherwise make it through a round trip if
- // the target features section has been stripped.
+ // the target features section has been stripped. We also need them in order
+ // to tell the builder which features to build with.
auto features = module->features;
// Write, clear, and read the module
WasmBinaryWriter(module, buffer).write();
ModuleUtils::clearModule(*module);
auto input = buffer.getAsChars();
- WasmBinaryBuilder parser(*module, input);
+ WasmBinaryBuilder parser(*module, features, input);
parser.setDWARF(runner->options.debugInfo);
try {
parser.read();
@@ -48,8 +49,6 @@ struct RoundTrip : public Pass {
std::cerr << '\n';
Fatal() << "error in parsing wasm binary";
}
- // Reapply features
- module->features = features;
}
};