Skip to content

Commit 00da38c

Browse files
committed
tsan: add Go race detector support for macOS/ARM64
Add Go race detector support for macOS/ARM64. The Go counterpart is https://golang.org/cl/266373 . Author: cherry (Cherry Zhang) Reviewed-in: https://reviews.llvm.org/D90435
1 parent d273cb6 commit 00da38c

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

compiler-rt/lib/tsan/go/buildgo.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ elif [ "`uname -a | grep NetBSD`" != "" ]; then
117117
../../sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp
118118
"
119119
elif [ "`uname -a | grep Darwin`" != "" ]; then
120-
SUFFIX="darwin_amd64"
121120
OSCFLAGS="-fPIC -Wno-unused-const-variable -Wno-unknown-warning-option -mmacosx-version-min=10.7"
122-
ARCHCFLAGS="-m64"
123121
OSLDFLAGS="-lpthread -fPIC -fpie -mmacosx-version-min=10.7"
124122
SRCS="
125123
$SRCS
@@ -130,6 +128,13 @@ elif [ "`uname -a | grep Darwin`" != "" ]; then
130128
../../sanitizer_common/sanitizer_posix_libcdep.cpp
131129
../../sanitizer_common/sanitizer_procmaps_mac.cpp
132130
"
131+
if [ "`uname -a | grep x86_64`" != "" ]; then
132+
SUFFIX="darwin_amd64"
133+
ARCHCFLAGS="-m64"
134+
elif [ "`uname -a | grep arm64`" != "" ]; then
135+
SUFFIX="darwin_arm64"
136+
ARCHCFLAGS=""
137+
fi
133138
elif [ "`uname -a | grep MINGW`" != "" ]; then
134139
SUFFIX="windows_amd64"
135140
OSCFLAGS="-Wno-error=attributes -Wno-attributes -Wno-unused-const-variable -Wno-unknown-warning-option"

compiler-rt/lib/tsan/rtl/tsan_platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ struct Mapping47 {
461461

462462
#elif SANITIZER_GO && defined(__aarch64__)
463463

464-
/* Go on linux/aarch64 (48-bit VMA)
464+
/* Go on linux/aarch64 (48-bit VMA) and darwin/aarch64 (47-bit VMA)
465465
0000 0000 1000 - 0000 1000 0000: executable
466466
0000 1000 0000 - 00c0 0000 0000: -
467467
00c0 0000 0000 - 00e0 0000 0000: heap

compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ static void my_pthread_introspection_hook(unsigned int event, pthread_t thread,
234234
#endif
235235

236236
void InitializePlatformEarly() {
237-
#if defined(__aarch64__)
237+
#if !SANITIZER_GO && defined(__aarch64__)
238238
uptr max_vm = GetMaxUserVirtualAddress() + 1;
239239
if (max_vm != Mapping::kHiAppMemEnd) {
240240
Printf("ThreadSanitizer: unsupported vm address limit %p, expected %p.\n",

0 commit comments

Comments
 (0)