Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.12.0
-
None
-
Clang 7.0.0, VS2017 15.9.3, Win 10 17763.168
-
-
b34143f8a19040a457d399a22f0bde53ac327ff1 (qt/qtbase/5.12)
Description
To enable LTCG, clang-cl.exe need "-flto" instead of "-GL". But if you enabled LTO, the lib tool will have to change from "lib.exe" to "llvm-lib.exe" and the link tool also need to change from "link.exe" to "lld-link.exe"(or "ld.lld.exe"/"ld64.lld.exe"/"lld.exe", they are the same), because msvc linker will see these lib files as corrupted files.
Add the following lines to qtbase\mkspecs\win32-clang-msvc\qmake.conf will solve this problem:
QMAKE_LINK = lld-link QMAKE_LIB = llvm-lib /NOLOGO QMAKE_CFLAGS_LTCG = -flto QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG QMAKE_LFLAGS_LTCG =
Leave QMAKE_LFLAGS_LTCG empty because "lld-link.exe" does not recognize "-flto" or "-GL".
And one more thing, there's a flood of warning messages when I'm compiling qtbase:
clang-cl.exe: warning: argument unused during compilation: '-Gm-' [-Wunused-command-line-argument]
Attachments
Issue Links
- relates to
-
QTBUG-76794 win32-clang-msvc: Can't find linker for LLVM 8.0
- Closed