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>
This commit is contained in:
Antonin Décimo
2026-03-17 09:24:30 +01:00
committed by Andrew Kelley
parent bd89b61a21
commit 47d2e5de90
+3
View File
@@ -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")) {