diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2021-05-17 17:59:38 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2021-05-18 09:28:00 +0200 |
| commit | 1dac5f5214aa9e35ad0fbc2ba561a894bd193ae3 (patch) | |
| tree | 5badfc9bca79b7f59780648cd504203e66097c0d /src/link/MachO.zig | |
| parent | ca772735c3d01c58551639d8bcfe355bc7ac9785 (diff) | |
| download | zig-1dac5f5214aa9e35ad0fbc2ba561a894bd193ae3.tar.gz zig-1dac5f5214aa9e35ad0fbc2ba561a894bd193ae3.zip | |
zld: parse dylibs as positionals
* add preliminary rpath support
* enable shared_library test on x86_64 macOS
Diffstat (limited to 'src/link/MachO.zig')
| -rw-r--r-- | src/link/MachO.zig | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/link/MachO.zig b/src/link/MachO.zig index c9b6197ddf..598c41330d 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -756,6 +756,19 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { } } + // rpaths + var rpath_table = std.StringArrayHashMap(void).init(arena); + for (self.base.options.rpath_list) |rpath| { + if (rpath_table.contains(rpath)) continue; + try rpath_table.putNoClobber(rpath, {}); + } + + var rpaths = std.ArrayList([]const u8) .init(arena); + try rpaths.ensureCapacity(rpath_table.count()); + for (rpath_table.items()) |entry| { + rpaths.appendAssumeCapacity(entry.key); + } + if (self.base.options.verbose_link) { var argv = std.ArrayList([]const u8).init(arena); @@ -767,6 +780,11 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { try argv.append(syslibroot); } + for (rpaths.items) |rpath| { + try argv.append("-rpath"); + try argv.append(rpath); + } + try argv.appendSlice(positionals.items); try argv.append("-o"); @@ -783,7 +801,10 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { Compilation.dump_argv(argv.items); } - try zld.link(positionals.items, shared_libs.items, full_out_path); + try zld.link(positionals.items, full_out_path, .{ + .shared_libs = shared_libs.items, + .rpaths = rpaths.items, + }); break :outer; } |
