From 05c9d6c00babc4ccc7949b3eb0224f70719d12a5 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Sat, 19 Aug 2023 16:59:56 +0200 Subject: macho: add simple error reporting for misc errors --- src/Compilation.zig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 069cc8a2c7..a30d97f1da 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -2609,6 +2609,9 @@ pub fn totalErrorCount(self: *Compilation) u32 { } total += @intFromBool(self.link_error_flags.missing_libc); + // Misc linker errors + total += self.bin_file.miscErrors().len; + // Compile log errors only count if there are no other errors. if (total == 0) { if (self.bin_file.options.module) |module| { @@ -2759,6 +2762,19 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle { })); } + for (self.bin_file.miscErrors()) |link_err| { + try bundle.addRootErrorMessage(.{ + .msg = try bundle.addString(link_err.msg), + .notes_len = @intCast(link_err.notes.len), + }); + const notes_start = try bundle.reserveNotes(@intCast(link_err.notes.len)); + for (link_err.notes, 0..) |note, i| { + bundle.extra.items[notes_start + i] = @intFromEnum(try bundle.addErrorMessage(.{ + .msg = try bundle.addString(note.msg), + })); + } + } + if (self.bin_file.options.module) |module| { if (bundle.root_list.items.len == 0 and module.compile_log_decls.count() != 0) { const keys = module.compile_log_decls.keys(); -- cgit v1.2.3