diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform.h b/compiler-rt/lib/tsan/rtl/tsan_platform.h --- a/compiler-rt/lib/tsan/rtl/tsan_platform.h +++ b/compiler-rt/lib/tsan/rtl/tsan_platform.h @@ -105,7 +105,7 @@ ff00 0000 00 - ff80 0000 00: - (2 GB) ff80 0000 00 - ffff ffff ff: modules and main thread stack (<2 GB) */ -struct Mapping { +struct Mapping40 { static const uptr kMetaShadowBeg = 0x4000000000ull; static const uptr kMetaShadowEnd = 0x5000000000ull; static const uptr kTraceMemBeg = 0xb000000000ull; @@ -126,6 +126,7 @@ }; #define TSAN_MID_APP_RANGE 1 +#define TSAN_RUNTIME_VMA 1 #elif defined(__aarch64__) && defined(__APPLE__) /* C/C++ on Darwin/iOS/ARM64 (36-bit VMA, 64 GB VM) @@ -514,7 +515,7 @@ 6000 0000 0000 - 6200 0000 0000: traces 6200 0000 0000 - 8000 0000 0000: - */ -struct Mapping { +struct Mapping47 { static const uptr kMetaShadowBeg = 0x300000000000ull; static const uptr kMetaShadowEnd = 0x400000000000ull; static const uptr kTraceMemBeg = 0x600000000000ull; @@ -524,6 +525,9 @@ static const uptr kAppMemBeg = 0x000000001000ull; static const uptr kAppMemEnd = 0x00e000000000ull; }; + +#define TSAN_RUNTIME_VMA 1 + #else # error "Unknown platform" #endif @@ -604,6 +608,16 @@ } DCHECK(0); return 0; +#elif defined(__mips64) + switch (vmaSize) { +#if !SANITIZER_GO + case 40: return MappingImpl(); +#else + case 47: return MappingImpl(); +#endif + } + DCHECK(0); + return 0; #else return MappingImpl(); #endif @@ -761,6 +775,16 @@ } DCHECK(0); return false; +#elif defined(__mips64) + switch (vmaSize) { +#if !SANITIZER_GO + case 40: return IsAppMemImpl(mem); +#else + case 47: return IsAppMemImpl(mem); +#endif + } + DCHECK(0); + return false; #else return IsAppMemImpl(mem); #endif @@ -792,6 +816,16 @@ } DCHECK(0); return false; +#elif defined(__mips64) + switch (vmaSize) { +#if !SANITIZER_GO + case 40: return IsShadowMemImpl(mem); +#else + case 47: return IsShadowMemImpl(mem); +#endif + } + DCHECK(0); + return false; #else return IsShadowMemImpl(mem); #endif @@ -823,6 +857,16 @@ } DCHECK(0); return false; +#elif defined(__mips64) + switch (vmaSize) { +#if !SANITIZER_GO + case 40: return IsMetaMemImpl(mem); +#else + case 47: return IsMetaMemImpl(mem); +#endif + } + DCHECK(0); + return false; #else return IsMetaMemImpl(mem); #endif @@ -864,6 +908,16 @@ } DCHECK(0); return 0; +#elif defined(__mips64) + switch (vmaSize) { +#if !SANITIZER_GO + case 40: return MemToShadowImpl(x); +#else + case 47: return MemToShadowImpl(x); +#endif + } + DCHECK(0); + return 0; #else return MemToShadowImpl(x); #endif @@ -907,6 +961,16 @@ } DCHECK(0); return 0; +#elif defined(__mips64) + switch (vmaSize) { +#if !SANITIZER_GO + case 40: return MemToMetaImpl(x); +#else + case 47: return MemToMetaImpl(x); +#endif + } + DCHECK(0); + return 0; #else return MemToMetaImpl(x); #endif @@ -963,6 +1027,16 @@ } DCHECK(0); return 0; +#elif defined(__mips64) + switch (vmaSize) { +#if !SANITIZER_GO + case 40: return ShadowToMemImpl(s); +#else + case 47: return ShadowToMemImpl(s); +#endif + } + DCHECK(0); + return 0; #else return ShadowToMemImpl(s); #endif @@ -1002,6 +1076,16 @@ } DCHECK(0); return 0; +#elif defined(__mips64) + switch (vmaSize) { +#if !SANITIZER_GO + case 40: return GetThreadTraceImpl(tid); +#else + case 47: return GetThreadTraceImpl(tid); +#endif + } + DCHECK(0); + return 0; #else return GetThreadTraceImpl(tid); #endif @@ -1036,6 +1120,16 @@ } DCHECK(0); return 0; +#elif defined(__mips64) + switch (vmaSize) { +#if !SANITIZER_GO + case 40: return GetThreadTraceHeaderImpl(tid); +#else + case 47: return GetThreadTraceHeaderImpl(tid); +#endif + } + DCHECK(0); + return 0; #else return GetThreadTraceHeaderImpl(tid); #endif diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp --- a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp +++ b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp @@ -250,6 +250,20 @@ Die(); } # endif +#elif defined(__mips64) +# if !SANITIZER_GO + if (vmaSize != 40) { + Printf("FATAL: ThreadSanitizer: unsupported VMA range\n"); + Printf("FATAL: Found %zd - Supported 40\n", vmaSize); + Die(); + } +# else + if (vmaSize != 47) { + Printf("FATAL: ThreadSanitizer: unsupported VMA range\n"); + Printf("FATAL: Found %zd - Supported 47\n", vmaSize); + Die(); + } +# endif #endif #endif }