aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-03-08 06:41:51 +0100
committerAlex Rønne Petersen <alex@alexrp.com>2025-03-08 13:26:09 +0100
commit3b3c18909d5f745f607ead203f67d42d13f200d5 (patch)
treee08dd231c3d3af9eb137c6d03328d4dbbd1cc8c2 /src
parent5466a2f72dd5108846a5318cc70644d8a50bc076 (diff)
downloadzig-3b3c18909d5f745f607ead203f67d42d13f200d5.tar.gz
zig-3b3c18909d5f745f607ead203f67d42d13f200d5.zip
Compilation: Fix `-fno-rtlib-defaultlib` unused argument warning in ReleaseSafe.
Closes #23138.
Diffstat (limited to 'src')
-rw-r--r--src/Compilation.zig20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index bdb6507921..b781a10493 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");
+ }
}
}
}