<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - [ASan/Win] lld-link doesn't link ASAN binaries"
href="https://bugs.llvm.org/show_bug.cgi?id=35343">35343</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[ASan/Win] lld-link doesn't link ASAN binaries
</td>
</tr>
<tr>
<th>Product</th>
<td>compiler-rt
</td>
</tr>
<tr>
<th>Version</th>
<td>5.0
</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>compiler-rt
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>steinar+llvm@gunderson.no
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Hi,
I'm trying to run MySQL with ASAN on Windows (we're already clean on Linux).
However, seemingly linking with LLD isn't automatic:
R:\ade\sesse\mysql\obj\mysql-test>"c:\Program Files\LLVM\msbuild-bin\cl.exe"
/nologo /c hello.cpp -fsanitize=address
R:\ade\sesse\mysql\obj\mysql-test>"c:\Program Files\LLVM\bin\lld-link.exe"
/out:hello.exe hello.obj
c:\Program Files\LLVM\bin\lld-link.exe: warning: hello.obj: undefined symbol:
__asan_shadow_memory_dynamic_address
c:\Program Files\LLVM\bin\lld-link.exe: warning: hello.obj: undefined symbol:
__asan_option_detect_stack_use_after_return
c:\Program Files\LLVM\bin\lld-link.exe: warning: hello.obj: undefined symbol:
__asan_stack_malloc_0
c:\Program Files\LLVM\bin\lld-link.exe: warning: hello.obj: undefined symbol:
__asan_report_load8
c:\Program Files\LLVM\bin\lld-link.exe: warning: hello.obj: undefined symbol:
__asan_init
c:\Program Files\LLVM\bin\lld-link.exe: warning: hello.obj: undefined symbol:
__asan_version_mismatch_check_v8
error: link failed
I can link in clang_rt.asan-x86_64.lib manually by giving the path, and then
simple tests work, but anything that tries to do LoadLibrary dies, so I suppose
this is the wrong approach:
==18756==AddressSanitizer CHECK failed:
C:\src\llvm_package_500\llvm\projects\compiler-rt\lib\asan\asan_win.cc:179
"((::
__interception::OverrideFunction("RtlRaiseException",
(uptr)__asan_wrap_RtlRaiseException, (uptr *)&__interception::real
_RtlRaiseException))) != (0)" (0x0, 0x0)
#0 0x7ffe458b8fcf in _asan_init+0x16f
(R:\ade\sesse\mysql\obj\plugin_output_directory\keyring_udf.dll+0x180cb8fcf)
#1 0x7ffe458c326b in __sanitizer::CheckFailed+0x5b
(R:\ade\sesse\mysql\obj\plugin_output_directory\keyring_udf.dll+0
x180cc326b)
#2 0x7ffe458cdbe8 in _asan_wrap_CreateThread+0x248
(R:\ade\sesse\mysql\obj\plugin_output_directory\keyring_udf.dll+0
x180ccdbe8)
#3 0x7ffe458c00e7 in _asan_wrap_atol+0x9c7
(R:\ade\sesse\mysql\obj\plugin_output_directory\keyring_udf.dll+0x180cc00
e7)
#4 0x7ffe458b8451 in _asan_storeN_noabort+0x181
(R:\ade\sesse\mysql\obj\plugin_output_directory\keyring_udf.dll+0x18
0cb8451)
#5 0x7ffe65f8a37e in RtlDeactivateActivationContextUnsafeFast+0x1be
(C:\Windows\SYSTEM32\ntdll.dll+0x18002a37e)
#6 0x7ffe65f678c4 in RtlGetThreadErrorMode+0x434
(C:\Windows\SYSTEM32\ntdll.dll+0x1800078c4)
#7 0x7ffe65f676e7 in RtlGetThreadErrorMode+0x257
(C:\Windows\SYSTEM32\ntdll.dll+0x1800076e7)
#8 0x7ffe65f67566 in RtlGetThreadErrorMode+0xd6
(C:\Windows\SYSTEM32\ntdll.dll+0x180007566)
#9 0x7ffe65f6d33c in RtlDeleteBoundaryDescriptor+0x1cc
(C:\Windows\SYSTEM32\ntdll.dll+0x18000d33c)
#10 0x7ffe65f870b8 in RtlFormatCurrentUserKeyPath+0x7b8
(C:\Windows\SYSTEM32\ntdll.dll+0x1800270b8)
#11 0x7ffe65f86afc in RtlFormatCurrentUserKeyPath+0x1fc
(C:\Windows\SYSTEM32\ntdll.dll+0x180026afc)
#12 0x7ffe65f69efb in LdrLoadDll+0x8b
(C:\Windows\SYSTEM32\ntdll.dll+0x180009efb)
#13 0x7ffe6329484e in LoadLibraryExW+0x16e
(C:\Windows\System32\KERNELBASE.dll+0x18002484e)
#14 0x7ffe632d1c80 in LoadLibraryExA+0x30
(C:\Windows\System32\KERNELBASE.dll+0x180061c80)
#15 0x7ff7d37dd638
(R:\ade\sesse\mysql\obj\runtime_output_directory\mysqld.exe+0x14321d638)
#16 0x7ff7d34d7698
(R:\ade\sesse\mysql\obj\runtime_output_directory\mysqld.exe+0x142f17698)
#17 0x7ff7d34d0b6c
(R:\ade\sesse\mysql\obj\runtime_output_directory\mysqld.exe+0x142f10b6c)
#18 0x7ff7d34c9056
(R:\ade\sesse\mysql\obj\runtime_output_directory\mysqld.exe+0x142f09056)
#19 0x7ff7d34ce0cf
(R:\ade\sesse\mysql\obj\runtime_output_directory\mysqld.exe+0x142f0e0cf)
#20 0x7ff7d32d2093
(R:\ade\sesse\mysql\obj\runtime_output_directory\mysqld.exe+0x142d12093)
#21 0x7ff7d30a3c6c
(R:\ade\sesse\mysql\obj\runtime_output_directory\mysqld.exe+0x142ae3c6c)
#22 0x7ff7d35ff7ab
(R:\ade\sesse\mysql\obj\runtime_output_directory\mysqld.exe+0x14303f7ab)
#23 0x7ff7d7804e03
(R:\ade\sesse\mysql\obj\runtime_output_directory\mysqld.exe+0x147244e03)
#24 0x7ff7d307ee56
(R:\ade\sesse\mysql\obj\runtime_output_directory\mysqld.exe+0x142abee56)
#25 0x7ffe636f8363 in BaseThreadInitThunk+0x13
(C:\Windows\System32\KERNEL32.DLL+0x180008363)
#26 0x7ffe65fc7090 in RtlUserThreadStart+0x20
(C:\Windows\SYSTEM32\ntdll.dll+0x180067090)
Shouldn't this go automatically? I can't find a way to link with cl.exe; on
Linux, I guess the clang driver with -fsanitize=address does magic behind the
scenes, but giving -fsanitize=address to lld-link seemingly isn't allowed.</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>