Details
-
Suggestion
-
Resolution: Done
-
Not Evaluated
-
None
-
None
-
52a58afc794c441bb32bea6ca7f6ac021e0c372b (qt-creator/qt-creator/master)
Description
lld errors have different layout than GNU ld.
A few examples for undefined reference error follow.
Linux, with debugging symbols. It has line number:
$ g++ -g -fuse-ld=lld test.cpp ld.lld: error: undefined symbol: func() >>> referenced by test.cpp:5 >>> /tmp/ccg8pzRr.o:(main) collect2: error: ld returned 1 exit status
Linux, without debugging symbols. Has a file without line number:
$ g++ -fuse-ld=lld test.cpp ld.lld: error: undefined symbol: func() >>> referenced by test.cpp >>> /tmp/ccvjyJph.o:(main) collect2: error: ld returned 1 exit status
MinGW. Only symbol and object file:
$ g++ -g -fuse-ld=lld test.cpp lld-link: error: undefined symbol: __Z4funcv >>> referenced by C:\Users\orgads\AppData\Local\Temp\cccApKoz.o:(.text) collect2.exe: error: ld returned 1 exit status
This is a bit tricky, since the error has multiple lines (2 or 3). We probably need to store the state, expect the following lines and only then add the task (or can a task be updated after it was emitted?).
Multiple definitions:
$ cat test1.cpp
void func() {}
$ cat main.cpp
int main() {}
$ g++ -g -c test1.cpp
Linux, debugging symbols:
$ g++ -fuse-ld=lld main.cpp test1.o test1.o ld.lld: error: duplicate symbol: func() >>> defined at test1.cpp:1 >>> test1.o:(func()) >>> defined at test1.cpp:1 >>> test1.o:(.text+0x0) collect2: error: ld returned 1 exit status
Linux, no debugging symbols:
$ g++ -fuse-ld=lld main.cpp test1.o test1.o ld.lld: error: duplicate symbol: func() >>> defined at test1.cpp >>> test1.o:(func()) >>> defined at test1.cpp >>> test1.o:(.text+0x0) collect2: error: ld returned 1 exit status
MinGW (need to copy test1.o to test2.o first, it eliminates a repeating file):
$ g++ -fuse-ld=lld main.cpp test1.o test2.o lld-link: error: duplicate symbol: __Z4funcv in test1.o and in test2.o collect2.exe: error: ld returned 1 exit status