From 6ef4606343358c8f0365f7741b5033c42fbabb0e Mon Sep 17 00:00:00 2001 From: Marcos Pividori Date: Sun, 29 Jan 2017 05:44:59 +0000 Subject: General definition for weak functions In this diff, I define a general macro for defining weak functions with a default implementation: "SANITIZER_INTERFACE_WEAK_DEF()". This way, we simplify the implementation for different platforms. For example, we cannot define weak functions on Windows, but we can use linker pragmas to create an alias to a default implementation. All of these implementation details are hidden in the new macro. Also, as I modify the name for exported weak symbols on Windows, I needed to temporarily disable "dll_host" test for asan, which checks the list of functions included in asan_win_dll_thunk. Differential Revision: https://reviews.llvm.org/D28596 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293419 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/sanitizer_common/sanitizer_common.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/sanitizer_common/sanitizer_common.cc') diff --git a/lib/sanitizer_common/sanitizer_common.cc b/lib/sanitizer_common/sanitizer_common.cc index 9824a5198..63a73594e 100644 --- a/lib/sanitizer_common/sanitizer_common.cc +++ b/lib/sanitizer_common/sanitizer_common.cc @@ -505,9 +505,9 @@ int __sanitizer_install_malloc_and_free_hooks(void (*malloc_hook)(const void *, return InstallMallocFreeHooks(malloc_hook, free_hook); } -#if !SANITIZER_GO && !SANITIZER_SUPPORTS_WEAK_HOOKS -SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE -void __sanitizer_print_memory_profile(int top_percent) { +#if !SANITIZER_GO +SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_print_memory_profile, + int top_percent) { (void)top_percent; } #endif -- cgit v1.2.3