Skip to content

Commit

Permalink
Compilation: Fix -fno-rtlib-defaultlib unused argument warning in R…
Browse files Browse the repository at this point in the history
…eleaseSafe.

Closes #23138.
  • Loading branch information
alexrp committed Mar 8, 2025
1 parent 5466a2f commit 3b3c189
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/Compilation.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
}
}
Expand Down

0 comments on commit 3b3c189

Please sign in to comment.