authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-08-27 22:42:04+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2023-08-29 11:40:20+02:00
log0353bfd55ed67fa5c1c1d0e3004fcbae7f139b92
tree7a53fed6216bea552ba60d61f24109aeebd9d0b0
parent5eb6c81d07d2df43f6df5e0a421b93dac10f8fed

macho: fix a few regressions in incremental codepath


1 files changed, 12 insertions(+), 7 deletions(-)

src/link/MachO.zig+12-7
......@@ -1650,12 +1650,16 @@ fn resolveGlobalSymbol(self: *MachO, current: SymbolWithLoc) !void {
16501650 const global_is_weak = global_sym.sect() and (global_sym.weakDef() or global_sym.pext());
16511651
16521652 if (sym_is_strong and global_is_strong) {
1653 log.err("symbol '{s}' defined multiple times", .{sym_name});
1654 if (global.getFile()) |file| {
1655 log.err(" first definition in '{s}'", .{self.objects.items[file].name});
1656 }
1657 if (current.getFile()) |file| {
1658 log.err(" next definition in '{s}'", .{self.objects.items[file].name});
1653 // TODO redo this logic with corresponding logic in updateDeclExports to avoid this
1654 // ugly check.
1655 if (self.mode == .zld) {
1656 log.err("symbol '{s}' defined multiple times", .{sym_name});
1657 if (global.getFile()) |file| {
1658 log.err(" first definition in '{s}'", .{self.objects.items[file].name});
1659 }
1660 if (current.getFile()) |file| {
1661 log.err(" next definition in '{s}'", .{self.objects.items[file].name});
1662 }
16591663 }
16601664 return error.MultipleSymbolDefinitions;
16611665 }
......@@ -3079,6 +3083,7 @@ fn allocateSection(self: *MachO, segname: []const u8, sectname: []const u8, opts
30793083 section.offset = mem.alignForward(u32, @as(u32, @intCast(off)), opts.alignment);
30803084 section.size = opts.size;
30813085 section.@"align" = math.log2(opts.alignment);
3086 self.sections.items(.segment_index)[sect_id] = segment_id;
30823087 assert(!section.isZerofill()); // TODO zerofill sections
30833088
30843089 return sect_id;
......@@ -4053,8 +4058,8 @@ fn writeSymtab(self: *MachO) !SymtabCtx {
40534058 // We generate stabs last in order to ensure that the strtab always has debug info
40544059 // strings trailing
40554060 if (!self.base.options.strip) {
4056 assert(self.d_sym == null); // TODO
40574061 for (self.objects.items) |object| {
4062 assert(self.d_sym == null); // TODO
40584063 try self.generateSymbolStabs(object, &locals);
40594064 }
40604065 }