-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lld-link] LLD-LINK produces broken forward imports in source DEF #132411
Comments
Clang-CL has bugs about forwarding imports, which breaks x86 builds _somehow_. So we define them in source and export them. Reference: llvm/llvm-project#132411 Signed-off-by: LIU Hao <lh_mouse@126.com>
This should fix the problem: cjacek@2845c53 |
The change looks correct to me. Thanks. |
@llvm/issue-subscribers-lld-coff Author: LIU Hao (lhmouse)
First let's define an empty DLL that exports `CreateThread`, forwarded from Windows KERNEL32.DLL:
// test.c
int
__stdcall
_DllMainCRTStartup(void* i, unsigned long r, void* p)
{ return 1; } ; test.def
EXPORTS
CreateThread = kernel32.CreateThread Now build two DLLs, one with Microsoft LINK (good.dll) and one with LLD (bad.dll):
The bad DLL will cause failure when it's loaded by another application, saying _kernel32.dll is not found. Now let's open the good DLL with a hex editor: And this is the bad DLL. The import from This bug exists only when targeting x86-32. |
First let's define an empty DLL that exports
CreateThread
, forwarded from Windows KERNEL32.DLL:; test.def EXPORTS CreateThread = kernel32.CreateThread
Now build two DLLs, one with Microsoft LINK (good.dll) and one with LLD (bad.dll):
The bad DLL will cause failure when it's loaded by another application, saying _kernel32.dll is not found.
Now let's open the good DLL with a hex editor:
And this is the bad DLL. The import from
_kernel32.CreateThread
is exactly the issue.This bug exists only when targeting x86-32.
The text was updated successfully, but these errors were encountered: