[clang] [clang] Don't pass sanitizers' rtlibs to linker with `-r` (PR #147905)

Peter Collingbourne via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 11 21:51:09 PDT 2025


================
@@ -1159,7 +1159,8 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
 
   LinkRuntimes =
       Args.hasFlag(options::OPT_fsanitize_link_runtime,
-                   options::OPT_fno_sanitize_link_runtime, LinkRuntimes);
+                   options::OPT_fno_sanitize_link_runtime, LinkRuntimes) &&
----------------
pcc wrote:

The third argument to `hasFlag` is the default, you could pass in the `-r` value there. `LinkRuntimes` is only set here so you don't need to care about the previous value.

https://github.com/llvm/llvm-project/pull/147905


More information about the cfe-commits mailing list