summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancis Ricci <francisjricci@gmail.com>2017-01-07 00:31:20 +0000
committerFrancis Ricci <francisjricci@gmail.com>2017-01-07 00:31:20 +0000
commit4ef2dc3fe6295e56f6e24772065b82c5b39b48ad (patch)
tree16bf179d5e0904b38d786ab396e62f268e60a321
parentdf51fce5c0ce1c5ec843300349b174e527794122 (diff)
downloadcompiler-rt-4ef2dc3fe6295e56f6e24772065b82c5b39b48ad.tar.gz
Provide default implementations for sanitizer interface functions
Summary: Adds a few default implementations for weak interface functions on platforms where weak hooks are not supported. Reviewers: eugenis, samsonov, timurrrr Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28201 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291313 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/lsan/lsan_allocator.cc13
-rw-r--r--lib/lsan/lsan_common.cc5
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/lsan/lsan_allocator.cc b/lib/lsan/lsan_allocator.cc
index 1f6efc0f8..c805a39e1 100644
--- a/lib/lsan/lsan_allocator.cc
+++ b/lib/lsan/lsan_allocator.cc
@@ -258,4 +258,17 @@ SANITIZER_INTERFACE_ATTRIBUTE
uptr __sanitizer_get_allocated_size(const void *p) {
return GetMallocUsableSize(p);
}
+
+#if !SANITIZER_SUPPORTS_WEAK_HOOKS
+// Provide default (no-op) implementation of malloc hooks.
+SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
+void __sanitizer_malloc_hook(void *ptr, uptr size) {
+ (void)ptr;
+ (void)size;
+}
+SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
+void __sanitizer_free_hook(void *ptr) {
+ (void)ptr;
+}
+#endif
} // extern "C"
diff --git a/lib/lsan/lsan_common.cc b/lib/lsan/lsan_common.cc
index b20941ef2..f0554526b 100644
--- a/lib/lsan/lsan_common.cc
+++ b/lib/lsan/lsan_common.cc
@@ -758,5 +758,10 @@ SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
int __lsan_is_turned_off() {
return 0;
}
+
+SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
+const char *__lsan_default_suppressions() {
+ return "";
+}
#endif
} // extern "C"