summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Lee <waltl@google.com>2018-06-01 19:47:41 +0000
committerWalter Lee <waltl@google.com>2018-06-01 19:47:41 +0000
commitbf03bfb0a33af6b847a19971eedb09582ef3cb84 (patch)
tree2cc09a93e038a4551654623f89e3ceea38838809
parent6d52e5c3e401d5ffad05ad07d51619e37b56a154 (diff)
downloadbcm5719-llvm-bf03bfb0a33af6b847a19971eedb09582ef3cb84.tar.gz
bcm5719-llvm-bf03bfb0a33af6b847a19971eedb09582ef3cb84.zip
[asan, myriad] Configure platform interceptors
Myriad only uses the platform interceptors for memory allocation routines. Configure them properly. Also add a missing guard around aligned alloc interceptor. Differential Revision: https://reviews.llvm.org/D47641 llvm-svn: 333784
-rw-r--r--compiler-rt/lib/asan/asan_malloc_linux.cc2
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h19
2 files changed, 16 insertions, 5 deletions
diff --git a/compiler-rt/lib/asan/asan_malloc_linux.cc b/compiler-rt/lib/asan/asan_malloc_linux.cc
index a7a6367eb8f..d6ac3bd2ac7 100644
--- a/compiler-rt/lib/asan/asan_malloc_linux.cc
+++ b/compiler-rt/lib/asan/asan_malloc_linux.cc
@@ -132,10 +132,12 @@ INTERCEPTOR(void*, __libc_memalign, uptr boundary, uptr size) {
}
#endif // SANITIZER_INTERCEPT_MEMALIGN
+#if SANITIZER_INTERCEPT_ALIGNED_ALLOC
INTERCEPTOR(void*, aligned_alloc, uptr boundary, uptr size) {
GET_STACK_TRACE_MALLOC;
return asan_memalign(boundary, size, &stack, FROM_MALLOC);
}
+#endif // SANITIZER_INTERCEPT_ALIGNED_ALLOC
INTERCEPTOR(uptr, malloc_usable_size, void *ptr) {
GET_CURRENT_PC_BP_SP;
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
index d0b22b5b298..d89a009f597 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -95,6 +95,12 @@
# define SI_NOT_FUCHSIA 1
#endif
+#if SANITIZER_RTEMS
+# define SI_NOT_RTEMS 0
+#else
+# define SI_NOT_RTEMS 1
+#endif
+
#if SANITIZER_SOLARIS
# define SI_SOLARIS 1
#else
@@ -452,14 +458,17 @@
#define SANITIZER_INTERCEPT_MMAP SI_POSIX
#define SANITIZER_INTERCEPT_MMAP64 SI_LINUX_NOT_ANDROID
#define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO \
- (!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA)
+ (!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA && \
+ SI_NOT_RTEMS)
#define SANITIZER_INTERCEPT_MEMALIGN \
- (!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD)
+ (!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_RTEMS)
#define SANITIZER_INTERCEPT_PVALLOC \
- (!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA)
+ (!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA && \
+ SI_NOT_RTEMS)
#define SANITIZER_INTERCEPT_CFREE \
- (!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA)
-#define SANITIZER_INTERCEPT_ALIGNED_ALLOC (!SI_MAC)
+ (!SI_FREEBSD && !SI_MAC && !SI_NETBSD && !SI_OPENBSD && SI_NOT_FUCHSIA && \
+ SI_NOT_RTEMS)
+#define SANITIZER_INTERCEPT_ALIGNED_ALLOC (!SI_MAC && SI_NOT_RTEMS)
#define SANITIZER_INTERCEPT_MALLOC_USABLE_SIZE (!SI_MAC && !SI_OPENBSD)
#define SANITIZER_INTERCEPT_MCHECK_MPROBE SI_LINUX_NOT_ANDROID
#define SANITIZER_INTERCEPT_WCSCAT SI_POSIX
OpenPOWER on IntegriCloud