summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_platform.h14
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_posix.cc16
-rw-r--r--compiler-rt/test/tsan/Darwin/symbolizer-atos.cc4
-rw-r--r--compiler-rt/test/tsan/Darwin/symbolizer-dladdr.cc4
-rw-r--r--compiler-rt/test/tsan/deadlock_detector_stress_test.cc4
-rw-r--r--compiler-rt/test/tsan/global_race.cc4
-rw-r--r--compiler-rt/test/tsan/global_race2.cc4
-rw-r--r--compiler-rt/test/tsan/global_race3.cc4
-rw-r--r--compiler-rt/test/tsan/memcmp_race.cc2
-rw-r--r--compiler-rt/test/tsan/memcpy_race.cc2
-rw-r--r--compiler-rt/test/tsan/mop_with_offset.cc4
-rw-r--r--compiler-rt/test/tsan/mop_with_offset2.cc4
-rw-r--r--compiler-rt/test/tsan/race_on_heap.cc3
-rw-r--r--compiler-rt/test/tsan/test.h36
14 files changed, 30 insertions, 75 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
index a60691efbea..841cceb510a 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
+++ b/compiler-rt/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
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc
index 333fbe1f13e..5ae68663df0 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc
@@ -321,22 +321,6 @@ SignalContext SignalContext::Create(void *siginfo, void *context) {
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
diff --git a/compiler-rt/test/tsan/Darwin/symbolizer-atos.cc b/compiler-rt/test/tsan/Darwin/symbolizer-atos.cc
index 318ecf0783f..960fecc9864 100644
--- a/compiler-rt/test/tsan/Darwin/symbolizer-atos.cc
+++ b/compiler-rt/test/tsan/Darwin/symbolizer-atos.cc
@@ -12,9 +12,7 @@ void *Thread(void *a) {
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;
diff --git a/compiler-rt/test/tsan/Darwin/symbolizer-dladdr.cc b/compiler-rt/test/tsan/Darwin/symbolizer-dladdr.cc
index bb7aa75359f..3b213dda85d 100644
--- a/compiler-rt/test/tsan/Darwin/symbolizer-dladdr.cc
+++ b/compiler-rt/test/tsan/Darwin/symbolizer-dladdr.cc
@@ -12,9 +12,7 @@ void *Thread(void *a) {
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;
diff --git a/compiler-rt/test/tsan/deadlock_detector_stress_test.cc b/compiler-rt/test/tsan/deadlock_detector_stress_test.cc
index 41ad5818bdf..bbaaabbb3c1 100644
--- a/compiler-rt/test/tsan/deadlock_detector_stress_test.cc
+++ b/compiler-rt/test/tsan/deadlock_detector_stress_test.cc
@@ -152,7 +152,7 @@ class LockTest {
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 @@ class LockTest {
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);
diff --git a/compiler-rt/test/tsan/global_race.cc b/compiler-rt/test/tsan/global_race.cc
index d1f0e385963..a35299619e9 100644
--- a/compiler-rt/test/tsan/global_race.cc
+++ b/compiler-rt/test/tsan/global_race.cc
@@ -11,9 +11,7 @@ void *Thread(void *a) {
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;
diff --git a/compiler-rt/test/tsan/global_race2.cc b/compiler-rt/test/tsan/global_race2.cc
index 5c29a78c789..95dff199780 100644
--- a/compiler-rt/test/tsan/global_race2.cc
+++ b/compiler-rt/test/tsan/global_race2.cc
@@ -11,9 +11,7 @@ void *Thread(void *a) {
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;
diff --git a/compiler-rt/test/tsan/global_race3.cc b/compiler-rt/test/tsan/global_race3.cc
index 6361c4339a9..e0d59d28442 100644
--- a/compiler-rt/test/tsan/global_race3.cc
+++ b/compiler-rt/test/tsan/global_race3.cc
@@ -16,9 +16,7 @@ void *Thread(void *a) {
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;
diff --git a/compiler-rt/test/tsan/memcmp_race.cc b/compiler-rt/test/tsan/memcmp_race.cc
index 03287ff1906..b76f427e121 100644
--- a/compiler-rt/test/tsan/memcmp_race.cc
+++ b/compiler-rt/test/tsan/memcmp_race.cc
@@ -23,7 +23,7 @@ void *Thread2(void *x) {
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);
diff --git a/compiler-rt/test/tsan/memcpy_race.cc b/compiler-rt/test/tsan/memcpy_race.cc
index 797fbc0fdff..4a098c0405f 100644
--- a/compiler-rt/test/tsan/memcpy_race.cc
+++ b/compiler-rt/test/tsan/memcpy_race.cc
@@ -22,7 +22,7 @@ void *Thread2(void *x) {
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);
diff --git a/compiler-rt/test/tsan/mop_with_offset.cc b/compiler-rt/test/tsan/mop_with_offset.cc
index c67e81e09cd..e2496d099ef 100644
--- a/compiler-rt/test/tsan/mop_with_offset.cc
+++ b/compiler-rt/test/tsan/mop_with_offset.cc
@@ -18,8 +18,8 @@ void *Thread2(void *x) {
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);
diff --git a/compiler-rt/test/tsan/mop_with_offset2.cc b/compiler-rt/test/tsan/mop_with_offset2.cc
index 460267359ce..73c53f51233 100644
--- a/compiler-rt/test/tsan/mop_with_offset2.cc
+++ b/compiler-rt/test/tsan/mop_with_offset2.cc
@@ -18,8 +18,8 @@ void *Thread2(void *x) {
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);
diff --git a/compiler-rt/test/tsan/race_on_heap.cc b/compiler-rt/test/tsan/race_on_heap.cc
index a66e0c4f93f..6c2defc835a 100644
--- a/compiler-rt/test/tsan/race_on_heap.cc
+++ b/compiler-rt/test/tsan/race_on_heap.cc
@@ -2,6 +2,7 @@
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
+#include "test.h"
void *Thread1(void *p) {
*(int*)p = 42;
@@ -26,7 +27,7 @@ int main() {
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);
diff --git a/compiler-rt/test/tsan/test.h b/compiler-rt/test/tsan/test.h
index aa4d81b10ef..e7ffefdcf21 100644
--- a/compiler-rt/test/tsan/test.h
+++ b/compiler-rt/test/tsan/test.h
@@ -5,6 +5,7 @@
#include <dlfcn.h>
#include <stddef.h>
#include <sched.h>
+#include <stdarg.h>
#ifdef __APPLE__
#include <mach/mach_time.h>
@@ -39,30 +40,21 @@ void barrier_wait(invisible_barrier_t *barrier) {
// 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__
OpenPOWER on IntegriCloud