authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-10-24 16:48:15-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-10-24 23:30:57-07:00
logb3cd38ea4a7520fabbb05d3d2e74351c7c8effdb
tree51a821b640352c1967490e96165e2d5abbd94c2b
parent4f04759c874d5fd41c7cadeb974b4459559bc2a7

link: add an explicit error set for flush() and flushModule()

This makes it easier to understand how control flow should happen in various cases; already just by doing this it is revealed that UndefinedSymbol and UndefinedSymbolReference should be merged, and that MissingMainEntrypoint should be removed in favor of the ErrorFlags mechanism thath we already have for missing the main entrypoint. The main motivation for this change, however, is preventing a compile error when there is conditional compilation inside linker implementations, causing the flush() error set to depend on compilation options. With this change, the error set is fixed, and, notably, the `-Donly-c` flag no longer has compilation errors due to this error set.

10 files changed, 116 insertions(+), 33 deletions(-)

src/link.zig+86-3
...@@ -677,9 +677,92 @@ pub const File = struct {...@@ -677,9 +677,92 @@ pub const File = struct {
677 }677 }
678 }678 }
679679
680 /// TODO audit this error set. most of these should be collapsed into one error,
681 /// and ErrorFlags should be updated to convey the meaning to the user.
682 pub const FlushError = error{
683 CacheUnavailable,
684 CurrentWorkingDirectoryUnlinked,
685 DivisionByZero,
686 DllImportLibraryNotFound,
687 EmptyStubFile,
688 ExpectedFuncType,
689 FailedToEmit,
690 FailedToResolveRelocationTarget,
691 FileSystem,
692 FilesOpenedWithWrongFlags,
693 FlushFailure,
694 FrameworkNotFound,
695 FunctionSignatureMismatch,
696 GlobalTypeMismatch,
697 InvalidCharacter,
698 InvalidEntryKind,
699 InvalidFormat,
700 InvalidIndex,
701 InvalidMagicByte,
702 InvalidWasmVersion,
703 LLDCrashed,
704 LLDReportedFailure,
705 LLD_LinkingIsTODO_ForSpirV,
706 LibCInstallationMissingCRTDir,
707 LibCInstallationNotAvailable,
708 LibraryNotFound,
709 LinkingWithoutZigSourceUnimplemented,
710 MalformedArchive,
711 MalformedDwarf,
712 MalformedSection,
713 MemoryTooBig,
714 MemoryTooSmall,
715 MismatchedCpuArchitecture,
716 MissAlignment,
717 MissingEndForBody,
718 MissingEndForExpression,
719 /// TODO: this should be removed from the error set in favor of using ErrorFlags
720 MissingMainEntrypoint,
721 MissingSymbol,
722 MissingTableSymbols,
723 ModuleNameMismatch,
724 MultipleSymbolDefinitions,
725 NoObjectsToLink,
726 NotObject,
727 NotObjectFile,
728 NotSupported,
729 OutOfMemory,
730 Overflow,
731 PermissionDenied,
732 StreamTooLong,
733 SwapFile,
734 SymbolCollision,
735 SymbolMismatchingType,
736 TODOImplementPlan9Objs,
737 TODOImplementWritingLibFiles,
738 TODOImplementWritingStaticLibFiles,
739 UnableToSpawnSelf,
740 UnableToSpawnWasm,
741 UnableToWriteArchive,
742 UndefinedLocal,
743 /// TODO: merge with UndefinedSymbolReference
744 UndefinedSymbol,
745 /// TODO: merge with UndefinedSymbol
746 UndefinedSymbolReference,
747 Underflow,
748 UnexpectedRemainder,
749 UnexpectedTable,
750 UnexpectedValue,
751 UnhandledDwFormValue,
752 UnhandledSymbolType,
753 UnknownFeature,
754 Unseekable,
755 UnsupportedCpuArchitecture,
756 UnsupportedVersion,
757 } ||
758 fs.File.WriteFileError ||
759 fs.File.OpenError ||
760 std.ChildProcess.SpawnError ||
761 fs.Dir.CopyFileError;
762
680 /// Commit pending changes and write headers. Takes into account final output mode763 /// Commit pending changes and write headers. Takes into account final output mode
681 /// and `use_lld`, not only `effectiveOutputMode`.764 /// and `use_lld`, not only `effectiveOutputMode`.
682 pub fn flush(base: *File, comp: *Compilation, prog_node: *std.Progress.Node) !void {765 pub fn flush(base: *File, comp: *Compilation, prog_node: *std.Progress.Node) FlushError!void {
683 if (build_options.only_c) {766 if (build_options.only_c) {
684 assert(base.tag == .c);767 assert(base.tag == .c);
685 return @fieldParentPtr(C, "base", base).flush(comp, prog_node);768 return @fieldParentPtr(C, "base", base).flush(comp, prog_node);
...@@ -717,7 +800,7 @@ pub const File = struct {...@@ -717,7 +800,7 @@ pub const File = struct {
717800
718 /// Commit pending changes and write headers. Works based on `effectiveOutputMode`801 /// Commit pending changes and write headers. Works based on `effectiveOutputMode`
719 /// rather than final output mode.802 /// rather than final output mode.
720 pub fn flushModule(base: *File, comp: *Compilation, prog_node: *std.Progress.Node) !void {803 pub fn flushModule(base: *File, comp: *Compilation, prog_node: *std.Progress.Node) FlushError!void {
721 if (build_options.only_c) {804 if (build_options.only_c) {
722 assert(base.tag == .c);805 assert(base.tag == .c);
723 return @fieldParentPtr(C, "base", base).flushModule(comp, prog_node);806 return @fieldParentPtr(C, "base", base).flushModule(comp, prog_node);
...@@ -880,7 +963,7 @@ pub const File = struct {...@@ -880,7 +963,7 @@ pub const File = struct {
880 }963 }
881 }964 }
882965
883 pub fn linkAsArchive(base: *File, comp: *Compilation, prog_node: *std.Progress.Node) !void {966 pub fn linkAsArchive(base: *File, comp: *Compilation, prog_node: *std.Progress.Node) FlushError!void {
884 const tracy = trace(@src());967 const tracy = trace(@src());
885 defer tracy.end();968 defer tracy.end();
886969
src/link/Coff.zig+2-2
...@@ -1442,7 +1442,7 @@ fn resolveGlobalSymbol(self: *Coff, current: SymbolWithLoc) !void {...@@ -1442,7 +1442,7 @@ fn resolveGlobalSymbol(self: *Coff, current: SymbolWithLoc) !void {
1442 gop.value_ptr.* = current;1442 gop.value_ptr.* = current;
1443}1443}
14441444
1445pub fn flush(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Node) !void {1445pub fn flush(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void {
1446 if (self.base.options.emit == null) {1446 if (self.base.options.emit == null) {
1447 if (build_options.have_llvm) {1447 if (build_options.have_llvm) {
1448 if (self.llvm_object) |llvm_object| {1448 if (self.llvm_object) |llvm_object| {
...@@ -1461,7 +1461,7 @@ pub fn flush(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Node) !vo...@@ -1461,7 +1461,7 @@ pub fn flush(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Node) !vo
1461 }1461 }
1462}1462}
14631463
1464pub fn flushModule(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Node) !void {1464pub fn flushModule(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void {
1465 const tracy = trace(@src());1465 const tracy = trace(@src());
1466 defer tracy.end();1466 defer tracy.end();
14671467
src/link/Elf.zig+2-2
...@@ -932,7 +932,7 @@ pub fn populateMissingMetadata(self: *Elf) !void {...@@ -932,7 +932,7 @@ pub fn populateMissingMetadata(self: *Elf) !void {
932 }932 }
933}933}
934934
935pub fn flush(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !void {935pub fn flush(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void {
936 if (self.base.options.emit == null) {936 if (self.base.options.emit == null) {
937 if (build_options.have_llvm) {937 if (build_options.have_llvm) {
938 if (self.llvm_object) |llvm_object| {938 if (self.llvm_object) |llvm_object| {
...@@ -951,7 +951,7 @@ pub fn flush(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !voi...@@ -951,7 +951,7 @@ pub fn flush(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !voi
951 }951 }
952}952}
953953
954pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !void {954pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void {
955 const tracy = trace(@src());955 const tracy = trace(@src());
956 defer tracy.end();956 defer tracy.end();
957957
src/link/MachO.zig+2-2
...@@ -405,7 +405,7 @@ pub fn createEmpty(gpa: Allocator, options: link.Options) !*MachO {...@@ -405,7 +405,7 @@ pub fn createEmpty(gpa: Allocator, options: link.Options) !*MachO {
405 return self;405 return self;
406}406}
407407
408pub fn flush(self: *MachO, comp: *Compilation, prog_node: *std.Progress.Node) !void {408pub fn flush(self: *MachO, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void {
409 if (self.base.options.emit == null) {409 if (self.base.options.emit == null) {
410 if (build_options.have_llvm) {410 if (build_options.have_llvm) {
411 if (self.llvm_object) |llvm_object| {411 if (self.llvm_object) |llvm_object| {
...@@ -430,7 +430,7 @@ pub fn flush(self: *MachO, comp: *Compilation, prog_node: *std.Progress.Node) !v...@@ -430,7 +430,7 @@ pub fn flush(self: *MachO, comp: *Compilation, prog_node: *std.Progress.Node) !v
430 }430 }
431}431}
432432
433pub fn flushModule(self: *MachO, comp: *Compilation, prog_node: *std.Progress.Node) !void {433pub fn flushModule(self: *MachO, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void {
434 const tracy = trace(@src());434 const tracy = trace(@src());
435 defer tracy.end();435 defer tracy.end();
436436
src/link/MachO/dead_strip.zig+12-12
...@@ -17,7 +17,7 @@ const N_DEAD = @import("zld.zig").N_DEAD;...@@ -17,7 +17,7 @@ const N_DEAD = @import("zld.zig").N_DEAD;
1717
18const AtomTable = std.AutoHashMap(AtomIndex, void);18const AtomTable = std.AutoHashMap(AtomIndex, void);
1919
20pub fn gcAtoms(zld: *Zld, reverse_lookups: [][]u32) !void {20pub fn gcAtoms(zld: *Zld, reverse_lookups: [][]u32) Allocator.Error!void {
21 const gpa = zld.gpa;21 const gpa = zld.gpa;
2222
23 var arena = std.heap.ArenaAllocator.init(gpa);23 var arena = std.heap.ArenaAllocator.init(gpa);
...@@ -30,8 +30,8 @@ pub fn gcAtoms(zld: *Zld, reverse_lookups: [][]u32) !void {...@@ -30,8 +30,8 @@ pub fn gcAtoms(zld: *Zld, reverse_lookups: [][]u32) !void {
30 try alive.ensureTotalCapacity(@intCast(u32, zld.atoms.items.len));30 try alive.ensureTotalCapacity(@intCast(u32, zld.atoms.items.len));
3131
32 try collectRoots(zld, &roots);32 try collectRoots(zld, &roots);
33 try mark(zld, roots, &alive, reverse_lookups);33 mark(zld, roots, &alive, reverse_lookups);
34 try prune(zld, alive);34 prune(zld, alive);
35}35}
3636
37fn collectRoots(zld: *Zld, roots: *AtomTable) !void {37fn collectRoots(zld: *Zld, roots: *AtomTable) !void {
...@@ -133,7 +133,7 @@ fn markLive(...@@ -133,7 +133,7 @@ fn markLive(
133 atom_index: AtomIndex,133 atom_index: AtomIndex,
134 alive: *AtomTable,134 alive: *AtomTable,
135 reverse_lookups: [][]u32,135 reverse_lookups: [][]u32,
136) anyerror!void {136) void {
137 if (alive.contains(atom_index)) return;137 if (alive.contains(atom_index)) return;
138138
139 const atom = zld.getAtom(atom_index);139 const atom = zld.getAtom(atom_index);
...@@ -171,7 +171,7 @@ fn markLive(...@@ -171,7 +171,7 @@ fn markLive(
171 const other_atom = zld.getAtom(other_atom_index);171 const other_atom = zld.getAtom(other_atom_index);
172 const other_sym = zld.getSymbol(other_atom.getSymbolWithLoc());172 const other_sym = zld.getSymbol(other_atom.getSymbolWithLoc());
173 if (other_sym.n_sect == sect_id) {173 if (other_sym.n_sect == sect_id) {
174 try markLive(zld, other_atom_index, alive, reverse_lookups);174 markLive(zld, other_atom_index, alive, reverse_lookups);
175 }175 }
176 }176 }
177 continue;177 continue;
...@@ -194,11 +194,11 @@ fn markLive(...@@ -194,11 +194,11 @@ fn markLive(
194 zld.getAtom(target_atom_index).file,194 zld.getAtom(target_atom_index).file,
195 });195 });
196196
197 try markLive(zld, target_atom_index, alive, reverse_lookups);197 markLive(zld, target_atom_index, alive, reverse_lookups);
198 }198 }
199}199}
200200
201fn refersLive(zld: *Zld, atom_index: AtomIndex, alive: AtomTable, reverse_lookups: [][]u32) !bool {201fn refersLive(zld: *Zld, atom_index: AtomIndex, alive: AtomTable, reverse_lookups: [][]u32) bool {
202 const atom = zld.getAtom(atom_index);202 const atom = zld.getAtom(atom_index);
203 const sym_loc = atom.getSymbolWithLoc();203 const sym_loc = atom.getSymbolWithLoc();
204204
...@@ -240,10 +240,10 @@ fn refersLive(zld: *Zld, atom_index: AtomIndex, alive: AtomTable, reverse_lookup...@@ -240,10 +240,10 @@ fn refersLive(zld: *Zld, atom_index: AtomIndex, alive: AtomTable, reverse_lookup
240 return false;240 return false;
241}241}
242242
243fn mark(zld: *Zld, roots: AtomTable, alive: *AtomTable, reverse_lookups: [][]u32) !void {243fn mark(zld: *Zld, roots: AtomTable, alive: *AtomTable, reverse_lookups: [][]u32) void {
244 var it = roots.keyIterator();244 var it = roots.keyIterator();
245 while (it.next()) |root| {245 while (it.next()) |root| {
246 try markLive(zld, root.*, alive, reverse_lookups);246 markLive(zld, root.*, alive, reverse_lookups);
247 }247 }
248248
249 var loop: bool = true;249 var loop: bool = true;
...@@ -265,8 +265,8 @@ fn mark(zld: *Zld, roots: AtomTable, alive: *AtomTable, reverse_lookups: [][]u32...@@ -265,8 +265,8 @@ fn mark(zld: *Zld, roots: AtomTable, alive: *AtomTable, reverse_lookups: [][]u32
265 const source_sect = object.getSourceSection(sect_id);265 const source_sect = object.getSourceSection(sect_id);
266266
267 if (source_sect.isDontDeadStripIfReferencesLive()) {267 if (source_sect.isDontDeadStripIfReferencesLive()) {
268 if (try refersLive(zld, atom_index, alive.*, reverse_lookups)) {268 if (refersLive(zld, atom_index, alive.*, reverse_lookups)) {
269 try markLive(zld, atom_index, alive, reverse_lookups);269 markLive(zld, atom_index, alive, reverse_lookups);
270 loop = true;270 loop = true;
271 }271 }
272 }272 }
...@@ -275,7 +275,7 @@ fn mark(zld: *Zld, roots: AtomTable, alive: *AtomTable, reverse_lookups: [][]u32...@@ -275,7 +275,7 @@ fn mark(zld: *Zld, roots: AtomTable, alive: *AtomTable, reverse_lookups: [][]u32
275 }275 }
276}276}
277277
278fn prune(zld: *Zld, alive: AtomTable) !void {278fn prune(zld: *Zld, alive: AtomTable) void {
279 log.debug("pruning dead atoms", .{});279 log.debug("pruning dead atoms", .{});
280 for (zld.objects.items) |*object| {280 for (zld.objects.items) |*object| {
281 var i: usize = 0;281 var i: usize = 0;
src/link/MachO/zld.zig+1-1
...@@ -3735,7 +3735,7 @@ const SymbolResolver = struct {...@@ -3735,7 +3735,7 @@ const SymbolResolver = struct {
3735 unresolved: std.AutoArrayHashMap(u32, void),3735 unresolved: std.AutoArrayHashMap(u32, void),
3736};3736};
37373737
3738pub fn linkWithZld(macho_file: *MachO, comp: *Compilation, prog_node: *std.Progress.Node) !void {3738pub fn linkWithZld(macho_file: *MachO, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void {
3739 const tracy = trace(@src());3739 const tracy = trace(@src());
3740 defer tracy.end();3740 defer tracy.end();
37413741
src/link/NvPtx.zig+2-2
...@@ -93,11 +93,11 @@ pub fn freeDecl(self: *NvPtx, decl_index: Module.Decl.Index) void {...@@ -93,11 +93,11 @@ pub fn freeDecl(self: *NvPtx, decl_index: Module.Decl.Index) void {
93 return self.llvm_object.freeDecl(decl_index);93 return self.llvm_object.freeDecl(decl_index);
94}94}
9595
96pub fn flush(self: *NvPtx, comp: *Compilation, prog_node: *std.Progress.Node) !void {96pub fn flush(self: *NvPtx, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void {
97 return self.flushModule(comp, prog_node);97 return self.flushModule(comp, prog_node);
98}98}
9999
100pub fn flushModule(self: *NvPtx, comp: *Compilation, prog_node: *std.Progress.Node) !void {100pub fn flushModule(self: *NvPtx, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void {
101 if (!build_options.have_llvm) return;101 if (!build_options.have_llvm) return;
102 if (build_options.skip_non_native) {102 if (build_options.skip_non_native) {
103 @panic("Attempted to compile for architecture that was disabled by build configuration");103 @panic("Attempted to compile for architecture that was disabled by build configuration");
src/link/Plan9.zig+2-2
...@@ -356,7 +356,7 @@ fn updateFinish(self: *Plan9, decl: *Module.Decl) !void {...@@ -356,7 +356,7 @@ fn updateFinish(self: *Plan9, decl: *Module.Decl) !void {
356 }356 }
357}357}
358358
359pub fn flush(self: *Plan9, comp: *Compilation, prog_node: *std.Progress.Node) !void {359pub fn flush(self: *Plan9, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void {
360 assert(!self.base.options.use_lld);360 assert(!self.base.options.use_lld);
361361
362 switch (self.base.options.effectiveOutputMode()) {362 switch (self.base.options.effectiveOutputMode()) {
...@@ -392,7 +392,7 @@ fn declCount(self: *Plan9) usize {...@@ -392,7 +392,7 @@ fn declCount(self: *Plan9) usize {
392 return self.data_decl_table.count() + fn_decl_count;392 return self.data_decl_table.count() + fn_decl_count;
393}393}
394394
395pub fn flushModule(self: *Plan9, comp: *Compilation, prog_node: *std.Progress.Node) !void {395pub fn flushModule(self: *Plan9, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void {
396 if (build_options.skip_non_native and builtin.object_format != .plan9) {396 if (build_options.skip_non_native and builtin.object_format != .plan9) {
397 @panic("Attempted to compile for object format that was disabled by build configuration");397 @panic("Attempted to compile for object format that was disabled by build configuration");
398 }398 }
src/link/SpirV.zig+2-2
...@@ -176,7 +176,7 @@ pub fn freeDecl(self: *SpirV, decl_index: Module.Decl.Index) void {...@@ -176,7 +176,7 @@ pub fn freeDecl(self: *SpirV, decl_index: Module.Decl.Index) void {
176 self.decl_table.swapRemoveAt(index);176 self.decl_table.swapRemoveAt(index);
177}177}
178178
179pub fn flush(self: *SpirV, comp: *Compilation, prog_node: *std.Progress.Node) !void {179pub fn flush(self: *SpirV, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void {
180 if (build_options.have_llvm and self.base.options.use_lld) {180 if (build_options.have_llvm and self.base.options.use_lld) {
181 return error.LLD_LinkingIsTODO_ForSpirV; // TODO: LLD Doesn't support SpirV at all.181 return error.LLD_LinkingIsTODO_ForSpirV; // TODO: LLD Doesn't support SpirV at all.
182 } else {182 } else {
...@@ -184,7 +184,7 @@ pub fn flush(self: *SpirV, comp: *Compilation, prog_node: *std.Progress.Node) !v...@@ -184,7 +184,7 @@ pub fn flush(self: *SpirV, comp: *Compilation, prog_node: *std.Progress.Node) !v
184 }184 }
185}185}
186186
187pub fn flushModule(self: *SpirV, comp: *Compilation, prog_node: *std.Progress.Node) !void {187pub fn flushModule(self: *SpirV, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void {
188 if (build_options.skip_non_native) {188 if (build_options.skip_non_native) {
189 @panic("Attempted to compile for architecture that was disabled by build configuration");189 @panic("Attempted to compile for architecture that was disabled by build configuration");
190 }190 }
src/link/Wasm.zig+5-5
...@@ -501,7 +501,7 @@ fn resolveSymbolsInObject(wasm: *Wasm, object_index: u16) !void {...@@ -501,7 +501,7 @@ fn resolveSymbolsInObject(wasm: *Wasm, object_index: u16) !void {
501 if (symbol.isUndefined()) {501 if (symbol.isUndefined()) {
502 log.err("Local symbols are not allowed to reference imports", .{});502 log.err("Local symbols are not allowed to reference imports", .{});
503 log.err(" symbol '{s}' defined in '{s}'", .{ sym_name, object.name });503 log.err(" symbol '{s}' defined in '{s}'", .{ sym_name, object.name });
504 return error.undefinedLocal;504 return error.UndefinedLocal;
505 }505 }
506 try wasm.resolved_symbols.putNoClobber(wasm.base.allocator, location, {});506 try wasm.resolved_symbols.putNoClobber(wasm.base.allocator, location, {});
507 continue;507 continue;
...@@ -2091,7 +2091,7 @@ fn resetState(wasm: *Wasm) void {...@@ -2091,7 +2091,7 @@ fn resetState(wasm: *Wasm) void {
2091 wasm.debug_pubtypes_index = null;2091 wasm.debug_pubtypes_index = null;
2092}2092}
20932093
2094pub fn flush(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) !void {2094pub fn flush(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void {
2095 if (wasm.base.options.emit == null) {2095 if (wasm.base.options.emit == null) {
2096 if (build_options.have_llvm) {2096 if (build_options.have_llvm) {
2097 if (wasm.llvm_object) |llvm_object| {2097 if (wasm.llvm_object) |llvm_object| {
...@@ -2107,7 +2107,7 @@ pub fn flush(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) !vo...@@ -2107,7 +2107,7 @@ pub fn flush(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) !vo
2107 }2107 }
2108}2108}
21092109
2110pub fn flushModule(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) !void {2110pub fn flushModule(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) link.File.FlushError!void {
2111 const tracy = trace(@src());2111 const tracy = trace(@src());
2112 defer tracy.end();2112 defer tracy.end();
21132113
...@@ -3195,7 +3195,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) !...@@ -3195,7 +3195,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) !
31953195
3196 const term = child.spawnAndWait() catch |err| {3196 const term = child.spawnAndWait() catch |err| {
3197 log.err("unable to spawn {s}: {s}", .{ argv.items[0], @errorName(err) });3197 log.err("unable to spawn {s}: {s}", .{ argv.items[0], @errorName(err) });
3198 return error.UnableToSpawnwasm;3198 return error.UnableToSpawnWasm;
3199 };3199 };
3200 switch (term) {3200 switch (term) {
3201 .Exited => |code| {3201 .Exited => |code| {
...@@ -3216,7 +3216,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) !...@@ -3216,7 +3216,7 @@ fn linkWithLLD(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Node) !
32163216
3217 const term = child.wait() catch |err| {3217 const term = child.wait() catch |err| {
3218 log.err("unable to spawn {s}: {s}", .{ argv.items[0], @errorName(err) });3218 log.err("unable to spawn {s}: {s}", .{ argv.items[0], @errorName(err) });
3219 return error.UnableToSpawnwasm;3219 return error.UnableToSpawnWasm;
3220 };3220 };
32213221
3222 switch (term) {3222 switch (term) {