<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 11, 2014 at 12:05 PM, Timur Iskhodzhanov <span dir="ltr"><<a href="mailto:timurrrr@google.com" target="_blank">timurrrr@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">On Windows, we currently have two RTLs -- the "full" one, linked to the app; and a mini dll_thunk one, delegating ASan interface calls to the main one.<br>
</p></blockquote><div><br></div><div>Yes, I understand your goal, I have concerns about the way you reach it (SANITIZER_DLL_THUNK, see comment about compile definitons in public sanitizer_common headers).</div><div>If you need _some_ stuff from sanitizer_common headers for building your special asan_dll_thunk.cc, it would probably be better to add<br>
</div><div><br></div><div>// Interceptors in dll thunk don't need interface attribute because ....</div><div>#undef SANITIZER_INTERFACE_ATTRIBUTE</div><div>#define SANITIZER_INTERFACE_ATTRIBUTE</div><div><br></div><div>
to the .cc file</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">
The dllexport attribute should only be applied to interface functions exported by the full/main one.</p></blockquote><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="gmail_quote">11 июля 2014 г. 22:28 пользователь "Alexey Samsonov" <<a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a>> написал:<div><div class="h5"><br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 11, 2014 at 6:46 AM, Timur Iskhodzhanov <span dir="ltr"><<a href="mailto:timurrrr@google.com" target="_blank">timurrrr@google.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: timurrrr<br>
Date: Fri Jul 11 08:46:05 2014<br>
New Revision: 212815<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=212815&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=212815&view=rev</a><br>
Log:<br>
[ASan/Win] Don't apply dllexport to __asan_init in the DLL thunk<br>
<br>
This fixes '___asan_init_v4 already defined' errors when linking some of Chromium DLLs.<br>
Looks like one of the DLL is using a .lib produced while linking another DLL and it exploded after r212699.<br>
I'm trying to come up with a small testcase...<br>
<br>
Modified:<br>
    compiler-rt/trunk/lib/asan/CMakeLists.txt<br>
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h<br>
<br>
Modified: compiler-rt/trunk/lib/asan/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/CMakeLists.txt?rev=212815&r1=212814&r2=212815&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/CMakeLists.txt?rev=212815&r1=212814&r2=212815&view=diff</a><br>



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



==============================================================================<br>
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h (original)<br>
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h Fri Jul 11 08:46:05 2014<br>
@@ -17,7 +17,11 @@<br>
<br>
 // Only use SANITIZER_*ATTRIBUTE* before the function return type!<br>
 #if SANITIZER_WINDOWS<br>
-# define SANITIZER_INTERFACE_ATTRIBUTE __declspec(dllexport)<br>
+# if defined(SANITIZER_DLL_THUNK)<br>
+#  define SANITIZER_INTERFACE_ATTRIBUTE<br>
+# else<br>
+#  define SANITIZER_INTERFACE_ATTRIBUTE __declspec(dllexport)<br>
+# endif<br></blockquote><div><br></div><div>I find this very confusing. sanitizer_common is not a header-only library, it's compiled once, and then the same object</div><div>files are put inside all sanitizer runtimes (ASan, TSan, MSan). But ASan runtime #includes headers from sanitizer_common.</div>


<div>If you build some parts of ASan runtime with "-DSANITIZER_FOO=1" and build sanitizer_common itself with "-DSANITIZER_FOO=0"</div><div>you may get all sorts of weird bugs. So I kind of advocate against "SANITIZER_FOO" macro which are exposed in sanitizer_common headers.</div>


<div><br></div><div>Is it possible to find other solution? What <span style="font-family:arial,sans-serif;font-size:13px">SANITIZER_INTERFACE_ATTRIBUTE are you trying to get rid of?</span></div><div><br></div><div> </div>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
 // FIXME find out what we need on Windows, if anything.<br>
 # define SANITIZER_WEAK_ATTRIBUTE<br>
 #elif defined(SANITIZER_GO)<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div>
</div></div>
</blockquote></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div>
</div></div>