[llvm-bugs] [Bug 47617] New: Delay load stubs are not marked as CFG targets

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 22 12:38:29 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47617

            Bug ID: 47617
           Summary: Delay load stubs are not marked as CFG targets
           Product: new-bugs
           Version: 10.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dmajor at mozilla.com
                CC: andrew.paverd at microsoft.com, htmldeveloper at gmail.com,
                    llvm-bugs at lists.llvm.org, rnk at google.com,
                    sylvestre at debian.org, tom at ritter.vg

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200922/c08693e2/attachment.html>


More information about the llvm-bugs mailing list