[compiler-rt] 64f4041 - [TSan][Darwin] Fix shadow mapping for iOS simulator on Apple Silicon

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 17 15:59:57 PST 2021


Author: Julian Lettner
Date: 2021-12-17T15:59:43-08:00
New Revision: 64f40417259c11ffcfccd2e812dd3e2d83b86591

URL: https://github.com/llvm/llvm-project/commit/64f40417259c11ffcfccd2e812dd3e2d83b86591
DIFF: https://github.com/llvm/llvm-project/commit/64f40417259c11ffcfccd2e812dd3e2d83b86591.diff

LOG: [TSan][Darwin] Fix shadow mapping for iOS simulator on Apple Silicon

With the introduction of Apple Silicon `defined(__aarch64__)` is not a
reliable way to check for the platform anymore.

We want to use the "normal" `Mapping48AddressSpace` mapping everywhere
except devices, including the iOS simulators on AS.

Relevant revisions:
https://reviews.llvm.org/D35147
https://reviews.llvm.org/D86377
https://reviews.llvm.org/D107743
https://reviews.llvm.org/D107888

Differential Revision: https://reviews.llvm.org/D115843

Added: 
    

Modified: 
    compiler-rt/lib/tsan/rtl/tsan_platform.h
    compiler-rt/lib/tsan/rtl/tsan_platform_posix.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_platform.h b/compiler-rt/lib/tsan/rtl/tsan_platform.h
index e28bac2457aa1..c67f0628f5f7e 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform.h
@@ -585,11 +585,11 @@ ALWAYS_INLINE auto SelectMapping(Arg arg) {
   return Func::template Apply<MappingGo48>(arg);
 #  endif
 #else  // SANITIZER_GO
-#  if defined(__x86_64__) || SANITIZER_IOSSIM || SANITIZER_MAC && !SANITIZER_IOS
-  return Func::template Apply<Mapping48AddressSpace>(arg);
-#  elif defined(__aarch64__) && defined(__APPLE__)
+#  if SANITIZER_IOS && !SANITIZER_IOSSIM
   return Func::template Apply<MappingAppleAarch64>(arg);
-#  elif defined(__aarch64__) && !defined(__APPLE__)
+#  elif defined(__x86_64__) || SANITIZER_MAC
+  return Func::template Apply<Mapping48AddressSpace>(arg);
+#  elif defined(__aarch64__)
   switch (vmaSize) {
     case 39:
       return Func::template Apply<MappingAarch64_39>(arg);

diff  --git a/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cpp
index cc9c7b2b74375..71874aad8dc5e 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cpp
@@ -110,7 +110,7 @@ void CheckAndProtect() {
     Die();
   }
 
-#    if defined(__aarch64__) && defined(__APPLE__) && SANITIZER_IOS
+#    if SANITIZER_IOS && !SANITIZER_IOSSIM
   ProtectRange(HeapMemEnd(), ShadowBeg());
   ProtectRange(ShadowEnd(), MetaShadowBeg());
   ProtectRange(MetaShadowEnd(), HiAppMemBeg());


        


More information about the llvm-commits mailing list