Skip to content

Commit 3b3c189

Browse files
committed
Compilation: Fix -fno-rtlib-defaultlib unused argument warning in ReleaseSafe.
Closes #23138.
1 parent 5466a2f commit 3b3c189

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/Compilation.zig

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6029,17 +6029,19 @@ pub fn addCCArgs(
60296029
// function was called.
60306030
try argv.append("-fno-sanitize=function");
60316031

6032-
// It's recommended to use the minimal runtime in production environments
6033-
// due to the security implications of the full runtime. The minimal runtime
6034-
// doesn't provide much benefit over simply trapping.
60356032
if (mod.optimize_mode == .ReleaseSafe) {
6033+
// It's recommended to use the minimal runtime in production
6034+
// environments due to the security implications of the full runtime.
6035+
// The minimal runtime doesn't provide much benefit over simply
6036+
// trapping, however, so we do that instead.
60366037
try argv.append("-fsanitize-trap=undefined");
6037-
}
6038-
6039-
// This is necessary because, by default, Clang instructs LLVM to embed a COFF link
6040-
// dependency on `libclang_rt.ubsan_standalone.a` when the UBSan runtime is used.
6041-
if (target.os.tag == .windows) {
6042-
try argv.append("-fno-rtlib-defaultlib");
6038+
} else {
6039+
// This is necessary because, by default, Clang instructs LLVM to embed
6040+
// a COFF link dependency on `libclang_rt.ubsan_standalone.a` when the
6041+
// UBSan runtime is used.
6042+
if (target.os.tag == .windows) {
6043+
try argv.append("-fno-rtlib-defaultlib");
6044+
}
60436045
}
60446046
}
60456047
}

0 commit comments

Comments
 (0)