Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

which linker should I use for clang on windows

Tags:

c++

llvm

clang

lldb

I'm just trying to understand how to use Clang/LLVM on Windows (not Microsoft Clanf/C2 toolchain).

please clarify my understanding: here is a description of the process.

do I understand this right, to produce executable these steps should be performed explicitly :

  • clang.exe (frontend compiler)
  • llc.exe (backend code generator)
  • lld.exe (linker)

or implicitly:

  • just running clang.exe (which runs other tools from itself)

however, in the manual above, it's recommended to use Microsoft Linker (link.exe), why?

  • because this linker can produce .pdb file for the debugging by ms debugger? is the only difference in result of the work of link.exe and lld.exe?
  • if I will use lld.exe anyway - this will produce valid executable for win platform, isn't it?
  • if I'll use lld - can this produce own format debug info for a using with lldb on windows?
like image 926
amigo421 Avatar asked Nov 17 '16 21:11

amigo421


1 Answers

link.exe is the standard linker on Windows and (as of LLVM 3.9) can generate pdb debug info for debugging with visual studio. Link.exe does not preserve DWARF debug info if you intend to use lldb.

lld will produce valid DWARF debug info, but the last time I checked (I think around LLVM 3.7) it only worked for x86. It will link an x64 executable, but not provide valid debug info.

more info here. http://lld.llvm.org/windows_support.html

like image 138
Cholesky Avatar answered Oct 13 '22 22:10

Cholesky