[LLVMdev] CMake: Gold linker detection

Sumanth Gundapaneni sgundapa at codeaurora.org
Tue Jan 27 11:27:22 PST 2015


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()

 

 

 

--Sumanth G

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150127/48f5aace/attachment.html>


More information about the llvm-dev mailing list