Skip to content

Commit

Permalink
Provide default implementations for sanitizer interface functions
Browse files Browse the repository at this point in the history
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

llvm-svn: 291313
  • Loading branch information
fjricci committed Jan 7, 2017
1 parent 913e112 commit 9a2a992
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions compiler-rt/lib/lsan/lsan_allocator.cc
Expand Up @@ -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"
5 changes: 5 additions & 0 deletions compiler-rt/lib/lsan/lsan_common.cc
Expand Up @@ -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"

0 comments on commit 9a2a992

Please sign in to comment.