<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW " title="NEW --- - [win] compiler_rt doesn't link when building with clang-cl.exe" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23698&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=jwA4WrMwyzCeyKxw-ql7DC2IyCf7V8xzrEYmW8-NIQk&s=D7x-EjRau8PksVIimDHHB0_6W2BNsM8iOb6tRNw8ftY&e=">23698</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[win] compiler_rt doesn't link when building with clang-cl.exe
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Headers
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nicolasweber@gmx.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>1. Run cmake with CMAKE_C_COMPILER and CMAKE_CXX_COMPILER set to clang-cl.exe
2. Build target 'compiler-rt'
Expected: Works
Actual:
asan_thread.cc.obj : error LNK2001: unresolved external symbol
__ReadWriteBarrier
sanitizer_coverage_libcdep.cc.obj : error LNK2001: unresolved external symbol
__mm_pause
lib\clang\3.7.0\lib\windows\clang_rt.asan_dynamic-i386.dll : fatal error
LNK1120: 2 unresolved externals
LINK failed. with 1120
This is because sanitizer_atomic_msvc declares _mm_pause itself instead of
including Intrin.h (it can't include Intrin.h else it would get a declaration
of free() without dllexport, and then its own declaration of free with
dllexport would be an error, at least in clang-cl). Hence, the definition of
_mm_pause in clang/lib/Headers/emmintrin.h isn't seen.
(And the #pragma intrinsic stuff doesn't work in clang-cl yet, see <a class="bz_bug_link
bz_status_NEW " title="NEW --- - Support #pragma intrinsic and implement more builtins" href="show_bug.cgi?id=19898">bug 19898</a>)
Since we control both the clang-cl code and the asan header code, maybe we can
figure something out before <a class="bz_bug_link
bz_status_NEW " title="NEW --- - Support #pragma intrinsic and implement more builtins" href="show_bug.cgi?id=19898">bug 19898</a> is fixed? Or we could just wait for that.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>