[PATCH] D36189: [asan] Interceptors for Fuchsia
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 2 01:00:16 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL309798: [asan] Interceptors for Fuchsia (authored by vitalybuka).
Changed prior to commit:
https://reviews.llvm.org/D36189?vs=109216&id=109290#toc
Repository:
rL LLVM
https://reviews.llvm.org/D36189
Files:
compiler-rt/trunk/lib/asan/asan_interceptors.cc
compiler-rt/trunk/lib/asan/asan_interceptors.h
compiler-rt/trunk/lib/asan/asan_interceptors_memintrinsics.cc
Index: compiler-rt/trunk/lib/asan/asan_interceptors.h
===================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.h
+++ compiler-rt/trunk/lib/asan/asan_interceptors.h
@@ -19,6 +19,26 @@
#include "interception/interception.h"
#include "sanitizer_common/sanitizer_platform_interceptors.h"
+namespace __asan {
+
+void InitializeAsanInterceptors();
+void InitializePlatformInterceptors();
+
+#define ENSURE_ASAN_INITED() \
+ do { \
+ CHECK(!asan_init_is_running); \
+ if (UNLIKELY(!asan_inited)) { \
+ AsanInitFromRtl(); \
+ } \
+ } while (0)
+
+} // namespace __asan
+
+// There is no general interception at all on Fuchsia.
+// Only the functions in asan_interceptors_memintrinsics.h are
+// really defined to replace libc functions.
+#if !SANITIZER_FUCHSIA
+
// Use macro to describe if specific function should be
// intercepted on a given platform.
#if !SANITIZER_WINDOWS
@@ -112,18 +132,6 @@
#define ASAN_INTERCEPT_FUNC(name)
#endif // SANITIZER_MAC
-namespace __asan {
-
-void InitializeAsanInterceptors();
-void InitializePlatformInterceptors();
-
-#define ENSURE_ASAN_INITED() do { \
- CHECK(!asan_init_is_running); \
- if (UNLIKELY(!asan_inited)) { \
- AsanInitFromRtl(); \
- } \
-} while (0)
-
-} // namespace __asan
+#endif // !SANITIZER_FUCHSIA
#endif // ASAN_INTERCEPTORS_H
Index: compiler-rt/trunk/lib/asan/asan_interceptors.cc
===================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors.cc
+++ compiler-rt/trunk/lib/asan/asan_interceptors.cc
@@ -24,6 +24,11 @@
#include "lsan/lsan_common.h"
#include "sanitizer_common/sanitizer_libc.h"
+// There is no general interception at all on Fuchsia.
+// Only the functions in asan_interceptors_memintrinsics.cc are
+// really defined to replace libc functions.
+#if !SANITIZER_FUCHSIA
+
#if SANITIZER_POSIX
#include "sanitizer_common/sanitizer_posix.h"
#endif
@@ -654,3 +659,5 @@
}
} // namespace __asan
+
+#endif // !SANITIZER_FUCHSIA
Index: compiler-rt/trunk/lib/asan/asan_interceptors_memintrinsics.cc
===================================================================
--- compiler-rt/trunk/lib/asan/asan_interceptors_memintrinsics.cc
+++ compiler-rt/trunk/lib/asan/asan_interceptors_memintrinsics.cc
@@ -30,3 +30,15 @@
void *__asan_memmove(void *to, const void *from, uptr size) {
ASAN_MEMMOVE_IMPL(nullptr, to, from, size);
}
+
+#if SANITIZER_FUCHSIA
+
+// Fuchsia doesn't use sanitizer_common_interceptors.inc, but the only
+// things there it wants are these three. Just define them as aliases
+// here rather than repeating the contents.
+
+decltype(memcpy) memcpy[[gnu::alias("__asan_memcpy")]];
+decltype(memmove) memmove[[gnu::alias("__asan_memmove")]];
+decltype(memset) memset[[gnu::alias("__asan_memset")]];
+
+#endif // SANITIZER_FUCHSIA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36189.109290.patch
Type: text/x-patch
Size: 2951 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170802/45fc7c41/attachment.bin>
More information about the llvm-commits
mailing list