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: unassignedb...@nondot.org
          Reporter: dma...@mozilla.com
                CC: andrew.pav...@microsoft.com, htmldevelo...@gmail.com,
                    llvm-bugs@lists.llvm.org, r...@google.com,
                    sylves...@debian.org, t...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to