[llvm-bugs] [Bug 42536] New: lld-link reporting undefined symbol with lto
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jul 8 05:02:16 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42536
Bug ID: 42536
Summary: lld-link reporting undefined symbol with lto
Product: lld
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: COFF
Assignee: unassignedbugs at nondot.org
Reporter: russell_gallop at sn.scee.net
CC: llvm-bugs at lists.llvm.org
Created attachment 22205
--> https://bugs.llvm.org/attachment.cgi?id=22205&action=edit
Reproducible
lld-link 8.0.0 crashes when reporting an undefined symbol (still present at
r364942).
(note that the test case below wouldn't link successfully with the bug fixed
due to the undefined symbols).
--- library.cpp
struct S {
virtual void foo() {}
};
void a() { S b; }
--- main.cpp
struct __declspec(dllimport) S {
virtual void foo();
};
struct a {
a();
};
struct {
a b;
S c;
} d;
> clang-cl /c /nologo /O2 /MT /TP -m64 -flto library.cpp
> llvm-lib /OUT:library.lib /NOLOGO library.obj
> clang-cl /c /nologo /O2 /MT /TP -m64 -flto main.cpp
>lld-link /OUT:test.exe "library.lib" "main.obj" /MACHINE:X64 /INCREMENTAL:NO /SUBSYSTEM:CONSOLE /ERRORREPORT:PROMPT /NOLOGO /NODEFAULTLIB
lld-link: error: <root>: undefined symbol: mainCRTStartup
Stack dump:
0. Program arguments: lld-link /OUT:test.exe library.lib main.obj
/MACHINE:X64 /INCREMENTAL:NO /SUBSYSTEM:CONSOLE /ERRORREPORT:PROMPT /NOLOGO
/NODEFAULTLIB
#0 0x00007ff6b77886d3 lld::coff::getSymbol
F:\git\llvm-project\lld\COFF\SymbolTable.cpp:72:0
#1 0x00007ff6b7787c0c lld::coff::getSymbolLocations(class lld::coff::ObjFile
*,unsigned int) F:\git\llvm-project\lld\COFF\SymbolTable.cpp:102:0
#2 0x00007ff6b778bcaf lld::coff::reportUndefinedSymbol
F:\git\llvm-project\lld\COFF\SymbolTable.cpp:147:0
#3 0x00007ff6b778b498 lld::coff::SymbolTable::reportRemainingUndefines(void)
F:\git\llvm-project\lld\COFF\SymbolTable.cpp:331:0
#4 0x00007ff6b76f0437 lld::coff::LinkerDriver::link(class llvm::ArrayRef<char
const *>) F:\git\llvm-project\lld\COFF\Driver.cpp:1761:0
#5 0x00007ff6b76e89e1 lld::coff::link(class llvm::ArrayRef<char const
*>,bool,class llvm::raw_ostream &) F:\git\llvm-project\lld\COFF\Driver.cpp:78:0
#6 0x00007ff6b76b1227 main F:\git\llvm-project\lld\tools\lld\lld.cpp:155:0
#7 0x00007ff6b95fbc94 __scrt_common_main_seh
d:\agent\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
#8 0x00007ffe2d414034 (C:\WINDOWS\System32\KERNEL32.DLL+0x14034)
#9 0x00007ffe2e553691 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x73691)
Without -flto this reports:
lld-link: error: <root>: undefined symbol: mainCRTStartup
lld-link: error: undefined symbol: public: __cdecl a::a(void)
>>> referenced by main.obj:(_GLOBAL__sub_I_main.cpp)
lld-link: error: undefined symbol: const type_info::`vftable'
>>> referenced by main.obj:(struct S `RTTI Type Descriptor')
>>> referenced by library.lib(library.obj)
--
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/20190708/f6e8dbf7/attachment-0001.html>
More information about the llvm-bugs
mailing list