[clang] [WIP][Driver] Enable ASan on Solaris/SPARC (PR #107403)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 5 06:49:04 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-driver
@llvm/pr-subscribers-clang
Author: Rainer Orth (rorth)
<details>
<summary>Changes</summary>
Once PR #<!-- -->107223 lands, ASan can be enabled on Solaris/SPARC. This patch does just that. As on Solaris/x86, the dynamic ASan runtime lib needs to be linked with `-z now` to avoid an `AsanInitInternal` cycle.
Tested on `sparcv9-sun-solaris2.11` and `sparc64-unknown-linux-gnu`.
This is not yet ready to be committed, though: even with the corresponding `compiler-rt` patch, 36 tests still `FAIL`.
For Linux/sparc64, nothing needs to be done since `clang` enables ASan by default, irrespective of target. On top of that, test results are way worse, with quite a number of tests hanging completely.
---
Full diff: https://github.com/llvm/llvm-project/pull/107403.diff
1 Files Affected:
- (modified) clang/lib/Driver/ToolChains/Solaris.cpp (+4-4)
``````````diff
diff --git a/clang/lib/Driver/ToolChains/Solaris.cpp b/clang/lib/Driver/ToolChains/Solaris.cpp
index e82ed2ca79ffd6..8d4ab40ce9f1de 100644
--- a/clang/lib/Driver/ToolChains/Solaris.cpp
+++ b/clang/lib/Driver/ToolChains/Solaris.cpp
@@ -265,8 +265,7 @@ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA,
}
}
// Avoid AsanInitInternal cycle, Issue #64126.
- if (ToolChain.getTriple().isX86() && SA.needsSharedRt() &&
- SA.needsAsanRt()) {
+ if (SA.needsSharedRt() && SA.needsAsanRt()) {
CmdArgs.push_back("-z");
CmdArgs.push_back("now");
}
@@ -333,10 +332,11 @@ Solaris::Solaris(const Driver &D, const llvm::Triple &Triple,
}
SanitizerMask Solaris::getSupportedSanitizers() const {
+ const bool IsSparc = getTriple().getArch() == llvm::Triple::sparc;
const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
SanitizerMask Res = ToolChain::getSupportedSanitizers();
- // FIXME: Omit X86_64 until 64-bit support is figured out.
- if (IsX86) {
+ // FIXME: Omit SparcV9 and X86_64 until 64-bit support is figured out.
+ if (IsSparc || IsX86) {
Res |= SanitizerKind::Address;
Res |= SanitizerKind::PointerCompare;
Res |= SanitizerKind::PointerSubtract;
``````````
</details>
https://github.com/llvm/llvm-project/pull/107403
More information about the cfe-commits
mailing list