Clang: prefer lld-link over link.exe
Objects compiled with -flto can only be linked with the llvm linker. Before this change, clang-cl only supperted IPO with manual linker selection.
@dutow Is there a description somewhere of what exactly does cmake to build executables with clang.exe? I try to add support for clang.exe in https://github.com/microsoft/vscode-cmake-tools The 32-bit clang.exe builds use ll.lld.exe to link. clang-cl.exe uses lld-link.exe I think. In one of your comments you said that debugging with clang.exe works but if I use the MSVC debugger in VSCode, the breakpoints get hit and the call stack is displayed but there is no info about any variables. Does clang.exe produce MSVC compatible output when building with CMake?
@Zingam since this MR, linking uses
clang++ -fuse-ld=lld-link- and I'm quite sure I've used link.exe before that, as ld.lld doesn't expose a few MSVC specific features.
The issue is most likely that I don't see
/Ziin the debug flags, which should be there... looks like I accidentally removed that during some of the initial refactorings, and I've never really used the debugger with it after that. I'll check and fix this later today.
@Zingam sorry for the late reply, I tried a few configurations, and I see the variables in my project. (using the CMake 3.16 release, latest VS2017 & VSCode & CMake plugin, tested both 32 and 64 bit builds)
The only issue I had is that the cmake plugin wants to launch gdb (which it can't of course), but I was able to use the VS debugger by manually adding a launch target.
Could you help me with reproducing?