authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-10-16 13:41:24-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-10-23 16:27:38-07:00
loge2a71b37d867e5567e06c8e57b04e648ade4aca3
tree87e6f0af2e722a27a1dd4ba06da16770cea5b4f0
parent8cfe303da907df41b41d2d78181760f80dc6579f

fix MachO linking regression


2 files changed, 13 insertions(+), 1 deletions(-)

src/link.zig+6
......@@ -2003,6 +2003,12 @@ pub fn openArchiveInput(diags: *Diags, path: Path) error{LinkFailure}!Input {
20032003 } };
20042004}
20052005
2006pub fn openDsoInput(diags: *Diags, path: Path, needed: bool, weak: bool, reexport: bool) error{LinkFailure}!Input {
2007 return .{ .dso = openDso(path, needed, weak, reexport) catch |err| {
2008 return diags.failParse(path, "failed to open {}: {s}", .{ path, @errorName(err) });
2009 } };
2010}
2011
20062012fn stripLibPrefixAndSuffix(path: []const u8, target: std.Target) ?struct { []const u8, std.builtin.LinkMode } {
20072013 const prefix = target.libPrefix();
20082014 const static_suffix = target.staticLibSuffix();
src/link/MachO.zig+7-1
......@@ -446,6 +446,12 @@ pub fn flushModule(self: *MachO, arena: Allocator, tid: Zcu.PerThread.Id, prog_n
446446 },
447447 };
448448
449 for (system_libs.items) |lib| {
450 const dso_input = try link.openDsoInput(diags, lib.path, lib.needed, lib.weak, lib.reexport);
451 self.classifyInputFile(dso_input) catch |err|
452 diags.addParseError(lib.path, "failed to parse input file: {s}", .{@errorName(err)});
453 }
454
449455 // Finally, link against compiler_rt.
450456 if (comp.compiler_rt_lib) |crt_file| {
451457 const path = crt_file.full_object_path;
......@@ -765,7 +771,7 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void {
765771 Compilation.dump_argv(argv.items);
766772}
767773
768/// TODO delete this, libsystem must be resolved when setting up the compilationt pipeline
774/// TODO delete this, libsystem must be resolved when setting up the compilation pipeline
769775pub fn resolveLibSystem(
770776 self: *MachO,
771777 arena: Allocator,