[asan] Fix shadow mapping on Android/AArch64.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Fri, 17 Jul 2015 23:51:18 +0000 (23:51 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Fri, 17 Jul 2015 23:51:18 +0000 (23:51 +0000)
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

index a98439b6b395373c49bc3fe11e8fdb73e0d5734b..52b2290a93806ac50f0c16c458c391f799b34507 100644 (file)
@@ -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;