[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
This commit is contained in:
Alex Shlyapnikov 2018-04-24 00:16:54 +00:00
parent ab7578460b
commit 909fb12f0c
1 changed files with 2 additions and 4 deletions

View File

@ -737,19 +737,17 @@ bool HWAddressSanitizer::runOnFunction(Function &F) {
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;
}