[PATCH] D28738: Add a LLVM_USE_LINKER that defines the linker to use when building LLVM

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 14 19:14:03 PST 2017


davide added a comment.

This is a nice improvement. Some comments inline.



================
Comment at: llvm/cmake/modules/HandleLLVMOptions.cmake:99-101
-  if(LLVM_ENABLE_LLD AND LLVM_ENABLE_LTO)
-    message(FATAL_ERROR "lld does not support LTO on Darwin")
-  endif()
----------------
I think still emitting a diagnostic in this case would be good. In general, I think we should emit a diagnostic on every linker that can't do LTO when we try to do it. Why did you remove it?


================
Comment at: llvm/docs/CMake.rst:385-389
+**LLVM_USE_LINKER**:STRING
+  Add ``-fuse-ld={name}`` to the link invocation. The value can be an absolute
+  path to your custom linker, otherwise clang will prefix the name with ``ld.``
+  and apply its usual search. For example to link LLVM with the Gold linker, 
+  cmake can be invoked with ``-DLLVM_USE_LINKER=gold``.
----------------
Hmm, this can be expanded a bit. If clang is used as base compiler, what you say is perfectly fine. 
But gcc has some limitations:
1) it doesn't support absoule paths.
2) it hardcodes a couple of values, bfd/gold and rejects everything else.


https://reviews.llvm.org/D28738





More information about the llvm-commits mailing list