diff --git a/compiler-rt/test/hwasan/TestCases/Linux/decorate-proc-maps.c b/compiler-rt/test/hwasan/TestCases/Linux/decorate-proc-maps.c --- a/compiler-rt/test/hwasan/TestCases/Linux/decorate-proc-maps.c +++ b/compiler-rt/test/hwasan/TestCases/Linux/decorate-proc-maps.c @@ -1,4 +1,4 @@ -// RUN: %clang_hwasan -g %s -o %t +// RUN: %clang_hwasan -mllvm -hwasan-globals=0 -g %s -o %t // RUN: %env_hwasan_opts=decorate_proc_maps=1 %run %t 2>&1 | FileCheck %s --check-prefix=A // RUN: %env_hwasan_opts=decorate_proc_maps=1 %run %t 2>&1 | FileCheck %s --check-prefix=B @@ -16,21 +16,18 @@ #include #include #include +#include #include #include #include -#include -#include - -#include "utils.h" void CopyFdToFd(int in_fd, int out_fd) { const size_t kBufSize = 0x10000; static char buf[kBufSize]; while (1) { - ssize_t got = read(in_fd, UNTAG(buf), kBufSize); + ssize_t got = read(in_fd, buf, kBufSize); if (got > 0) { - write(out_fd, UNTAG(buf), got); + write(out_fd, buf, got); } else if (got == 0) { break; } else if (errno != EAGAIN || errno != EWOULDBLOCK || errno != EINTR) { @@ -42,7 +39,7 @@ void *ThreadFn(void *arg) { (void)arg; - int fd = open(UNTAG("/proc/self/maps"), O_RDONLY); + int fd = open("/proc/self/maps", O_RDONLY); CopyFdToFd(fd, 2); close(fd); return NULL; diff --git a/compiler-rt/test/hwasan/TestCases/Linux/release-shadow.c b/compiler-rt/test/hwasan/TestCases/Linux/release-shadow.c --- a/compiler-rt/test/hwasan/TestCases/Linux/release-shadow.c +++ b/compiler-rt/test/hwasan/TestCases/Linux/release-shadow.c @@ -1,5 +1,5 @@ // Test that tagging a large region to 0 reduces RSS. -// RUN: %clang_hwasan -mllvm -hwasan-instrument-stack=0 %s -o %t && %run %t 2>&1 +// RUN: %clang_hwasan -mllvm -hwasan-globals=0 -mllvm -hwasan-instrument-stack=0 %s -o %t && %run %t 2>&1 #include #include @@ -12,8 +12,6 @@ #include -#include "utils.h" - const unsigned char kTag = 42; const size_t kNumShadowPages = 256; const size_t kNumPages = 16 * kNumShadowPages; @@ -32,7 +30,7 @@ size_t current_rss() { sync_rss(); - int statm_fd = open(UNTAG("/proc/self/statm"), O_RDONLY); + int statm_fd = open("/proc/self/statm", O_RDONLY); assert(statm_fd >= 0); char buf[100]; diff --git a/compiler-rt/test/hwasan/TestCases/Linux/reuse-threads.cpp b/compiler-rt/test/hwasan/TestCases/Linux/reuse-threads.cpp --- a/compiler-rt/test/hwasan/TestCases/Linux/reuse-threads.cpp +++ b/compiler-rt/test/hwasan/TestCases/Linux/reuse-threads.cpp @@ -1,5 +1,5 @@ // Test that Thread objects are reused. -// RUN: %clangxx_hwasan -mllvm -hwasan-instrument-stack=0 %s -o %t && %env_hwasan_opts=verbose_threads=1 %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_hwasan -mllvm -hwasan-globals=0 -mllvm -hwasan-instrument-stack=0 %s -o %t && %env_hwasan_opts=verbose_threads=1 %run %t 2>&1 | FileCheck %s #include #include @@ -10,12 +10,10 @@ #include -#include "utils.h" - pthread_barrier_t bar; void *threadfn(void *) { - pthread_barrier_wait(UNTAG(&bar)); + pthread_barrier_wait(&bar); return nullptr; } @@ -23,15 +21,15 @@ constexpr int N = 2; pthread_t threads[N]; - pthread_barrier_init(UNTAG(&bar), nullptr, N + 1); + pthread_barrier_init(&bar, nullptr, N + 1); for (auto &t : threads) pthread_create(&t, nullptr, threadfn, nullptr); - pthread_barrier_wait(UNTAG(&bar)); + pthread_barrier_wait(&bar); for (auto &t : threads) pthread_join(t, nullptr); - pthread_barrier_destroy(UNTAG(&bar)); + pthread_barrier_destroy(&bar); } int main() { diff --git a/compiler-rt/test/hwasan/TestCases/Linux/utils.h b/compiler-rt/test/hwasan/TestCases/Linux/utils.h deleted file mode 100644 --- a/compiler-rt/test/hwasan/TestCases/Linux/utils.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include - -#if defined(__x86_64__) -#define UNTAG(x) (x) -#else -#define UNTAG(x) (typeof((x) + 0))(((uintptr_t)(x)) & 0xffffffffffffff) -#endif