[PATCH] D28201: Provide default implementations for sanitizer interface functions

Francis Ricci via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 31 09:12:36 PST 2016


fjricci created this revision.
fjricci added reviewers: eugenis, samsonov, timurrrr.
fjricci added a subscriber: llvm-commits.

Adds a few default implementations for weak
interface functions on platforms where weak hooks are not supported.


https://reviews.llvm.org/D28201

Files:
  lib/lsan/lsan_allocator.cc
  lib/lsan/lsan_common.cc


Index: lib/lsan/lsan_common.cc
===================================================================
--- lib/lsan/lsan_common.cc
+++ lib/lsan/lsan_common.cc
@@ -758,5 +758,10 @@
 int __lsan_is_turned_off() {
   return 0;
 }
+
+SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
+const char *__lsan_default_suppressions() {
+  return "";
+}
 #endif
 } // extern "C"
Index: lib/lsan/lsan_allocator.cc
===================================================================
--- lib/lsan/lsan_allocator.cc
+++ lib/lsan/lsan_allocator.cc
@@ -258,4 +258,17 @@
 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"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28201.82772.patch
Type: text/x-patch
Size: 1022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161231/b0f57d8f/attachment.bin>


More information about the llvm-commits mailing list