Bug 1080946 - Don't mark ASAN poisoning functions as dllexport on Windows; r=njn
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 10 Oct 2014 10:33:16 -0400
changeset 209965 c32fd9b9c35576ad66b8365e9adb39cbe478ca78
parent 209964 fcf6d37ae66cf5e3dfecc5d57d935763a19af25d
child 209966 d27ce1e75719e417328b570bec2c6dbcbd5e1de7
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersnjn
bugs1080946
milestone35.0a1
Bug 1080946 - Don't mark ASAN poisoning functions as dllexport on Windows; r=njn
mfbt/MemoryChecking.h
--- a/mfbt/MemoryChecking.h
+++ b/mfbt/MemoryChecking.h
@@ -31,23 +31,31 @@
 #define MOZ_HAVE_MEM_CHECKS 1
 #endif
 
 #if defined(MOZ_ASAN)
 #include <stddef.h>
 
 #include "mozilla/Types.h"
 
+#ifdef _MSC_VER
+// In clang-cl based ASAN, we link against the memory poisoning functions
+// statically.
+#define MOZ_ASAN_VISIBILITY
+#else
+#define MOZ_ASAN_VISIBILITY MOZ_EXPORT
+#endif
+
 extern "C" {
 /* These definitions are usually provided through the
  * sanitizer/asan_interface.h header installed by ASan.
  */
-void MOZ_EXPORT
+void MOZ_ASAN_VISIBILITY
 __asan_poison_memory_region(void const volatile *addr, size_t size);
-void MOZ_EXPORT
+void MOZ_ASAN_VISIBILITY
 __asan_unpoison_memory_region(void const volatile *addr, size_t size);
 
 #define MOZ_MAKE_MEM_NOACCESS(addr, size) \
   __asan_poison_memory_region((addr), (size))
 
 #define MOZ_MAKE_MEM_UNDEFINED(addr, size) \
   __asan_unpoison_memory_region((addr), (size))