From 47d2e5de90faec1221f61255c36e2be81c9e3db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Tue, 17 Mar 2026 09:24:30 +0100 Subject: [PATCH] CLI: parse ld64 `-w` "suppress all warnings" option (#31545) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Co-authored-by: Antonin Décimo Co-committed-by: Antonin Décimo --- src/main.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.zig b/src/main.zig index 717fe576dc..577ad01c66 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2718,6 +2718,9 @@ fn buildOutputType( entry = .{ .named = linker_args_it.nextOrFatal() }; } else if (mem.eql(u8, arg, "-u")) { try force_undefined_symbols.put(arena, linker_args_it.nextOrFatal(), {}); + } else if (mem.eql(u8, arg, "-w")) { + // This ignores the -w flag of ld64 and ld64.lld to suppress all linker warnings + // since Zig doesn't emit linker warnings. } else if (mem.eql(u8, arg, "-x") or mem.eql(u8, arg, "--discard-all")) { discard_local_symbols = true; } else if (mem.eql(u8, arg, "--stack") or mem.eql(u8, arg, "-stack_size")) {