aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2023-08-31 07:50:29 +0200
committerGitHub <noreply@github.com>2023-08-31 07:50:29 +0200
commitf4c9e19bc3213c2bc7e03d7b06d7129882f39f6c (patch)
tree79d343002bb63a44f8ab0dbac0c9f4ec54078c3a /src/Compilation.zig
parente2ff486de5f3aceb21730e1feabbaf9b03432660 (diff)
parent19a1332ca140274d03e57d31fda7748a8a3641ba (diff)
downloadzig-f4c9e19bc3213c2bc7e03d7b06d7129882f39f6c.tar.gz
zig-f4c9e19bc3213c2bc7e03d7b06d7129882f39f6c.zip
Merge pull request #17020 from ziglang/macho-versions
macho: big-ish refactor and report errors to the user using Zig's API
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 6cc8502461..0816322f60 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();