Issue 142868
Summary lld-link: delay load stub sometimes not marked as a CFG target
Labels new issue
Assignees
Reporter jstarks
    This is basically the same as #46961, which was fixed long ago. The only difference seems to be the function and DLL being referenced.

test.cpp:
```cxx
int main() {
    extern "C" __declspec(dllimport) int WSACleanup(void);
    decltype(WSACleanup)* volatile ptr = &WSACleanup;
    ptr();
}
```

Build:
* Compile: `cl -c test.cpp -guard:cf -nologo test.cpp`
* Link: `<linker> test.obj -debug ws2_32.lib -guard:cf -delayload:ws2_32.dll dloadhelper.lib -nologo`

With `lld-link`, the resulting binary will hit a CFG failure. With `link`, the binary will successfully run.

The results are the same whether `cl` or `clang-cl` is used as the compiler.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to