From b680e8493d935c5694ddf106916d66810767030e Mon Sep 17 00:00:00 2001 From: Timur Iskhodzhanov Date: Fri, 11 Jul 2014 13:46:05 +0000 Subject: [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... git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@212815 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/asan/CMakeLists.txt | 2 +- lib/sanitizer_common/sanitizer_internal_defs.h | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/asan/CMakeLists.txt b/lib/asan/CMakeLists.txt index b23a7a2e5..69c0cd8c2 100644 --- a/lib/asan/CMakeLists.txt +++ b/lib/asan/CMakeLists.txt @@ -179,7 +179,7 @@ else() add_compiler_rt_runtime(clang_rt.asan_dll_thunk-${arch} ${arch} STATIC SOURCES asan_dll_thunk.cc $ - 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() diff --git a/lib/sanitizer_common/sanitizer_internal_defs.h b/lib/sanitizer_common/sanitizer_internal_defs.h index c8985b49e..8832da069 100644 --- a/lib/sanitizer_common/sanitizer_internal_defs.h +++ b/lib/sanitizer_common/sanitizer_internal_defs.h @@ -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) -- cgit v1.2.1