From 605311211b457d9c9a08d354c8fbe40257c4d649 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 15 Jan 2025 19:43:31 -0800 Subject: [PATCH] wasm linker: omit data count section when value is zero --- src/link/Wasm/Flush.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/link/Wasm/Flush.zig b/src/link/Wasm/Flush.zig index c001b751d4..f862bcf427 100644 --- a/src/link/Wasm/Flush.zig +++ b/src/link/Wasm/Flush.zig @@ -820,7 +820,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { } // When the shared-memory option is enabled, we *must* emit the 'data count' section. - { + if (f.data_segment_groups.items.len > 0) { const header_offset = try reserveVecSectionHeader(gpa, binary_bytes); replaceVecSectionHeader(binary_bytes, header_offset, .data_count, @intCast(f.data_segment_groups.items.len)); }