authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-12-05 18:12:58+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-12-05 18:12:58+01:00
logda417b851b8aa8522abfbd235c82193075054544
treebb101d7b0862b739abf48dcb785f580d9f94dfaf
parent418b042f492417edbdd57b5b85610e6d36d9a7ac

elf: return error.FlushFailure in flushObject and flushStaticLib codepaths when found errors


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

src/link/Elf.zig+4
...@@ -1442,6 +1442,8 @@ pub fn flushStaticLib(self: *Elf, comp: *Compilation, module_obj_path: ?[]const...@@ -1442,6 +1442,8 @@ pub fn flushStaticLib(self: *Elf, comp: *Compilation, module_obj_path: ?[]const
14421442
1443 try self.base.file.?.setEndPos(total_size);1443 try self.base.file.?.setEndPos(total_size);
1444 try self.base.file.?.pwriteAll(buffer.items, 0);1444 try self.base.file.?.pwriteAll(buffer.items, 0);
1445
1446 if (self.misc_errors.items.len > 0) return error.FlushFailure;
1445}1447}
14461448
1447pub fn flushObject(self: *Elf, comp: *Compilation, module_obj_path: ?[]const u8) link.File.FlushError!void {1449pub fn flushObject(self: *Elf, comp: *Compilation, module_obj_path: ?[]const u8) link.File.FlushError!void {
...@@ -1512,6 +1514,8 @@ pub fn flushObject(self: *Elf, comp: *Compilation, module_obj_path: ?[]const u8)...@@ -1512,6 +1514,8 @@ pub fn flushObject(self: *Elf, comp: *Compilation, module_obj_path: ?[]const u8)
1512 try self.writeSyntheticSectionsObject();1514 try self.writeSyntheticSectionsObject();
1513 try self.writeShdrTable();1515 try self.writeShdrTable();
1514 try self.writeElfHeader();1516 try self.writeElfHeader();
1517
1518 if (self.misc_errors.items.len > 0) return error.FlushFailure;
1515}1519}
15161520
1517/// --verbose-link output1521/// --verbose-link output