authorgravatar for antonin.decimo@gmail.comAntonin Décimo <antonin.decimo@gmail.com> 2026-03-17 09:24:30+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-03-17 09:24:30+01:00
log47d2e5de90faec1221f61255c36e2be81c9e3db3
tree0cf931347841419905197a167080ffa24e4e503e
parentbd89b61a2117d4ec0b0edb8a2b0b0aacb7388a3b

CLI: parse ld64 `-w` "suppress all warnings" option (#31545)

Apple's ld64 and LLVM's ld.ld64 both support a `-w` option to suppress all linker warnings. This option is used in OCaml's build system, parse it so that Zig may be used as a compiler to build an OCaml cross-compiler targeting aarch64-macos. See also https://codeberg.org/ziglang/zig/issues/31210. Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31545 Reviewed-by: Andrew Kelley <andrew@ziglang.org> Co-authored-by: Antonin Décimo <antonin.decimo@gmail.com> Co-committed-by: Antonin Décimo <antonin.decimo@gmail.com>

1 files changed, 3 insertions(+), 0 deletions(-)

src/main.zig+3
......@@ -2718,6 +2718,9 @@ fn buildOutputType(
27182718 entry = .{ .named = linker_args_it.nextOrFatal() };
27192719 } else if (mem.eql(u8, arg, "-u")) {
27202720 try force_undefined_symbols.put(arena, linker_args_it.nextOrFatal(), {});
2721 } else if (mem.eql(u8, arg, "-w")) {
2722 // This ignores the -w flag of ld64 and ld64.lld to suppress all linker warnings
2723 // since Zig doesn't emit linker warnings.
27212724 } else if (mem.eql(u8, arg, "-x") or mem.eql(u8, arg, "--discard-all")) {
27222725 discard_local_symbols = true;
27232726 } else if (mem.eql(u8, arg, "--stack") or mem.eql(u8, arg, "-stack_size")) {