Index: lib/sanitizer_common/sanitizer_platform.h =================================================================== --- lib/sanitizer_common/sanitizer_platform.h +++ lib/sanitizer_common/sanitizer_platform.h @@ -81,16 +81,6 @@ # define SANITIZER_X32 0 #endif -// VMA size definition for architecture that support multiple sizes. -// AArch64 has 3 VMA sizes: 39, 42 and 48. -#if !defined(SANITIZER_AARCH64_VMA) -# define SANITIZER_AARCH64_VMA 39 -#else -# if SANITIZER_AARCH64_VMA != 39 && SANITIZER_AARCH64_VMA != 42 -# error "invalid SANITIZER_AARCH64_VMA size" -# endif -#endif - // By default we allow to use SizeClassAllocator64 on 64-bit platform. // But in some cases (e.g. AArch64's 39-bit address space) SizeClassAllocator64 // does not work well and we need to fallback to SizeClassAllocator32. @@ -137,10 +127,8 @@ #define SANITIZER_USES_UID16_SYSCALLS 0 #endif -#if defined(__mips__) || (defined(__aarch64__) && SANITIZER_AARCH64_VMA == 39) +#if defined(__mips__) # define SANITIZER_POINTER_FORMAT_LENGTH FIRST_32_SECOND_64(8, 10) -#elif defined(__aarch64__) && SANITIZER_AARCH64_VMA == 42 -# define SANITIZER_POINTER_FORMAT_LENGTH FIRST_32_SECOND_64(8, 11) #else # define SANITIZER_POINTER_FORMAT_LENGTH FIRST_32_SECOND_64(8, 12) #endif Index: lib/sanitizer_common/sanitizer_posix.cc =================================================================== --- lib/sanitizer_common/sanitizer_posix.cc +++ lib/sanitizer_common/sanitizer_posix.cc @@ -321,22 +321,6 @@ return SignalContext(context, addr, pc, sp, bp); } -// This function check is the built VMA matches the runtime one for -// architectures with multiple VMA size. -void CheckVMASize() { -#ifdef __aarch64__ - static const unsigned kBuiltVMA = SANITIZER_AARCH64_VMA; - unsigned maxRuntimeVMA = - (MostSignificantSetBitIndex(GET_CURRENT_FRAME()) + 1); - if (kBuiltVMA != maxRuntimeVMA) { - Printf("WARNING: %s runtime VMA is not the one built for.\n", - SanitizerToolName); - Printf("\tBuilt VMA: %u bits\n", kBuiltVMA); - Printf("\tRuntime VMA: %u bits\n", maxRuntimeVMA); - } -#endif -} - } // namespace __sanitizer #endif // SANITIZER_POSIX Index: test/tsan/Darwin/symbolizer-atos.cc =================================================================== --- test/tsan/Darwin/symbolizer-atos.cc +++ test/tsan/Darwin/symbolizer-atos.cc @@ -12,9 +12,7 @@ int main() { barrier_init(&barrier, 2); - fprintf(stderr, "addr="); - print_address(GlobalData); - fprintf(stderr, "\n"); + print_address("addr=", 1, GlobalData); pthread_t t; pthread_create(&t, 0, Thread, 0); GlobalData[2] = 43; Index: test/tsan/Darwin/symbolizer-dladdr.cc =================================================================== --- test/tsan/Darwin/symbolizer-dladdr.cc +++ test/tsan/Darwin/symbolizer-dladdr.cc @@ -12,9 +12,7 @@ int main() { barrier_init(&barrier, 2); - fprintf(stderr, "addr="); - print_address(GlobalData); - fprintf(stderr, "\n"); + print_address("addr=", 1, GlobalData); pthread_t t; pthread_create(&t, 0, Thread, 0); GlobalData[2] = 43; Index: test/tsan/deadlock_detector_stress_test.cc =================================================================== --- test/tsan/deadlock_detector_stress_test.cc +++ test/tsan/deadlock_detector_stress_test.cc @@ -152,7 +152,7 @@ fprintf(stderr, "Starting Test1\n"); // CHECK: Starting Test1 Init(5); - fprintf(stderr, "Expecting lock inversion: %p %p\n", A(0), A(1)); + print_address("Expecting lock inversion: ", 2, A(0), A(1)); // CHECK: Expecting lock inversion: [[A1:0x[a-f0-9]*]] [[A2:0x[a-f0-9]*]] Lock_0_1(); Lock_1_0(); @@ -178,7 +178,7 @@ fprintf(stderr, "Starting Test2\n"); // CHECK: Starting Test2 Init(5); - fprintf(stderr, "Expecting lock inversion: %p %p %p\n", A(0), A(1), A(2)); + print_address("Expecting lock inversion: ", 3, A(0), A(1), A(2)); // CHECK: Expecting lock inversion: [[A1:0x[a-f0-9]*]] [[A2:0x[a-f0-9]*]] [[A3:0x[a-f0-9]*]] Lock2(0, 1); Lock2(1, 2); Index: test/tsan/global_race.cc =================================================================== --- test/tsan/global_race.cc +++ test/tsan/global_race.cc @@ -11,9 +11,7 @@ int main() { barrier_init(&barrier, 2); - fprintf(stderr, "addr="); - print_address(GlobalData); - fprintf(stderr, "\n"); + print_address("addr=", 1, GlobalData); pthread_t t; pthread_create(&t, 0, Thread, 0); GlobalData[2] = 43; Index: test/tsan/global_race2.cc =================================================================== --- test/tsan/global_race2.cc +++ test/tsan/global_race2.cc @@ -11,9 +11,7 @@ int main() { barrier_init(&barrier, 2); - fprintf(stderr, "addr2="); - print_address(&x); - fprintf(stderr, "\n"); + print_address("addr2=", 1, &x); pthread_t t; pthread_create(&t, 0, Thread, 0); x = 0; Index: test/tsan/global_race3.cc =================================================================== --- test/tsan/global_race3.cc +++ test/tsan/global_race3.cc @@ -16,9 +16,7 @@ int main() { barrier_init(&barrier, 2); - fprintf(stderr, "addr3="); - print_address(XXX::YYY::ZZZ); - fprintf(stderr, "\n"); + print_address("addr3=", 1, XXX::YYY::ZZZ); pthread_t t; pthread_create(&t, 0, Thread, 0); XXX::YYY::ZZZ[0] = 0; Index: test/tsan/memcmp_race.cc =================================================================== --- test/tsan/memcmp_race.cc +++ test/tsan/memcmp_race.cc @@ -23,7 +23,7 @@ int main() { barrier_init(&barrier, 2); - fprintf(stderr, "addr=%p\n", &data0[5]); + print_address("addr=", 1, &data0[5]); pthread_t t[2]; pthread_create(&t[0], NULL, Thread1, NULL); pthread_create(&t[1], NULL, Thread2, NULL); Index: test/tsan/memcpy_race.cc =================================================================== --- test/tsan/memcpy_race.cc +++ test/tsan/memcpy_race.cc @@ -22,7 +22,7 @@ int main() { barrier_init(&barrier, 2); - fprintf(stderr, "addr=%p\n", &data[5]); + print_address("addr=", 1, &data[5]); pthread_t t[2]; pthread_create(&t[0], NULL, Thread1, NULL); pthread_create(&t[1], NULL, Thread2, NULL); Index: test/tsan/mop_with_offset.cc =================================================================== --- test/tsan/mop_with_offset.cc +++ test/tsan/mop_with_offset.cc @@ -18,8 +18,8 @@ int main() { barrier_init(&barrier, 2); int *data = new int(42); - fprintf(stderr, "ptr1=%p\n", data); - fprintf(stderr, "ptr2=%p\n", (char*)data + 2); + print_address("ptr1=", 1, data); + print_address("ptr2=", 1, (char*)data + 2); pthread_t t[2]; pthread_create(&t[0], NULL, Thread1, data); pthread_create(&t[1], NULL, Thread2, data); Index: test/tsan/mop_with_offset2.cc =================================================================== --- test/tsan/mop_with_offset2.cc +++ test/tsan/mop_with_offset2.cc @@ -18,8 +18,8 @@ int main() { barrier_init(&barrier, 2); int *data = new int(42); - fprintf(stderr, "ptr1=%p\n", data); - fprintf(stderr, "ptr2=%p\n", (char*)data + 2); + print_address("ptr1=", 1, data); + print_address("ptr2=", 1, (char*)data + 2); pthread_t t[2]; pthread_create(&t[0], NULL, Thread1, data); pthread_create(&t[1], NULL, Thread2, data); Index: test/tsan/race_on_heap.cc =================================================================== --- test/tsan/race_on_heap.cc +++ test/tsan/race_on_heap.cc @@ -2,6 +2,7 @@ #include #include #include +#include "test.h" void *Thread1(void *p) { *(int*)p = 42; @@ -26,7 +27,7 @@ pthread_t t[2]; pthread_create(&t[0], 0, AllocThread, 0); pthread_join(t[0], &p); - fprintf(stderr, "addr=%p\n", p); + print_address("addr=", 1, p); pthread_create(&t[0], 0, Thread1, (char*)p + 16); pthread_create(&t[1], 0, Thread2, (char*)p + 16); pthread_join(t[0], 0); Index: test/tsan/test.h =================================================================== --- test/tsan/test.h +++ test/tsan/test.h @@ -5,6 +5,7 @@ #include #include #include +#include #ifdef __APPLE__ #include @@ -39,30 +40,21 @@ // Default instance of the barrier, but a test can declare more manually. invisible_barrier_t barrier; -void print_address(void *address) { -// On FreeBSD, the %p conversion specifier works as 0x%x and thus does not match -// to the format used in the diagnotic message. -#ifdef __x86_64__ - fprintf(stderr, "0x%012lx", (unsigned long) address); +void print_address(const char *str, int n, ...) { + fprintf(stderr, "%s", str); + va_list ap; + va_start(ap, n); + while (n--) { + void *p = va_arg(ap, void *); +#if defined(__x86_64__) || defined(__aarch64__) + // On FreeBSD, the %p conversion specifier works as 0x%x and thus does not + // match to the format used in the diagnotic message. + fprintf(stderr, "0x%012lx ", (unsigned long) p); #elif defined(__mips64) - fprintf(stderr, "0x%010lx", (unsigned long) address); -#elif defined(__aarch64__) - // AArch64 currently has 3 different VMA (39, 42, and 48 bits) and it requires - // different pointer size to match the diagnostic message. - const char *format = 0; - unsigned long vma = (unsigned long)__builtin_frame_address(0); - vma = 64 - __builtin_clzll(vma); - if (vma == 39) - format = "0x%010lx"; - else if (vma == 42) - format = "0x%011lx"; - else { - fprintf(stderr, "unsupported vma: %lu\n", vma); - exit(1); - } - - fprintf(stderr, format, (unsigned long) address); + fprintf(stderr, "0x%010lx ", (unsigned long) p); #endif + } + fprintf(stderr, "\n"); } #ifdef __APPLE__