authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-12-05 16:35:08+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-12-05 16:35:08+01:00
logab423bd63cd0c61e7299dc0b73cba4d83dffdd38
tree42f3e8d10fc1c6b739d41f30c2ed01dd5310a1c8
parentee1630beeaaa24cb6d65631517afabc0621b902f

elf: exit early with an error when parsing or init failed when flushing object/archive


1 files changed, 6 insertions(+), 0 deletions(-)

src/link/Elf.zig+6
......@@ -1331,6 +1331,8 @@ pub fn flushStaticLib(self: *Elf, comp: *Compilation, module_obj_path: ?[]const
13311331 };
13321332 }
13331333
1334 if (self.misc_errors.items.len > 0) return error.FlushFailure;
1335
13341336 // First, we flush relocatable object file generated with our backends.
13351337 if (self.zigObjectPtr()) |zig_object| {
13361338 zig_object.resolveSymbols(self);
......@@ -1468,11 +1470,15 @@ pub fn flushObject(self: *Elf, comp: *Compilation, module_obj_path: ?[]const u8)
14681470 };
14691471 }
14701472
1473 if (self.misc_errors.items.len > 0) return error.FlushFailure;
1474
14711475 // Init all objects
14721476 for (self.objects.items) |index| {
14731477 try self.file(index).?.object.init(self);
14741478 }
14751479
1480 if (self.misc_errors.items.len > 0) return error.FlushFailure;
1481
14761482 // Now, we are ready to resolve the symbols across all input files.
14771483 // We will first resolve the files in the ZigObject, next in the parsed
14781484 // input Object files.