aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2022-06-24 20:25:16 +0200
committerJakub Konka <kubkon@jakubkonka.com>2022-06-24 20:25:16 +0200
commit0df7ed79d304afc7d379482005e892979d4a5e4d (patch)
tree34fd8af5325aeec01f7d1f0aca18f80850791b41 /lib
parentd589047e80133c5f673a7d40dd1cfa50258dcc4f (diff)
downloadzig-0df7ed79d304afc7d379482005e892979d4a5e4d.tar.gz
zig-0df7ed79d304afc7d379482005e892979d4a5e4d.zip
macho: implement -search_dylibs_first linker option
Diffstat (limited to 'lib')
-rw-r--r--lib/std/build.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/std/build.zig b/lib/std/build.zig
index 57304242cd..0b49087747 100644
--- a/lib/std/build.zig
+++ b/lib/std/build.zig
@@ -1586,6 +1586,13 @@ pub const LibExeObjStep = struct {
/// (Darwin) Size of the pagezero segment.
pagezero_size: ?u64 = null,
+ /// (Darwin) Search strategy for searching system libraries. Either `paths_first` or `dylibs_first`.
+ /// The former lowers to `-search_paths_first` linker option, while the latter to `-search_dylibs_first`
+ /// option.
+ /// By default, if no option is specified, the linker assumes `paths_first` as the default
+ /// search strategy.
+ search_strategy: ?enum { paths_first, dylibs_first } = null,
+
/// Position Independent Code
force_pic: ?bool = null,
@@ -2650,6 +2657,10 @@ pub const LibExeObjStep = struct {
const size = try std.fmt.allocPrint(builder.allocator, "{x}", .{pagezero_size});
try zig_args.appendSlice(&[_][]const u8{ "-pagezero_size", size });
}
+ if (self.search_strategy) |strat| switch (strat) {
+ .paths_first => try zig_args.append("-search_paths_first"),
+ .dylibs_first => try zig_args.append("-search_dylibs_first"),
+ };
if (self.bundle_compiler_rt) |x| {
if (x) {