From: Jeremy Morse Date: Mon, 8 Mar 2021 09:48:11 +0000 (+0000) Subject: Revert "[tsan] Use large address space mapping on Apple Silicon Macs" X-Git-Tag: llvmorg-14-init~13061 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=66e3a4abe99c89cc12cc5818f988d7f3519d5c65;p=platform%2Fupstream%2Fllvm.git Revert "[tsan] Use large address space mapping on Apple Silicon Macs" This reverts commit bde2e5607167f3e9fd8c6b51275fc8ac654230a2. This patch produces a compile failure on linux amd64 environments, when running: ninja GotsanRuntimeCheck I get various build errors: ../rtl/tsan_platform.h:608: error: use of undeclared identifier 'Mapping' return MappingImpl(); Here's a buildbot with the same failure during stage "check-tsan in gcc build", there are other unrelated failures in there. http://lab.llvm.org:8011/#/builders/37/builds/2831 --- diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform.h b/compiler-rt/lib/tsan/rtl/tsan_platform.h index 36a7a5a..81d345d 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_platform.h +++ b/compiler-rt/lib/tsan/rtl/tsan_platform.h @@ -26,18 +26,6 @@ namespace __tsan { #if !SANITIZER_GO #if defined(__x86_64__) -#define HAS_48_BIT_ADDRESS_SPACE 1 -#elif SANITIZER_IOSSIM // arm64 iOS simulators (order of #if matters) -#define HAS_48_BIT_ADDRESS_SPACE 1 -#elif SANITIZER_IOS // arm64 iOS devices (order of #if matters) -#define HAS_48_BIT_ADDRESS_SPACE 0 -#elif SANITIZER_MAC // arm64 macOS (order of #if matters) -#define HAS_48_BIT_ADDRESS_SPACE 1 -#else -#define HAS_48_BIT_ADDRESS_SPACE 0 -#endif - -#if HAS_48_BIT_ADDRESS_SPACE /* C/C++ on linux/x86_64 and freebsd/x86_64 0000 0000 1000 - 0080 0000 0000: main binary and/or MAP_32BIT mappings (512GB) @@ -158,7 +146,7 @@ struct Mapping { static const uptr kVdsoBeg = 0x7000000000000000ull; }; -#elif defined(__aarch64__) && !defined(__APPLE__) +#elif defined(__aarch64__) // AArch64 supports multiple VMA which leads to multiple address transformation // functions. To support these multiple VMAS transformations and mappings TSAN // runtime for AArch64 uses an external memory read (vmaSize) to select which @@ -366,7 +354,7 @@ struct Mapping47 { #define TSAN_RUNTIME_VMA 1 #endif -#elif SANITIZER_GO && !SANITIZER_WINDOWS && HAS_48_BIT_ADDRESS_SPACE +#elif SANITIZER_GO && !SANITIZER_WINDOWS && defined(__x86_64__) /* Go on linux, darwin and freebsd on x86_64 0000 0000 1000 - 0000 1000 0000: executable diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp b/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp index d9719a1..0740805 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp +++ b/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp @@ -234,7 +234,7 @@ static void my_pthread_introspection_hook(unsigned int event, pthread_t thread, #endif void InitializePlatformEarly() { -#if !SANITIZER_GO && !HAS_48_BIT_ADDRESS_SPACE +#if !SANITIZER_GO && defined(__aarch64__) uptr max_vm = GetMaxUserVirtualAddress() + 1; if (max_vm != Mapping::kHiAppMemEnd) { Printf("ThreadSanitizer: unsupported vm address limit %p, expected %p.\n", diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cpp index 8e14a05..d56b6c3 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cpp +++ b/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cpp @@ -99,7 +99,7 @@ void CheckAndProtect() { Die(); } -#if defined(__aarch64__) && !HAS_48_BIT_ADDRESS_SPACE +#if defined(__aarch64__) && defined(__APPLE__) ProtectRange(HeapMemEnd(), ShadowBeg()); ProtectRange(ShadowEnd(), MetaShadowBeg()); ProtectRange(MetaShadowEnd(), TraceMemBeg());