| ... | @@ -1286,8 +1286,6 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node | ... | @@ -1286,8 +1286,6 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node |
| 1286 | try positionals.append(.{ .path = ssp.full_object_path }); | 1286 | try positionals.append(.{ .path = ssp.full_object_path }); |
| 1287 | } | 1287 | } |
| 1288 | | 1288 | |
| 1289 | if (self.isStaticLib()) return self.flushStaticLib(comp, positionals.items); | | |
| 1290 | | | |
| 1291 | for (positionals.items) |obj| { | 1289 | for (positionals.items) |obj| { |
| 1292 | var parse_ctx: ParseErrorCtx = .{ .detected_cpu_arch = undefined }; | 1290 | var parse_ctx: ParseErrorCtx = .{ .detected_cpu_arch = undefined }; |
| 1293 | self.parsePositional(obj.path, obj.must_link, &parse_ctx) catch |err| | 1291 | self.parsePositional(obj.path, obj.must_link, &parse_ctx) catch |err| |
| ... | @@ -1393,6 +1391,16 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node | ... | @@ -1393,6 +1391,16 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node |
| 1393 | try self.handleAndReportParseError(obj.path, err, &parse_ctx); | 1391 | try self.handleAndReportParseError(obj.path, err, &parse_ctx); |
| 1394 | } | 1392 | } |
| 1395 | | 1393 | |
| | 1394 | if (self.isStaticLib()) return self.flushStaticLib(comp); |
| | 1395 | |
| | 1396 | // Init all objects |
| | 1397 | for (self.objects.items) |index| { |
| | 1398 | try self.file(index).?.object.init(self); |
| | 1399 | } |
| | 1400 | for (self.shared_objects.items) |index| { |
| | 1401 | try self.file(index).?.shared_object.init(self); |
| | 1402 | } |
| | 1403 | |
| 1396 | // Dedup shared objects | 1404 | // Dedup shared objects |
| 1397 | { | 1405 | { |
| 1398 | var seen_dsos = std.StringHashMap(void).init(gpa); | 1406 | var seen_dsos = std.StringHashMap(void).init(gpa); |
| ... | @@ -1522,18 +1530,8 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node | ... | @@ -1522,18 +1530,8 @@ pub fn flushModule(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node |
| 1522 | } | 1530 | } |
| 1523 | } | 1531 | } |
| 1524 | | 1532 | |
| 1525 | pub fn flushStaticLib( | 1533 | pub fn flushStaticLib(self: *Elf, comp: *Compilation) link.File.FlushError!void { |
| 1526 | self: *Elf, | | |
| 1527 | comp: *Compilation, | | |
| 1528 | positionals: []const Compilation.LinkObject, | | |
| 1529 | ) link.File.FlushError!void { | | |
| 1530 | _ = comp; | 1534 | _ = comp; |
| 1531 | if (positionals.len > 0) { | | |
| 1532 | var err = try self.addErrorWithNotes(1); | | |
| 1533 | try err.addMsg(self, "fatal linker error: too many input positionals", .{}); | | |
| 1534 | try err.addNote(self, "TODO implement linking objects into an static library", .{}); | | |
| 1535 | return; | | |
| 1536 | } | | |
| 1537 | const gpa = self.base.allocator; | 1535 | const gpa = self.base.allocator; |
| 1538 | | 1536 | |
| 1539 | // First, we flush relocatable object file generated with our backends. | 1537 | // First, we flush relocatable object file generated with our backends. |