authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-12-15 11:25:54+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-12-16 18:05:58+01:00
log3af6a4e887bb3cd986a52ea94202a0079f442e9b
tree113f2bfc12f5430409a6a4273b1ad39439db4313
parent6b99aab0eb25821d91c1708575cabdadc9079024

macho: generate stabs last to aid in deterministic uuid calculation


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

src/link/MachO/zld.zig+8-6
...@@ -2556,12 +2556,6 @@ pub const Zld = struct {...@@ -2556,12 +2556,6 @@ pub const Zld = struct {
2556 }2556 }
2557 }2557 }
25582558
2559 if (!self.options.strip) {
2560 for (self.objects.items) |object| {
2561 try self.generateSymbolStabs(object, &locals);
2562 }
2563 }
2564
2565 var exports = std.ArrayList(macho.nlist_64).init(gpa);2559 var exports = std.ArrayList(macho.nlist_64).init(gpa);
2566 defer exports.deinit();2560 defer exports.deinit();
25672561
...@@ -2592,6 +2586,14 @@ pub const Zld = struct {...@@ -2592,6 +2586,14 @@ pub const Zld = struct {
2592 try imports_table.putNoClobber(global, new_index);2586 try imports_table.putNoClobber(global, new_index);
2593 }2587 }
25942588
2589 // We generate stabs last in order to ensure that the strtab always has debug info
2590 // strings trailing
2591 if (!self.options.strip) {
2592 for (self.objects.items) |object| {
2593 try self.generateSymbolStabs(object, &locals);
2594 }
2595 }
2596
2595 const nlocals = @intCast(u32, locals.items.len);2597 const nlocals = @intCast(u32, locals.items.len);
2596 const nexports = @intCast(u32, exports.items.len);2598 const nexports = @intCast(u32, exports.items.len);
2597 const nimports = @intCast(u32, imports.items.len);2599 const nimports = @intCast(u32, imports.items.len);