Commit 5fac6f380e
src/link/Wasm/Flush.zig
@@ -657,7 +657,7 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void {
var group_index: u32 = 0;
var offset: u32 = undefined;
for (segment_ids, segment_offsets) |segment_id, segment_offset| {
- if (!import_memory and segment_id.isBss(wasm)) {
+ if (segment_id.isEmpty(wasm)) {
// It counted for virtual memory but it does not go into the binary.
continue;
}
src/link/Wasm.zig
@@ -1410,6 +1410,14 @@ pub const DataSegment = extern struct {
};
}
+ pub fn isEmpty(id: Id, wasm: *const Wasm) bool {
+ return switch (unpack(id, wasm)) {
+ .__zig_error_name_table => false,
+ .object => |i| i.ptr(wasm).payload.off == .none,
+ inline .uav_exe, .uav_obj, .nav_exe, .nav_obj => |i| i.value(wasm).code.off == .none,
+ };
+ }
+
pub fn size(id: Id, wasm: *const Wasm) u32 {
return switch (unpack(id, wasm)) {
.__zig_error_name_table => {