Open Quuxplusone opened 6 years ago
Second this. Seems very strange that this is not working and manually adding
all ms-compatibility flags set up by clang-cl is very cumbersome.
Currently this is the error clang-cl emits when trying to -Xclang -emit-llvm:
fatal error LNK1107: invalid or corrupt file: cannot read at 0xFEA
clang-cl.exe: error: linker command failed with exit code 1107 (use -v to see
invocation)
There is no
-emit-llvm
flag in gcc, but the GCC driver was extended to support-emit-llvm
. The equivalent for cl.exe would be/c -emit-llvm
, but it doesn't work.What I found very surprising is that
clang-cl /c -Xclang -emit-llvm hello_world.c
doesn't even work. Maybe that is a bug.All the examples on https://clang.llvm.org/docs/UsersManual.html are written for clang.exe, and they don't work anymore for clang-cl.exe.
The workaround for getting clang-cl.exe to emit IR is to run
clang-cl.exe -###
, and then replace the-emit-obj
with-emit-llvm
, which I personally find quite unintuitive.The goal for clang-cl.exe is to be compatible with cl.exe. But in my opinion, it should also remain compatible with LLVM: clang.exe should be LLVM+gcc, and clang-cl.exe should be LLVM+cl.
Cf. https://bugs.llvm.org/show_bug.cgi?id=35120