| ... | ... | @@ -1707,7 +1707,6 @@ fn initHeaders( |
| 1707 | 1707 | coff.nodes.appendAssumeCapacity(.symbol_table); |
| 1708 | 1708 | |
| 1709 | 1709 | coff.symbol_table.strings_ni = try coff.mf.addLastChildNode(gpa, zcu_coff_parent_ni, .{ |
| 1710 | | .alignment = .@"2", |
| 1711 | 1710 | .size = @sizeOf(u32), |
| 1712 | 1711 | .fixed = true, |
| 1713 | 1712 | .resized = true, |
| ... | ... | @@ -2114,7 +2113,7 @@ pub fn symbolTableSectionAuxEntryPtr(coff: *Coff, si: Symbol.Index) *align(2) st |
| 2114 | 2113 | return @ptrCast(@alignCast(symbolTableEntryStoragePtr(coff, sti.unwrap().? + 1))); |
| 2115 | 2114 | } |
| 2116 | 2115 | |
| 2117 | | pub fn symbolTableStringLenPtr(coff: *Coff) *align(2) u32 { |
| 2116 | pub fn symbolTableStringLenPtr(coff: *Coff) *align(1) u32 { |
| 2118 | 2117 | return @ptrCast(@alignCast(coff.symbol_table.strings_ni.slice(&coff.mf)[0..@sizeOf(u32)])); |
| 2119 | 2118 | } |
| 2120 | 2119 | |
| ... | ... | @@ -3483,7 +3482,7 @@ fn loadObject( |
| 3483 | 3482 | }); |
| 3484 | 3483 | |
| 3485 | 3484 | if (is_archive) { |
| 3486 | | if (symbol.storage_class == .EXTERNAL) |
| 3485 | if (symbol.storage_class == .EXTERNAL and symbol.section_number != .UNDEFINED) |
| 3487 | 3486 | try coff.ensureMemberSymbol(mi, coff.getOrPutStringAssumeCapacity(name)); |
| 3488 | 3487 | |
| 3489 | 3488 | continue; |
| ... | ... | @@ -4042,7 +4041,6 @@ fn reportUndefs(coff: *Coff, tid: Zcu.PerThread.Id) !void { |
| 4042 | 4041 | num_unique_references = 1; |
| 4043 | 4042 | } |
| 4044 | 4043 | |
| 4045 | | const num_references = i - start_i; |
| 4046 | 4044 | const num_notes = |
| 4047 | 4045 | @min(max_notes, num_unique_references) + |
| 4048 | 4046 | @intFromBool(num_unique_references > max_notes); |
| ... | ... | @@ -4052,7 +4050,7 @@ fn reportUndefs(coff: *Coff, tid: Zcu.PerThread.Id) !void { |
| 4052 | 4050 | try err.addMsg("undefined symbol: {s}", .{target_sym.gmi.globalName(coff).name.toSlice(coff)}); |
| 4053 | 4051 | |
| 4054 | 4052 | var prev_loc_si: Symbol.Index = .null; |
| 4055 | | for (undef_indices.items[start_i..][0..num_references]) |reference_i| { |
| 4053 | for (undef_indices.items[start_i..][0..@max(1, i - start_i)]) |reference_i| { |
| 4056 | 4054 | if (err.note_slot == num_notes) break; |
| 4057 | 4055 | |
| 4058 | 4056 | const loc_si = coff.relocs.items[reference_i].loc; |
| ... | ... | @@ -4109,7 +4107,7 @@ fn reportUndefs(coff: *Coff, tid: Zcu.PerThread.Id) !void { |
| 4109 | 4107 | } |
| 4110 | 4108 | |
| 4111 | 4109 | if (num_unique_references > max_notes) |
| 4112 | | err.addNote("referenced {d} more times", .{num_references - max_notes}); |
| 4110 | err.addNote("referenced {d} more times", .{num_unique_references - max_notes}); |
| 4113 | 4111 | } else if (i != start_i and |
| 4114 | 4112 | coff.relocs.items[undef_indices.items[i - 1]].loc != coff.relocs.items[undef_indices.items[i]].loc) |
| 4115 | 4113 | { |
| ... | ... | @@ -4129,7 +4127,9 @@ pub fn flush( |
| 4129 | 4127 | _ = arena; |
| 4130 | 4128 | _ = prog_node; |
| 4131 | 4129 | while (try coff.idle(tid)) {} |
| 4132 | | try coff.reportUndefs(tid); |
| 4130 | |
| 4131 | if (coff.isImage()) |
| 4132 | try coff.reportUndefs(tid); |
| 4133 | 4133 | |
| 4134 | 4134 | const comp = coff.base.comp; |
| 4135 | 4135 | |