From dc10cc86fd28b04e8c40ed895dd84b1952a3f0fd Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Fri, 17 Jul 2015 23:51:18 +0000 Subject: [PATCH] [asan] Fix shadow mapping on Android/AArch64. Instrumentation and the runtime library were in disagreement about ASan shadow offset on Android/AArch64. This fixes a large number of existing tests on Android/AArch64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242595 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Instrumentation/AddressSanitizer.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/lib/Transforms/Instrumentation/AddressSanitizer.cpp index a98439b6b39..52b2290a938 100644 --- a/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -337,10 +337,12 @@ static ShadowMapping getShadowMapping(Triple &TargetTriple, int LongSize, ShadowMapping Mapping; - if (LongSize == 32) { - if (IsAndroid) - Mapping.Offset = 0; - else if (IsMIPS32) + if (IsAndroid) { + // Android is always PIE, which means that the beginning of the address + // space is always available. + Mapping.Offset = 0; + } else if (LongSize == 32) { + if (IsMIPS32) Mapping.Offset = kMIPS32_ShadowOffset32; else if (IsFreeBSD) Mapping.Offset = kFreeBSD_ShadowOffset32;