zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 3af6a4e887bb3cd986a52ea94202a0079f442e9b (tree)
parent 6b99aab0eb25821d91c1708575cabdadc9079024
Author: Jakub Konka <kubkon@jakubkonka.com>
Date:   Thu, 15 Dec 2022 11:25:54 +0100

macho: generate stabs last to aid in deterministic uuid calculation

Diffstat:
Msrc/link/MachO/zld.zig | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/link/MachO/zld.zig b/src/link/MachO/zld.zig @@ -2556,12 +2556,6 @@ pub const Zld = struct { } } - if (!self.options.strip) { - for (self.objects.items) |object| { - try self.generateSymbolStabs(object, &locals); - } - } - var exports = std.ArrayList(macho.nlist_64).init(gpa); defer exports.deinit(); @@ -2592,6 +2586,14 @@ pub const Zld = struct { try imports_table.putNoClobber(global, new_index); } + // We generate stabs last in order to ensure that the strtab always has debug info + // strings trailing + if (!self.options.strip) { + for (self.objects.items) |object| { + try self.generateSymbolStabs(object, &locals); + } + } + const nlocals = @intCast(u32, locals.items.len); const nexports = @intCast(u32, exports.items.len); const nimports = @intCast(u32, imports.items.len);