[PATCH] D38665: [CMake] Fix linker detection in AddLLVM.cmake

Zhihao Yuan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 17:51:38 PDT 2017


lichray added a comment.

In https://reviews.llvm.org/D38665#905947, @ruiu wrote:

> I mean -DLLVM_USE_LINKER=lld is a valid option, so when it failed due to the lack compiler support of -fuse-ld=lld, it should be reported as a meaningful error, instead of a cryptic "CMake failed to compile this program blah blah." message. I think that is also true to the case when you pass -DLLVM_USE_LINKER=gold but gold was not installed to your system.


Let me clarify this with refreshed information -- there is no `LLVM_USE_LLD` but `LLVM_ENABLE_LLD`, which builds lld and then set `LLVM_USE_LINKER`, and then in `cmake/modules/HandleLLVMOptions.cmake` line 197 detects `-fuse-ld=`.  Which means, neither `LLVM_USE_LINKER` nor `LLVM_ENABLE_LLD` had magics to support compilers other than clang to use lld.  That is to say, this patch doesn't make our support worse.  The error message has room for improvement, but IMHO may not worth to work it out in this patch.  The author can feel free to apply line 197's macro here, but unlikely we want to make even more errors from underlying compilers more meaningful.


Repository:
  rL LLVM

https://reviews.llvm.org/D38665





More information about the llvm-commits mailing list