Skip to content

Commit d01e336

Browse files
authored
[Driver] Enable ASan on Solaris/SPARC (#107403)
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`.
1 parent fff03b0 commit d01e336

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/lib/Driver/ToolChains/Solaris.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,7 @@ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA,
266266
}
267267
}
268268
// Avoid AsanInitInternal cycle, Issue #64126.
269-
if (ToolChain.getTriple().isX86() && SA.needsSharedRt() &&
270-
SA.needsAsanRt()) {
269+
if (SA.needsSharedRt() && SA.needsAsanRt()) {
271270
CmdArgs.push_back("-z");
272271
CmdArgs.push_back("now");
273272
}
@@ -334,10 +333,11 @@ Solaris::Solaris(const Driver &D, const llvm::Triple &Triple,
334333
}
335334

336335
SanitizerMask Solaris::getSupportedSanitizers() const {
336+
const bool IsSparc = getTriple().getArch() == llvm::Triple::sparc;
337337
const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
338338
SanitizerMask Res = ToolChain::getSupportedSanitizers();
339-
// FIXME: Omit X86_64 until 64-bit support is figured out.
340-
if (IsX86) {
339+
// FIXME: Omit SparcV9 and X86_64 until 64-bit support is figured out.
340+
if (IsSparc || IsX86) {
341341
Res |= SanitizerKind::Address;
342342
Res |= SanitizerKind::PointerCompare;
343343
Res |= SanitizerKind::PointerSubtract;

0 commit comments

Comments
 (0)