summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJérôme Vouillon <jerome.vouillon@gmail.com>2024-04-02 13:10:52 -0400
committerGitHub <noreply@github.com>2024-04-02 10:10:52 -0700
commit35df5043764b41d7c23d15db5518cfe8becb3564 (patch)
tree15b516baf8bb21a4300309a7b9261e6afcc5e7d0 /src
parent4e2ebbd6de6f99e5972654b3f50ddbc1c6839a73 (diff)
downloadbinaryen-35df5043764b41d7c23d15db5518cfe8becb3564.tar.gz
binaryen-35df5043764b41d7c23d15db5518cfe8becb3564.tar.bz2
binaryen-35df5043764b41d7c23d15db5518cfe8becb3564.zip
Fix writing of data segment names in name section (#6462)
- Output segment names even when no memory is declared. - Only write explicit names.
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-binary.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index f9a643d66..28a630c4a 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -1067,7 +1067,7 @@ void WasmBinaryWriter::writeNames() {
}
// data segment names
- if (!wasm->memories.empty()) {
+ {
Index count = 0;
for (auto& seg : wasm->dataSegments) {
if (seg->hasExplicitName) {
@@ -1081,7 +1081,7 @@ void WasmBinaryWriter::writeNames() {
o << U32LEB(count);
for (Index i = 0; i < wasm->dataSegments.size(); i++) {
auto& seg = wasm->dataSegments[i];
- if (seg->name.is()) {
+ if (seg->hasExplicitName) {
o << U32LEB(i);
writeEscapedName(seg->name.str);
}