zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit e2a71b37d867e5567e06c8e57b04e648ade4aca3 (tree)
parent 8cfe303da907df41b41d2d78181760f80dc6579f
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Wed, 16 Oct 2024 13:41:24 -0700

fix MachO linking regression

Diffstat:
Msrc/link.zig | 6++++++
Msrc/link/MachO.zig | 8+++++++-
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/link.zig b/src/link.zig @@ -2003,6 +2003,12 @@ pub fn openArchiveInput(diags: *Diags, path: Path) error{LinkFailure}!Input { } }; } +pub fn openDsoInput(diags: *Diags, path: Path, needed: bool, weak: bool, reexport: bool) error{LinkFailure}!Input { + return .{ .dso = openDso(path, needed, weak, reexport) catch |err| { + return diags.failParse(path, "failed to open {}: {s}", .{ path, @errorName(err) }); + } }; +} + fn stripLibPrefixAndSuffix(path: []const u8, target: std.Target) ?struct { []const u8, std.builtin.LinkMode } { const prefix = target.libPrefix(); const static_suffix = target.staticLibSuffix(); diff --git a/src/link/MachO.zig b/src/link/MachO.zig @@ -446,6 +446,12 @@ pub fn flushModule(self: *MachO, arena: Allocator, tid: Zcu.PerThread.Id, prog_n }, }; + for (system_libs.items) |lib| { + const dso_input = try link.openDsoInput(diags, lib.path, lib.needed, lib.weak, lib.reexport); + self.classifyInputFile(dso_input) catch |err| + diags.addParseError(lib.path, "failed to parse input file: {s}", .{@errorName(err)}); + } + // Finally, link against compiler_rt. if (comp.compiler_rt_lib) |crt_file| { const path = crt_file.full_object_path; @@ -765,7 +771,7 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void { Compilation.dump_argv(argv.items); } -/// TODO delete this, libsystem must be resolved when setting up the compilationt pipeline +/// TODO delete this, libsystem must be resolved when setting up the compilation pipeline pub fn resolveLibSystem( self: *MachO, arena: Allocator,