[compiler-rt] r212815 - [ASan/Win] Don't apply dllexport to __asan_init in the DLL thunk

Timur Iskhodzhanov timurrrr at google.com
Fri Jul 11 06:46:05 PDT 2014


Author: timurrrr
Date: Fri Jul 11 08:46:05 2014
New Revision: 212815

URL: http://llvm.org/viewvc/llvm-project?rev=212815&view=rev
Log:
[ASan/Win] Don't apply dllexport to __asan_init in the DLL thunk

This fixes '___asan_init_v4 already defined' errors when linking some of Chromium DLLs.
Looks like one of the DLL is using a .lib produced while linking another DLL and it exploded after r212699.
I'm trying to come up with a small testcase...

Modified:
    compiler-rt/trunk/lib/asan/CMakeLists.txt
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h

Modified: compiler-rt/trunk/lib/asan/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/CMakeLists.txt?rev=212815&r1=212814&r2=212815&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/asan/CMakeLists.txt Fri Jul 11 08:46:05 2014
@@ -179,7 +179,7 @@ else()
       add_compiler_rt_runtime(clang_rt.asan_dll_thunk-${arch} ${arch} STATIC
         SOURCES asan_dll_thunk.cc
                 $<TARGET_OBJECTS:RTInterception.${arch}>
-        CFLAGS ${ASAN_CFLAGS} -DASAN_DLL_THUNK
+        CFLAGS ${ASAN_CFLAGS} -DASAN_DLL_THUNK -DSANITIZER_DLL_THUNK
         DEFS ${ASAN_COMMON_DEFINITIONS})
       add_dependencies(asan clang_rt.asan_dll_thunk-${arch})
     endif()

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h?rev=212815&r1=212814&r2=212815&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h Fri Jul 11 08:46:05 2014
@@ -17,7 +17,11 @@
 
 // Only use SANITIZER_*ATTRIBUTE* before the function return type!
 #if SANITIZER_WINDOWS
-# define SANITIZER_INTERFACE_ATTRIBUTE __declspec(dllexport)
+# if defined(SANITIZER_DLL_THUNK)
+#  define SANITIZER_INTERFACE_ATTRIBUTE
+# else
+#  define SANITIZER_INTERFACE_ATTRIBUTE __declspec(dllexport)
+# endif
 // FIXME find out what we need on Windows, if anything.
 # define SANITIZER_WEAK_ATTRIBUTE
 #elif defined(SANITIZER_GO)





More information about the llvm-commits mailing list