| ... | ... | @@ -1650,12 +1650,16 @@ fn resolveGlobalSymbol(self: *MachO, current: SymbolWithLoc) !void { |
| 1650 | 1650 | const global_is_weak = global_sym.sect() and (global_sym.weakDef() or global_sym.pext()); |
| 1651 | 1651 | |
| 1652 | 1652 | 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 | } |
| 1659 | 1663 | } |
| 1660 | 1664 | return error.MultipleSymbolDefinitions; |
| 1661 | 1665 | } |
| ... | ... | @@ -3079,6 +3083,7 @@ fn allocateSection(self: *MachO, segname: []const u8, sectname: []const u8, opts |
| 3079 | 3083 | section.offset = mem.alignForward(u32, @as(u32, @intCast(off)), opts.alignment); |
| 3080 | 3084 | section.size = opts.size; |
| 3081 | 3085 | section.@"align" = math.log2(opts.alignment); |
| 3086 | self.sections.items(.segment_index)[sect_id] = segment_id; |
| 3082 | 3087 | assert(!section.isZerofill()); // TODO zerofill sections |
| 3083 | 3088 | |
| 3084 | 3089 | return sect_id; |
| ... | ... | @@ -4053,8 +4058,8 @@ fn writeSymtab(self: *MachO) !SymtabCtx { |
| 4053 | 4058 | // We generate stabs last in order to ensure that the strtab always has debug info |
| 4054 | 4059 | // strings trailing |
| 4055 | 4060 | if (!self.base.options.strip) { |
| 4056 | | assert(self.d_sym == null); // TODO |
| 4057 | 4061 | for (self.objects.items) |object| { |
| 4062 | assert(self.d_sym == null); // TODO |
| 4058 | 4063 | try self.generateSymbolStabs(object, &locals); |
| 4059 | 4064 | } |
| 4060 | 4065 | } |