[PATCH] D28203: Enable weak hooks on darwin

Francis Ricci via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 2 08:18:19 PST 2017


fjricci updated this revision to Diff 82805.
fjricci added a comment.

Enable on darwin


https://reviews.llvm.org/D28203

Files:
  cmake/config-ix.cmake
  lib/sanitizer_common/sanitizer_internal_defs.h


Index: lib/sanitizer_common/sanitizer_internal_defs.h
===================================================================
--- lib/sanitizer_common/sanitizer_internal_defs.h
+++ lib/sanitizer_common/sanitizer_internal_defs.h
@@ -32,7 +32,7 @@
 # define SANITIZER_WEAK_ATTRIBUTE  __attribute__((weak))
 #endif
 
-#if (SANITIZER_LINUX || SANITIZER_WINDOWS) && !SANITIZER_GO
+#if (SANITIZER_LINUX || SANITIZER_MAC || SANITIZER_WINDOWS) && !SANITIZER_GO
 # define SANITIZER_SUPPORTS_WEAK_HOOKS 1
 #else
 # define SANITIZER_SUPPORTS_WEAK_HOOKS 0
Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -245,6 +245,24 @@
     -stdlib=libc++
     -lc++
     -lc++abi)
+
+  set(DARWIN_WEAK_SYMBOLS
+      ___asan_default_options
+      ___asan_default_suppressions
+      ___asan_on_error
+      ___lsan_default_suppressions
+      ___lsan_is_turned_off
+      ___sanitizer_free_hook
+      ___sanitizer_malloc_hook
+      ___sanitizer_symbolize_code
+      ___sanitizer_symbolize_data
+      ___sanitizer_symbolize_demangle
+      ___sanitizer_symbolize_flush
+      ___ubsan_default_options)
+
+  foreach(SYMBOL ${DARWIN_WEAK_SYMBOLS})
+    set(DARWIN_COMMON_LINKFLAGS ${DARWIN_COMMON_LINKFLAGS} -Wl,-U,${SYMBOL})
+  endforeach()
   
   check_linker_flag("-fapplication-extension" COMPILER_RT_HAS_APP_EXTENSION)
   if(COMPILER_RT_HAS_APP_EXTENSION)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28203.82805.patch
Type: text/x-patch
Size: 1438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170102/3e2b1d13/attachment.bin>


More information about the llvm-commits mailing list