diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2015-11-30 19:43:03 +0000 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2015-11-30 19:43:03 +0000 |
commit | 0c487bca5d972e4d58765f453d2f3c255d63164f (patch) | |
tree | a543942c3cab185cae1337d1f386c2a9a3737919 /test/tsan/test.h | |
parent | 8804cdf9e3e5ff844878245d8eda56116de37e3a (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@254319 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/tsan/test.h')
-rw-r--r-- | test/tsan/test.h | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/test/tsan/test.h b/test/tsan/test.h index aa4d81b10..e7ffefdcf 100644 --- a/test/tsan/test.h +++ b/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__ |