<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 - Delay load stubs are not marked as CFG targets"
href="https://bugs.llvm.org/show_bug.cgi?id=47617">47617</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Delay load stubs are not marked as CFG targets
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>10.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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dmajor@mozilla.com
</td>
</tr>
<tr>
<th>CC</th>
<td>andrew.paverd@microsoft.com, htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, rnk@google.com, sylvestre@debian.org, tom@ritter.vg
</td>
</tr></table>
<p>
<div>
<pre>test.cpp:
#include <windows.h>
#include <wininet.h>
int main(int, char**)
{
decltype(InternetOpenA)* volatile ptr = &InternetOpenA;
ptr(nullptr, 0, nullptr, nullptr, 0);
return 0;
}
With MSVC, it runs OK:
cl -c -O2 test.cpp -guard:cf -nologo test.cpp && link test.obj -debug
wininet.lib -guard:cf -delayload:wininet.dll delayimp.lib -nologo && test.exe
With LLVM, this reports a CFG failure:
clang-cl -c -O2 test.cpp -guard:cf -nologo && lld-link test.obj -debug
wininet.lib -guard:cf -delayload:wininet.dll delayimp.lib -nologo && test.exe
It happens because the following stub is not marked for CFG:
0:000> u @rax
test!_imp_load_InternetOpenA:
00007ff6`7a6b38a0 488d05f9470800 lea rax,[test!_imp_InternetOpenA
(00007ff6`7a7380a0)]
00007ff6`7a6b38a7 e906000000 jmp test!_tailMerge_wininet_dll
(00007ff6`7a6b38b2)
Seen in clang 10, 11, trunk 12.</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>