[PATCH] [compiler-rt] Fix ASan's Noinst unit tests
Kuba Brecka
kuba.brecka at gmail.com
Tue Feb 10 08:04:12 PST 2015
Updating the patch to use an internal function that disable re-execution.
http://reviews.llvm.org/D7493
Files:
lib/asan/asan_internal.h
lib/asan/asan_linux.cc
lib/asan/asan_mac.cc
lib/asan/asan_win.cc
lib/asan/tests/asan_noinst_test.cc
Index: lib/asan/asan_internal.h
===================================================================
--- lib/asan/asan_internal.h
+++ lib/asan/asan_internal.h
@@ -93,6 +93,7 @@
void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp);
void AsanOnSIGSEGV(int, void *siginfo, void *context);
+void DisableReexec();
void MaybeReexec();
void ReadContextStack(void *context, uptr *stack, uptr *ssize);
void AsanPlatformThreadInit();
Index: lib/asan/asan_linux.cc
===================================================================
--- lib/asan/asan_linux.cc
+++ lib/asan/asan_linux.cc
@@ -68,6 +68,10 @@
namespace __asan {
+void DisableReexec() {
+ // No need to re-exec on Linux.
+}
+
void MaybeReexec() {
// No need to re-exec on Linux.
}
Index: lib/asan/asan_mac.cc
===================================================================
--- lib/asan/asan_mac.cc
+++ lib/asan/asan_mac.cc
@@ -101,7 +101,15 @@
}
}
+static bool reexec_disabled = false;
+
+void DisableReexec() {
+ reexec_disabled = true;
+}
+
void MaybeReexec() {
+ if (reexec_disabled) return;
+
// Make sure the dynamic ASan runtime library is preloaded so that the
// wrappers work. If it is not, set DYLD_INSERT_LIBRARIES and re-exec
// ourselves.
Index: lib/asan/asan_win.cc
===================================================================
--- lib/asan/asan_win.cc
+++ lib/asan/asan_win.cc
@@ -60,6 +60,10 @@
AsanThread::TSDDtor(tsd);
}
// ---------------------- Various stuff ---------------- {{{1
+void DisableReexec() {
+ // No need to re-exec on Windows.
+}
+
void MaybeReexec() {
// No need to re-exec on Windows.
}
Index: lib/asan/tests/asan_noinst_test.cc
===================================================================
--- lib/asan/tests/asan_noinst_test.cc
+++ lib/asan/tests/asan_noinst_test.cc
@@ -33,7 +33,10 @@
// Make sure __asan_init is called before any test case is run.
struct AsanInitCaller {
- AsanInitCaller() { __asan_init(); }
+ AsanInitCaller() {
+ __asan::DisableReexec();
+ __asan_init();
+ }
};
static AsanInitCaller asan_init_caller;
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7493.19682.patch
Type: text/x-patch
Size: 2099 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150210/fe2c5e3a/attachment.bin>
More information about the llvm-commits
mailing list