summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm-binary.h8
-rw-r--r--test/emcc_hello_world.wast.fromBinary2
-rw-r--r--test/unit.wast.fromBinary4
3 files changed, 9 insertions, 5 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index 3f00b9094..72c8c0df2 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -501,6 +501,10 @@ public:
assert(size <= std::numeric_limits<uint16_t>::max());
if (debug) std::cerr << "body size: " << size << ", writing at " << sizePos << ", next starts at " << o.size() << std::endl;
o.writeAt(sizePos, uint32_t(size)); // XXX int32, diverge from v8 format, to get more code to compile
+ } else {
+ // import
+ emitString(import->module.str); // XXX diverge
+ emitString(import->base.str); // from v8
}
}
}
@@ -1094,8 +1098,8 @@ public:
if (import) {
auto imp = allocator.alloc<Import>();
imp->name = name;
- imp->module = ENV;
- imp->base = name;
+ imp->module = getString(); // XXX diverge
+ imp->base = getString(); // from v8
imp->type = type;
wasm.addImport(imp);
} else {
diff --git a/test/emcc_hello_world.wast.fromBinary b/test/emcc_hello_world.wast.fromBinary
index 36012a7ac..cb9dcf6bc 100644
--- a/test/emcc_hello_world.wast.fromBinary
+++ b/test/emcc_hello_world.wast.fromBinary
@@ -31,7 +31,7 @@
(import $_pthread_cleanup_push "env" "_pthread_cleanup_push" (param i32 i32))
(import $_sysconf "env" "_sysconf" (param i32) (result i32))
(import $___syscall146 "env" "___syscall146" (param i32 i32) (result i32))
- (import $f64-to-int "env" "f64-to-int" (param f64) (result i32))
+ (import $f64-to-int "asm2wasm" "f64-to-int" (param f64) (result i32))
(export "stackAlloc" $stackAlloc)
(export "stackSave" $stackSave)
(export "stackRestore" $stackRestore)
diff --git a/test/unit.wast.fromBinary b/test/unit.wast.fromBinary
index 9c2dfa3f2..472c2800a 100644
--- a/test/unit.wast.fromBinary
+++ b/test/unit.wast.fromBinary
@@ -10,8 +10,8 @@
(type $5 (func (result i32)))
(type $6 (func (param i32) (result i32)))
(import $_emscripten_asm_const_vi "env" "_emscripten_asm_const_vi")
- (import $f64-to-int "env" "f64-to-int" (param f64) (result i32))
- (import $f64-rem "env" "f64-rem" (param f64 f64) (result f64))
+ (import $f64-to-int "asm2wasm" "f64-to-int" (param f64) (result i32))
+ (import $f64-rem "asm2wasm" "f64-rem" (param f64 f64) (result f64))
(export "big_negative" $big_negative)
(table $z $big_negative $z $z $w $w $importedDoubles $w $z $cneg)
(func $big_negative