diff options
author | Vitaly Buka <vitalybuka@google.com> | 2024-12-18 10:37:44 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-18 10:37:44 -0800 |
commit | 9af5de320b77d3757ea2b7e3d85c67f88dfbabb5 (patch) | |
tree | 81175f3690602abfde2fa53e2b36d0a03a25617a /clang/lib | |
parent | 1a87f07465d76c87ace25623c67faf9596bbbf56 (diff) | |
download | llvm-9af5de320b77d3757ea2b7e3d85c67f88dfbabb5.zip llvm-9af5de320b77d3757ea2b7e3d85c67f88dfbabb5.tar.gz llvm-9af5de320b77d3757ea2b7e3d85c67f88dfbabb5.tar.bz2 |
[driver] Fix sanitizer libc++ runtime linking (#120370)
1. -f[no-]sanitize-link-c++-runtime suppose to
override defauld behavior implied from `CCCIsCXX`
2. Take into account -nostdlib++ (unblocks #108357)
3. Fix typo hasFlag vs hasArg.
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Driver/SanitizerArgs.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp index 81f94f2..0edfe64 100644 --- a/clang/lib/Driver/SanitizerArgs.cpp +++ b/clang/lib/Driver/SanitizerArgs.cpp @@ -1098,10 +1098,11 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC, options::OPT_fno_sanitize_link_runtime, LinkRuntimes); // Parse -link-cxx-sanitizer flag. - LinkCXXRuntimes = Args.hasArg(options::OPT_fsanitize_link_cxx_runtime, - options::OPT_fno_sanitize_link_cxx_runtime, - LinkCXXRuntimes) || - D.CCCIsCXX(); + LinkCXXRuntimes = + D.CCCIsCXX() && !Args.hasArg(clang::driver::options::OPT_nostdlibxx); + LinkCXXRuntimes = + Args.hasFlag(options::OPT_fsanitize_link_cxx_runtime, + options::OPT_fno_sanitize_link_cxx_runtime, LinkCXXRuntimes); NeedsMemProfRt = Args.hasFlag(options::OPT_fmemory_profile, options::OPT_fmemory_profile_EQ, |