From 3b3c18909d5f745f607ead203f67d42d13f200d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Sat, 8 Mar 2025 06:41:51 +0100 Subject: [PATCH] Compilation: Fix `-fno-rtlib-defaultlib` unused argument warning in ReleaseSafe. Closes #23138. --- src/Compilation.zig | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Compilation.zig b/src/Compilation.zig index bdb6507921d7..b781a10493c2 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -6029,17 +6029,19 @@ pub fn addCCArgs( // function was called. try argv.append("-fno-sanitize=function"); - // It's recommended to use the minimal runtime in production environments - // due to the security implications of the full runtime. The minimal runtime - // doesn't provide much benefit over simply trapping. if (mod.optimize_mode == .ReleaseSafe) { + // It's recommended to use the minimal runtime in production + // environments due to the security implications of the full runtime. + // The minimal runtime doesn't provide much benefit over simply + // trapping, however, so we do that instead. try argv.append("-fsanitize-trap=undefined"); - } - - // This is necessary because, by default, Clang instructs LLVM to embed a COFF link - // dependency on `libclang_rt.ubsan_standalone.a` when the UBSan runtime is used. - if (target.os.tag == .windows) { - try argv.append("-fno-rtlib-defaultlib"); + } else { + // This is necessary because, by default, Clang instructs LLVM to embed + // a COFF link dependency on `libclang_rt.ubsan_standalone.a` when the + // UBSan runtime is used. + if (target.os.tag == .windows) { + try argv.append("-fno-rtlib-defaultlib"); + } } } }