From be08d2bdbd2f64ccb9ef0f985a57a4bf89b9aebb Mon Sep 17 00:00:00 2001 From: Luuk de Gram Date: Sun, 17 Apr 2022 19:41:05 +0200 Subject: wasm: Fix unreachable paths When the last instruction is a debug instruction, the type of it is void. Similarly for 'noreturn' emit an 'unreachable' instruction to tell the wasm-validator the path cannot be reached. Also respect the '--strip' flag in the self-hosted wasm linker and not emit a 'name' section when the flag is set to `true`. --- src/link/Wasm.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/link') diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 1ed733774f..4f72dfe388 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -1897,7 +1897,7 @@ pub fn flushModule(self: *Wasm, comp: *Compilation, prog_node: *std.Progress.Nod if (data_section_index) |data_index| { try self.emitDataRelocations(file, arena, data_index, symbol_table); } - } else { + } else if (!self.base.options.strip) { try self.emitNameSection(file, arena); } } -- cgit v1.2.3