Index: test/mjsunit/wasm/wasm-module-builder.js |
diff --git a/test/mjsunit/wasm/wasm-module-builder.js b/test/mjsunit/wasm/wasm-module-builder.js |
index 4f4633cbd578881a888256a3a2f95a65325166df..900198d7d03efbde455a06e63eb269a8e47bc9ce 100644 |
--- a/test/mjsunit/wasm/wasm-module-builder.js |
+++ b/test/mjsunit/wasm/wasm-module-builder.js |
@@ -522,7 +522,12 @@ class WasmModuleBuilder { |
if (debug) print("emitting names @ " + binary.length); |
binary.emit_section(kUnknownSectionCode, section => { |
section.emit_string("name"); |
- section.emit_u32v(wasm.functions.length); |
+ var count = wasm.functions.length + wasm.num_imported_funcs; |
+ section.emit_u32v(count); |
+ for (var i = 0; i < wasm.num_imported_funcs; i++) { |
+ section.emit_u8(0); // empty string |
+ section.emit_u8(0); // local names count == 0 |
+ } |
for (let func of wasm.functions) { |
var name = func.name == undefined ? "" : func.name; |
section.emit_string(name); |