diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-05-23 11:52:12 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-05-23 11:52:12 +0000 |
commit | 06fdbaa9145f01a291d4981ca5120b7bdcad44c6 (patch) | |
tree | 22c0ba9d07044f678235a2becd6d01b5cee98ea3 | |
parent | a2067fbe22930be8413584ae58c5ef78bd032190 (diff) | |
download | external_llvm-06fdbaa9145f01a291d4981ca5120b7bdcad44c6.zip external_llvm-06fdbaa9145f01a291d4981ca5120b7bdcad44c6.tar.gz external_llvm-06fdbaa9145f01a291d4981ca5120b7bdcad44c6.tar.bz2 |
Use zero-based shadow by default on Android.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157317 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Instrumentation/AddressSanitizer.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/lib/Transforms/Instrumentation/AddressSanitizer.cpp index b01cdbf..5f03d35 100644 --- a/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -22,6 +22,7 @@ #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/Triple.h" #include "llvm/Function.h" #include "llvm/IntrinsicInst.h" #include "llvm/LLVMContext.h" @@ -47,6 +48,7 @@ using namespace llvm; static const uint64_t kDefaultShadowScale = 3; static const uint64_t kDefaultShadowOffset32 = 1ULL << 29; static const uint64_t kDefaultShadowOffset64 = 1ULL << 44; +static const uint64_t kDefaultShadowOffsetAndroid = 0; static const size_t kMaxStackMallocSize = 1 << 16; // 64K static const uintptr_t kCurrentStackFrameMagic = 0x41B58AB3; @@ -571,8 +573,11 @@ bool AddressSanitizer::runOnModule(Module &M) { AsanInitFunction->setLinkage(Function::ExternalLinkage); IRB.CreateCall(AsanInitFunction); - MappingOffset = LongSize == 32 - ? kDefaultShadowOffset32 : kDefaultShadowOffset64; + llvm::Triple targetTriple(M.getTargetTriple()); + bool isAndroid = targetTriple.getEnvironment() == llvm::Triple::ANDROIDEABI; + + MappingOffset = isAndroid ? kDefaultShadowOffsetAndroid : + (LongSize == 32 ? kDefaultShadowOffset32 : kDefaultShadowOffset64); if (ClMappingOffsetLog >= 0) { if (ClMappingOffsetLog == 0) { // special case |