We recently allowed printing expression contents with respect to features in the Print pass (#3537) and we needed that as part of enabling multi-table modules in the Binaryen IR (#3517). But after I updated the tests, I noticed there's a difference between .from-wast and .fromBinary test files, in that .from-wast files were generated correctly with the correct features, but .fromBinary files were always generated with all features disabled.
Now, for .fromBinary tests we use wasm-as to compile a .wasm binary, and then use wasm-dis to check the text output. But since wasm-dis does not have the feature options, the only way it can print with features is if the module has a features section, wasm-as does not have an option to emit.
Two solutions are possible in my view:
- Add feature options to
wasm-dis, so we have the flexibility to print with the desired features.
- Allow tools like
wasm-as and wasm-split to emit a features section, so the features are read and applied while parsing the binary in wasm-dis.
We recently allowed printing expression contents with respect to features in the Print pass (#3537) and we needed that as part of enabling multi-table modules in the Binaryen IR (#3517). But after I updated the tests, I noticed there's a difference between
.from-wastand.fromBinarytest files, in that.from-wastfiles were generated correctly with the correct features, but.fromBinaryfiles were always generated with all features disabled.Now, for
.fromBinarytests we usewasm-asto compile a .wasm binary, and then usewasm-disto check the text output. But sincewasm-disdoes not have the feature options, the only way it can print with features is if the module has a features section,wasm-asdoes not have an option to emit.Two solutions are possible in my view:
wasm-dis, so we have the flexibility to print with the desired features.wasm-asandwasm-splitto emit a features section, so the features are read and applied while parsing the binary inwasm-dis.