Index: compiler-rt/lib/tsan/go/buildgo.sh =================================================================== --- compiler-rt/lib/tsan/go/buildgo.sh +++ compiler-rt/lib/tsan/go/buildgo.sh @@ -117,9 +117,7 @@ ../../sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp " elif [ "`uname -a | grep Darwin`" != "" ]; then - SUFFIX="darwin_amd64" OSCFLAGS="-fPIC -Wno-unused-const-variable -Wno-unknown-warning-option -mmacosx-version-min=10.7" - ARCHCFLAGS="-m64" OSLDFLAGS="-lpthread -fPIC -fpie -mmacosx-version-min=10.7" SRCS=" $SRCS @@ -130,6 +128,13 @@ ../../sanitizer_common/sanitizer_posix_libcdep.cpp ../../sanitizer_common/sanitizer_procmaps_mac.cpp " + if [ "`uname -a | grep x86_64`" != "" ]; then + SUFFIX="darwin_amd64" + ARCHCFLAGS="-m64" + elif [ "`uname -a | grep arm64`" != "" ]; then + SUFFIX="darwin_arm64" + ARCHCFLAGS="" + fi elif [ "`uname -a | grep MINGW`" != "" ]; then SUFFIX="windows_amd64" OSCFLAGS="-Wno-error=attributes -Wno-attributes -Wno-unused-const-variable -Wno-unknown-warning-option" Index: compiler-rt/lib/tsan/rtl/tsan_platform.h =================================================================== --- compiler-rt/lib/tsan/rtl/tsan_platform.h +++ compiler-rt/lib/tsan/rtl/tsan_platform.h @@ -461,7 +461,7 @@ #elif SANITIZER_GO && defined(__aarch64__) -/* Go on linux/aarch64 (48-bit VMA) +/* Go on linux/aarch64 (48-bit VMA) and darwin/aarch64 (47-bit VMA) 0000 0000 1000 - 0000 1000 0000: executable 0000 1000 0000 - 00c0 0000 0000: - 00c0 0000 0000 - 00e0 0000 0000: heap Index: compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp =================================================================== --- compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp +++ compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp @@ -234,7 +234,7 @@ #endif void InitializePlatformEarly() { -#if defined(__aarch64__) +#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",