diff options
author | Alon Zakai <azakai@google.com> | 2024-11-06 19:11:39 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-06 19:11:39 -0800 |
commit | ab8a41c85ddb1ea783bc8a8832254f992262bed6 (patch) | |
tree | 13a3a209c1c4f7f3e1dc42da3dee908ef50abf64 /src/tools | |
parent | de680182bcd1d64d597538cfa4ad6857ce298bc3 (diff) | |
download | binaryen-ab8a41c85ddb1ea783bc8a8832254f992262bed6.tar.gz binaryen-ab8a41c85ddb1ea783bc8a8832254f992262bed6.tar.bz2 binaryen-ab8a41c85ddb1ea783bc8a8832254f992262bed6.zip |
[wasm64] Fix wasm-ctor-eval + utils on 64-bit indexes for memory64 (#7059)
Some places assumed a 32-bit index.
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/wasm-ctor-eval.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp index 72ad459d3..499c1bf6c 100644 --- a/src/tools/wasm-ctor-eval.cpp +++ b/src/tools/wasm-ctor-eval.cpp @@ -508,12 +508,14 @@ private: void applyMemoryToModule() { // Memory must have already been flattened into the standard form: one // segment at offset 0, or none. + auto& memory = wasm->memories[0]; if (wasm->dataSegments.empty()) { Builder builder(*wasm); auto curr = builder.makeDataSegment(); - curr->offset = builder.makeConst(int32_t(0)); + curr->offset = + builder.makeConst(Literal::makeFromInt32(0, memory->indexType)); curr->setName(Name::fromInt(0), false); - curr->memory = wasm->memories[0]->name; + curr->memory = memory->name; wasm->addDataSegment(std::move(curr)); } auto& segment = wasm->dataSegments[0]; @@ -521,7 +523,7 @@ private: // Copy the current memory contents after execution into the Module's // memory. - segment->data = memories[wasm->memories[0]->name]; + segment->data = memories[memory->name]; } // Serializing GC data requires more work than linear memory, because |