| ... | @@ -447,15 +447,25 @@ pub fn flushModule(self: *MachO, arena: Allocator, tid: Zcu.PerThread.Id, prog_n | ... | @@ -447,15 +447,25 @@ pub fn flushModule(self: *MachO, arena: Allocator, tid: Zcu.PerThread.Id, prog_n |
| 447 | }; | 447 | }; |
| 448 | | 448 | |
| 449 | for (system_libs.items) |lib| { | 449 | for (system_libs.items) |lib| { |
| 450 | const dso_input = try link.openDsoInput(diags, lib.path, lib.needed, lib.weak, lib.reexport); | 450 | switch (Compilation.classifyFileExt(lib.path.sub_path)) { |
| 451 | self.classifyInputFile(dso_input) catch |err| | 451 | .shared_library => { |
| 452 | diags.addParseError(lib.path, "failed to parse input file: {s}", .{@errorName(err)}); | 452 | const dso_input = try link.openDsoInput(diags, lib.path, lib.needed, lib.weak, lib.reexport); |
| | 453 | self.classifyInputFile(dso_input) catch |err| |
| | 454 | diags.addParseError(lib.path, "failed to parse input file: {s}", .{@errorName(err)}); |
| | 455 | }, |
| | 456 | .static_library => { |
| | 457 | const archive_input = try link.openArchiveInput(diags, lib.path, lib.must_link, lib.hidden); |
| | 458 | self.classifyInputFile(archive_input) catch |err| |
| | 459 | diags.addParseError(lib.path, "failed to parse input file: {s}", .{@errorName(err)}); |
| | 460 | }, |
| | 461 | else => unreachable, |
| | 462 | } |
| 453 | } | 463 | } |
| 454 | | 464 | |
| 455 | // Finally, link against compiler_rt. | 465 | // Finally, link against compiler_rt. |
| 456 | if (comp.compiler_rt_lib) |crt_file| { | 466 | if (comp.compiler_rt_lib) |crt_file| { |
| 457 | const path = crt_file.full_object_path; | 467 | const path = crt_file.full_object_path; |
| 458 | self.classifyInputFile(try link.openArchiveInput(diags, path)) catch |err| | 468 | self.classifyInputFile(try link.openArchiveInput(diags, path, false, false)) catch |err| |
| 459 | diags.addParseError(path, "failed to parse archive: {s}", .{@errorName(err)}); | 469 | diags.addParseError(path, "failed to parse archive: {s}", .{@errorName(err)}); |
| 460 | } else if (comp.compiler_rt_obj) |crt_file| { | 470 | } else if (comp.compiler_rt_obj) |crt_file| { |
| 461 | const path = crt_file.full_object_path; | 471 | const path = crt_file.full_object_path; |