| ... | @@ -104,6 +104,20 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { | ... | @@ -104,6 +104,20 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 104 | | 104 | |
| 105 | const entry_name = if (wasm.entry_resolution.isNavOrUnresolved(wasm)) wasm.entry_name else .none; | 105 | const entry_name = if (wasm.entry_resolution.isNavOrUnresolved(wasm)) wasm.entry_name else .none; |
| 106 | | 106 | |
| | 107 | // Detect any intrinsics that were called; they need to have dependencies on the symbols marked. |
| | 108 | for (wasm.mir_instructions.items(.tag), wasm.mir_instructions.items(.data)) |tag, *data| switch (tag) { |
| | 109 | .call_intrinsic => { |
| | 110 | const symbol_name = try wasm.internString(@tagName(data.intrinsic)); |
| | 111 | const i: Wasm.FunctionImport.Index = @enumFromInt(wasm.object_function_imports.getIndex(symbol_name) orelse { |
| | 112 | return diags.fail("missing compiler runtime intrinsic '{s}' (undefined linker symbol)", .{ |
| | 113 | @tagName(data.intrinsic), |
| | 114 | }); |
| | 115 | }); |
| | 116 | try wasm.markFunctionImport(symbol_name, i.value(wasm), i); |
| | 117 | }, |
| | 118 | else => continue, |
| | 119 | }; |
| | 120 | |
| 107 | if (comp.zcu) |zcu| { | 121 | if (comp.zcu) |zcu| { |
| 108 | const ip: *const InternPool = &zcu.intern_pool; // No mutations allowed! | 122 | const ip: *const InternPool = &zcu.intern_pool; // No mutations allowed! |
| 109 | | 123 | |