[PATCH] Introduce SANITIZER_HAS_WEAK_SYMBOL and use it for SymbolizerPrepareForSandboxing.

Peter Collingbourne peter at pcc.me.uk
Tue May 28 06:38:09 PDT 2013


Hi dvyukov,

Fixes the Go build.

http://llvm-reviews.chandlerc.com/D877

Files:
  lib/sanitizer_common/sanitizer_internal_defs.h
  lib/sanitizer_common/sanitizer_linux.cc

Index: lib/sanitizer_common/sanitizer_internal_defs.h
===================================================================
--- lib/sanitizer_common/sanitizer_internal_defs.h
+++ lib/sanitizer_common/sanitizer_internal_defs.h
@@ -29,8 +29,10 @@
 
 #if SANITIZER_LINUX && !defined(SANITIZER_GO)
 # define SANITIZER_SUPPORTS_WEAK_HOOKS 1
+# define SANITIZER_HAS_WEAK_SYMBOL(s)  (&(s))
 #else
 # define SANITIZER_SUPPORTS_WEAK_HOOKS 0
+# define SANITIZER_HAS_WEAK_SYMBOL(s)  1
 #endif
 
 // GCC does not understand __has_feature
Index: lib/sanitizer_common/sanitizer_linux.cc
===================================================================
--- lib/sanitizer_common/sanitizer_linux.cc
+++ lib/sanitizer_common/sanitizer_linux.cc
@@ -307,7 +307,7 @@
   // cached mappings.
   MemoryMappingLayout::CacheMemoryMappings();
   // Same for /proc/self/exe in the symbolizer.
-  if (&SymbolizerPrepareForSandboxing)
+  if (SANITIZER_HAS_WEAK_SYMBOL(SymbolizerPrepareForSandboxing))
     SymbolizerPrepareForSandboxing();
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D877.1.patch
Type: text/x-patch
Size: 1016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130528/470b3d48/attachment.bin>


More information about the llvm-commits mailing list