[compiler-rt] r254319 - [compiler-rt] Remove SANITIZER_AARCH64_VMA usage
Adhemerval Zanella via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 30 11:43:04 PST 2015
Author: azanella
Date: Mon Nov 30 13:43:03 2015
New Revision: 254319
URL: http://llvm.org/viewvc/llvm-project?rev=254319&view=rev
Log:
[compiler-rt] Remove SANITIZER_AARCH64_VMA usage
This patch complete removed SANITIZER_AARCH64_VMA definition and usage.
AArch64 ports now supports runtime VMA detection and instrumentation
for 39 and 42-bit VMA.
It also Rewrite print_address to take a variadic argument list
(the addresses to print) and adjust the tests which uses it to the new
signature.
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc
compiler-rt/trunk/test/tsan/Darwin/symbolizer-atos.cc
compiler-rt/trunk/test/tsan/Darwin/symbolizer-dladdr.cc
compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc
compiler-rt/trunk/test/tsan/global_race.cc
compiler-rt/trunk/test/tsan/global_race2.cc
compiler-rt/trunk/test/tsan/global_race3.cc
compiler-rt/trunk/test/tsan/memcmp_race.cc
compiler-rt/trunk/test/tsan/memcpy_race.cc
compiler-rt/trunk/test/tsan/mop_with_offset.cc
compiler-rt/trunk/test/tsan/mop_with_offset2.cc
compiler-rt/trunk/test/tsan/race_on_heap.cc
compiler-rt/trunk/test/tsan/test.h
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h?rev=254319&r1=254318&r2=254319&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform.h Mon Nov 30 13:43:03 2015
@@ -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
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc?rev=254319&r1=254318&r2=254319&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix.cc Mon Nov 30 13:43:03 2015
@@ -321,22 +321,6 @@ SignalContext SignalContext::Create(void
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
Modified: compiler-rt/trunk/test/tsan/Darwin/symbolizer-atos.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/symbolizer-atos.cc?rev=254319&r1=254318&r2=254319&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/symbolizer-atos.cc (original)
+++ compiler-rt/trunk/test/tsan/Darwin/symbolizer-atos.cc Mon Nov 30 13:43:03 2015
@@ -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;
Modified: compiler-rt/trunk/test/tsan/Darwin/symbolizer-dladdr.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/symbolizer-dladdr.cc?rev=254319&r1=254318&r2=254319&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/symbolizer-dladdr.cc (original)
+++ compiler-rt/trunk/test/tsan/Darwin/symbolizer-dladdr.cc Mon Nov 30 13:43:03 2015
@@ -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;
Modified: compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc?rev=254319&r1=254318&r2=254319&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc (original)
+++ compiler-rt/trunk/test/tsan/deadlock_detector_stress_test.cc Mon Nov 30 13:43:03 2015
@@ -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);
Modified: compiler-rt/trunk/test/tsan/global_race.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/global_race.cc?rev=254319&r1=254318&r2=254319&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/global_race.cc (original)
+++ compiler-rt/trunk/test/tsan/global_race.cc Mon Nov 30 13:43:03 2015
@@ -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;
Modified: compiler-rt/trunk/test/tsan/global_race2.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/global_race2.cc?rev=254319&r1=254318&r2=254319&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/global_race2.cc (original)
+++ compiler-rt/trunk/test/tsan/global_race2.cc Mon Nov 30 13:43:03 2015
@@ -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;
Modified: compiler-rt/trunk/test/tsan/global_race3.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/global_race3.cc?rev=254319&r1=254318&r2=254319&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/global_race3.cc (original)
+++ compiler-rt/trunk/test/tsan/global_race3.cc Mon Nov 30 13:43:03 2015
@@ -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;
Modified: compiler-rt/trunk/test/tsan/memcmp_race.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/memcmp_race.cc?rev=254319&r1=254318&r2=254319&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/memcmp_race.cc (original)
+++ compiler-rt/trunk/test/tsan/memcmp_race.cc Mon Nov 30 13:43:03 2015
@@ -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);
Modified: compiler-rt/trunk/test/tsan/memcpy_race.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/memcpy_race.cc?rev=254319&r1=254318&r2=254319&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/memcpy_race.cc (original)
+++ compiler-rt/trunk/test/tsan/memcpy_race.cc Mon Nov 30 13:43:03 2015
@@ -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);
Modified: compiler-rt/trunk/test/tsan/mop_with_offset.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/mop_with_offset.cc?rev=254319&r1=254318&r2=254319&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/mop_with_offset.cc (original)
+++ compiler-rt/trunk/test/tsan/mop_with_offset.cc Mon Nov 30 13:43:03 2015
@@ -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);
Modified: compiler-rt/trunk/test/tsan/mop_with_offset2.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/mop_with_offset2.cc?rev=254319&r1=254318&r2=254319&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/mop_with_offset2.cc (original)
+++ compiler-rt/trunk/test/tsan/mop_with_offset2.cc Mon Nov 30 13:43:03 2015
@@ -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);
Modified: compiler-rt/trunk/test/tsan/race_on_heap.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/race_on_heap.cc?rev=254319&r1=254318&r2=254319&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/race_on_heap.cc (original)
+++ compiler-rt/trunk/test/tsan/race_on_heap.cc Mon Nov 30 13:43:03 2015
@@ -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);
Modified: compiler-rt/trunk/test/tsan/test.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/test.h?rev=254319&r1=254318&r2=254319&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/test.h (original)
+++ compiler-rt/trunk/test/tsan/test.h Mon Nov 30 13:43:03 2015
@@ -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 *b
// 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__
More information about the llvm-commits
mailing list