summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/asan_internal.h
diff options
context:
space:
mode:
authorDan Liew <dan@su-root.co.uk>2018-12-01 15:45:42 +0000
committerDan Liew <dan@su-root.co.uk>2018-12-01 15:45:42 +0000
commit8bffb634970ce0ffc1f979d8399f1d415f60a688 (patch)
tree21f679659008fce03b030efc7222a23f8d137a90 /compiler-rt/lib/asan/asan_internal.h
parent102854f4d403f22af10bd521a381adbd49f350a5 (diff)
downloadbcm5719-llvm-8bffb634970ce0ffc1f979d8399f1d415f60a688.tar.gz
bcm5719-llvm-8bffb634970ce0ffc1f979d8399f1d415f60a688.zip
Introduce a way to allow the ASan dylib on Darwin platforms to be loaded via `dlopen()`.
Summary: The purpose of this option is provide a way for the ASan dylib to be loaded via `dlopen()` without triggering most initialization steps (e.g. shadow memory set up) that normally occur when the ASan dylib is loaded. This new functionality is exposed by - A `SANITIZER_SUPPORTS_INIT_FOR_DLOPEN` macro which indicates if the feature is supported. This only true for Darwin currently. - A `HandleDlopenInit()` function which should return true if the library is being loaded via `dlopen()` and `SANITIZER_SUPPORTS_INIT_FOR_DLOPEN` is supported. Platforms that support this may perform any initialization they wish inside this function. Although disabling initialization is something that could potentially apply to other sanitizers it appears to be unnecessary for other sanitizers so this patch only makes the change for ASan. rdar://problem/45284065 Reviewers: kubamracek, george.karpenkov, kcc, eugenis, krytarowski Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D54469 llvm-svn: 348078
Diffstat (limited to 'compiler-rt/lib/asan/asan_internal.h')
-rw-r--r--compiler-rt/lib/asan/asan_internal.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/asan_internal.h b/compiler-rt/lib/asan/asan_internal.h
index 654878cd15f..57869497c7d 100644
--- a/compiler-rt/lib/asan/asan_internal.h
+++ b/compiler-rt/lib/asan/asan_internal.h
@@ -111,6 +111,11 @@ void *AsanDlSymNext(const char *sym);
void ReserveShadowMemoryRange(uptr beg, uptr end, const char *name);
+// Returns `true` iff most of ASan init process should be skipped due to the
+// ASan library being loaded via `dlopen()`. Platforms may perform any
+// `dlopen()` specific initialization inside this function.
+bool HandleDlopenInit();
+
// Add convenient macro for interface functions that may be represented as
// weak hooks.
#define ASAN_MALLOC_HOOK(ptr, size) \
OpenPOWER on IntegriCloud