| ... | @@ -304,14 +304,16 @@ fn linkAsArchive(lld: *Lld, arena: Allocator) !void { | ... | @@ -304,14 +304,16 @@ fn linkAsArchive(lld: *Lld, arena: Allocator) !void { |
| 304 | // insight as to what's going on here you can read that function body which is more | 304 | // insight as to what's going on here you can read that function body which is more |
| 305 | // well-commented. | 305 | // well-commented. |
| 306 | | 306 | |
| 307 | const link_inputs = comp.link_inputs; | | |
| 308 | | | |
| 309 | var object_files: std.ArrayList([*:0]const u8) = .empty; | 307 | var object_files: std.ArrayList([*:0]const u8) = .empty; |
| 310 | | 308 | |
| 311 | try object_files.ensureUnusedCapacity(arena, link_inputs.len); | 309 | try object_files.ensureUnusedCapacity(arena, comp.link_inputs.len); |
| 312 | for (link_inputs) |input| { | 310 | for (comp.link_inputs) |input| switch (input) { |
| 313 | object_files.appendAssumeCapacity(try input.path().?.toStringZ(arena)); | 311 | .res, .dso, .dso_exact => {}, // shared libraries should not be included in static archives |
| 314 | } | 312 | .object, .archive => { |
| | 313 | const path = try input.path().?.toStringZ(arena); |
| | 314 | object_files.appendAssumeCapacity(path); |
| | 315 | }, |
| | 316 | }; |
| 315 | | 317 | |
| 316 | try object_files.ensureUnusedCapacity(arena, comp.c_objects.items.len + | 318 | try object_files.ensureUnusedCapacity(arena, comp.c_objects.items.len + |
| 317 | comp.win32_resources.items.len + 2); | 319 | comp.win32_resources.items.len + 2); |