Closed
Description
dll.c
__declspec(dllexport) void foo() {}
main.c
extern char __IMPORT_DESCRIPTOR_dll;
int main()
{
// force linker to pull in archive member with undefined section symbols
void *p = &__IMPORT_DESCRIPTOR_dll;
}
Build Steps
cl /c dll.c
link /dll dll.obj
cl /c main.c
lld-link dll.lib main.obj
Error: lld-link: error: section larger than 4 GiB: .data
I think lld misinterprets these symbols in dll.lib, the symbol values are actually section flags that linker is supposed to match with resolved .idata$4 and .idata$5.
...
004 C0000040 UNDEF notype Section | .idata$4
005 C0000040 UNDEF notype Section | .idata$5
...
Linking in step 2 with lld produces a different error: lld-link: error: dll.lib(dll.dll): .idata$4 should not refer to special section 0