diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2023-08-19 16:59:56 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2023-08-29 11:39:34 +0200 |
| commit | 05c9d6c00babc4ccc7949b3eb0224f70719d12a5 (patch) | |
| tree | 35fc484baeda4c590d7fec3423468d06118e334a /src/link.zig | |
| parent | 7b282dffe68a7187a4fa4b5c11c82f1f67248a96 (diff) | |
| download | zig-05c9d6c00babc4ccc7949b3eb0224f70719d12a5.tar.gz zig-05c9d6c00babc4ccc7949b3eb0224f70719d12a5.zip | |
macho: add simple error reporting for misc errors
Diffstat (limited to 'src/link.zig')
| -rw-r--r-- | src/link.zig | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/link.zig b/src/link.zig index 48ad78364c..724c1500f4 100644 --- a/src/link.zig +++ b/src/link.zig @@ -866,6 +866,13 @@ pub const File = struct { } } + pub fn miscErrors(base: *File) []const ErrorMsg { + switch (base.tag) { + .macho => return @fieldParentPtr(MachO, "base", base).misc_errors.items, + else => return &.{}, + } + } + pub const UpdateDeclExportsError = error{ OutOfMemory, AnalysisFail, @@ -1129,6 +1136,19 @@ pub const File = struct { missing_libc: bool = false, }; + pub const ErrorMsg = struct { + msg: []const u8, + notes: []ErrorMsg = &.{}, + + pub fn deinit(self: *ErrorMsg, gpa: Allocator) void { + for (self.notes) |*note| { + note.deinit(gpa); + } + gpa.free(self.notes); + gpa.free(self.msg); + } + }; + pub const LazySymbol = struct { pub const Kind = enum { code, const_data }; |
