[LLVMdev] CMake: Gold linker detection
C Bergström
cbergstrom at pathscale.com
Tue Jan 27 11:50:32 PST 2015
On Wed, Jan 28, 2015 at 2:27 AM, Sumanth Gundapaneni <
sgundapa at codeaurora.org> wrote:
> Hi Rafael,
>
> I looked at the code which you pushed a while ago to
> check for the gold linker.
>
> Code below:
>
> execute_process(
>
> COMMAND ${CMAKE_C_COMPILER} -Wl,--version
>
> OUTPUT_VARIABLE stdout
>
> ERROR_QUIET)
>
> if("${stdout}" MATCHES "GNU gold")
>
> set(LLVM_LINKER_IS_GOLD ON)
>
> endif()
>
>
>
>
>
> I was trying to build runtime libraries (compiler-rt) for ARM using
> “clang” which includes this code.
>
> A while ago, I saw the error message until geek4civic fixed it with
> “ERROR_QUIET”.
>
> I usually specify my sysroot and tool chain(linker) through CFLAGS.
>
> To fortify the logic, “${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} -Wl,
> --version” would be ideal than “${CMAKE_C_COMPILER} -Wl, --version” which
> works mostly for gnu compilers.
>
> Let me know, I can push a patch
>
>
>
> execute_process(
>
> - COMMAND ${CMAKE_C_COMPILER} -Wl,--version
>
> + COMMAND “${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS}” -Wl,--version
>
> OUTPUT_VARIABLE stdout
>
> ERROR_QUIET)
>
> if("${stdout}" MATCHES "GNU gold")
>
> set(LLVM_LINKER_IS_GOLD ON)
>
> endif()
>
While this may be convenient I don't think it's strictly correct.
CFLAGS != LDFLAGS
I think if extra flags are going to be passed it should be LD specific
since that's what this is intended to check.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150128/9cee3fd6/attachment.html>
More information about the llvm-dev
mailing list