[HWASan] Use dynamic shadow memory on Android only (LLVM)
There're issues with IFUNC support on other platforms.
DIfferential Revision: https://reviews.llvm.org/D45840
llvm-svn: 330665
diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index e0bdf56..55bdda3 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -737,19 +737,17 @@
void HWAddressSanitizer::ShadowMapping::init(Triple &TargetTriple) {
const bool IsAndroid = TargetTriple.isAndroid();
- const bool IsLinux = TargetTriple.isOSLinux();
- const bool IsX86_64 = TargetTriple.getArch() == Triple::x86_64;
const bool IsAndroidWithIfuncSupport =
IsAndroid && !TargetTriple.isAndroidVersionLT(21);
Scale = kDefaultShadowScale;
- if (ClEnableKhwasan || ClInstrumentWithCalls || IsX86_64)
+ if (ClEnableKhwasan || ClInstrumentWithCalls || !IsAndroidWithIfuncSupport)
Offset = 0;
else
Offset = kDynamicShadowSentinel;
if (ClMappingOffset.getNumOccurrences() > 0)
Offset = ClMappingOffset;
- InGlobal = (IsX86_64 && IsLinux) || IsAndroidWithIfuncSupport;
+ InGlobal = IsAndroidWithIfuncSupport;
}