diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-05-23 11:52:12 +0000 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2012-05-23 14:31:22 -0700 |
commit | 563c712a3905bd86b1c895ecddb528a810fd89b9 (patch) | |
tree | 6a2b3e57ce8c27e12ade15aaaa15f7686c7cda40 | |
parent | fd6aea25184fd0735922461b88f059ee547844c3 (diff) | |
download | external_llvm-563c712a3905bd86b1c895ecddb528a810fd89b9.zip external_llvm-563c712a3905bd86b1c895ecddb528a810fd89b9.tar.gz external_llvm-563c712a3905bd86b1c895ecddb528a810fd89b9.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 b43b9e5..7fb33f7 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; @@ -556,8 +558,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 |