aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Step/CheckObject.zig
diff options
context:
space:
mode:
authorLuuk de Gram <luuk@degram.dev>2023-07-17 20:22:25 +0200
committerLuuk de Gram <luuk@degram.dev>2023-07-19 17:22:46 +0200
commit1a3304ed236b60cd31c790bae929a78c58c9d33e (patch)
treef0cee69c44e49054a0641f6a6152578e46ffd2b6 /lib/std/Build/Step/CheckObject.zig
parent3fd6e93f4f6f34658d5e198064f54e1dad09e241 (diff)
downloadzig-1a3304ed236b60cd31c790bae929a78c58c9d33e.tar.gz
zig-1a3304ed236b60cd31c790bae929a78c58c9d33e.zip
test/link: add shared-memory test for WebAssembly
Diffstat (limited to 'lib/std/Build/Step/CheckObject.zig')
-rw-r--r--lib/std/Build/Step/CheckObject.zig17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/std/Build/Step/CheckObject.zig b/lib/std/Build/Step/CheckObject.zig
index 5c24d53722..0c74a4e40e 100644
--- a/lib/std/Build/Step/CheckObject.zig
+++ b/lib/std/Build/Step/CheckObject.zig
@@ -1012,6 +1012,10 @@ const WasmDumper = struct {
const start = try std.leb.readULEB128(u32, reader);
try writer.print("\nstart {d}\n", .{start});
},
+ .data_count => {
+ const count = try std.leb.readULEB128(u32, reader);
+ try writer.print("\ncount {d}\n", .{count});
+ },
else => {}, // skip unknown sections
}
}
@@ -1143,9 +1147,16 @@ const WasmDumper = struct {
.data => {
var i: u32 = 0;
while (i < entries) : (i += 1) {
- const index = try std.leb.readULEB128(u32, reader);
+ const flags = try std.leb.readULEB128(u32, reader);
+ const index = if (flags & 0x02 != 0)
+ try std.leb.readULEB128(u32, reader)
+ else
+ 0;
try writer.print("memory index 0x{x}\n", .{index});
- try parseDumpInit(step, reader, writer);
+ if (flags == 0) {
+ try parseDumpInit(step, reader, writer);
+ }
+
const size = try std.leb.readULEB128(u32, reader);
try writer.print("size {d}\n", .{size});
try reader.skipBytes(size, .{}); // we do not care about the content of the segments
@@ -1174,7 +1185,7 @@ const WasmDumper = struct {
}
fn parseDumpInit(step: *Step, reader: anytype, writer: anytype) !void {
- const byte = try std.leb.readULEB128(u8, reader);
+ const byte = try reader.readByte();
const opcode = std.meta.intToEnum(std.wasm.Opcode, byte) catch {
return step.fail("invalid wasm opcode '{d}'", .{byte});
};