[llvm] r307852 - [Solaris] Detect Solaris LD, use detection results to pass Solaris-ld options

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 10:21:51 PDT 2017


Picking a random Solaris commit.
I'd like to bring this up sooner rather than later.
It seems there's been a decent amount of interest/support to make
clang working on Solaris.
It's also not a mystery anymore that Solaris has been discontinued
and, as it stands, the LLVM/clang support for the OS is not completed.
I'm not entirely sure what are the plans, but in case nobody is
interested, I'd rather avoid the maintenance burden and remove the
support from the tree as it happened in similar circumstances (see
e.g. https://reviews.llvm.org/D35707).

Feedor, what do you think about it?

On Wed, Jul 12, 2017 at 2:43 PM, Rui Ueyama via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: ruiu
> Date: Wed Jul 12 14:43:14 2017
> New Revision: 307852
>
> URL: http://llvm.org/viewvc/llvm-project?rev=307852&view=rev
> Log:
> [Solaris] Detect Solaris LD, use detection results to pass Solaris-ld options
>
> Solaris ld is not the only linker available on Solaris.
> Introducing linker detection and using LLVM_LINKER_IS_SOLARISLD to
> select Solaris-ld specific handling.
>
> Patch by: Fedor Sergeev
>
> Differential Revision: https://reviews.llvm.org/D35325
>
> Modified:
>     llvm/trunk/cmake/modules/AddLLVM.cmake
>
> Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=307852&r1=307851&r2=307852&view=diff
> ==============================================================================
> --- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
> +++ llvm/trunk/cmake/modules/AddLLVM.cmake Wed Jul 12 14:43:14 2017
> @@ -91,7 +91,7 @@ function(add_llvm_symbol_exports target_
>        DEPENDS ${export_file}
>        VERBATIM
>        COMMENT "Creating export file for ${target_name}")
> -    if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
> +    if (${LLVM_LINKER_IS_SOLARISLD})
>        set_property(TARGET ${target_name} APPEND_STRING PROPERTY
>                     LINK_FLAGS "  -Wl,-M,${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
>      else()
> @@ -148,13 +148,28 @@ function(add_llvm_symbol_exports target_
>  endfunction(add_llvm_symbol_exports)
>
>  if(NOT WIN32 AND NOT APPLE)
> +  # Detect what linker we have here
>    execute_process(
>      COMMAND ${CMAKE_C_COMPILER} -Wl,--version
>      OUTPUT_VARIABLE stdout
> -    ERROR_QUIET
> +    ERROR_VARIABLE stderr
>      )
> +  set(LLVM_LINKER_DETECTED ON)
>    if("${stdout}" MATCHES "GNU gold")
>      set(LLVM_LINKER_IS_GOLD ON)
> +    message(STATUS "Linker detection: GNU Gold")
> +  elseif("${stdout}" MATCHES "^LLD")
> +    set(LLVM_LINKER_IS_LLD ON)
> +    message(STATUS "Linker detection: LLD")
> +  elseif("${stdout}" MATCHES "GNU ld")
> +    set(LLVM_LINKER_IS_GNULD ON)
> +    message(STATUS "Linker detection: GNU ld")
> +  elseif("${stderr}" MATCHES "Solaris Link Editors")
> +    set(LLVM_LINKER_IS_SOLARISLD ON)
> +    message(STATUS "Linker detection: Solaris ld")
> +  else()
> +    set(LLVM_LINKER_DETECTED OFF)
> +    message(STATUS "Linker detection: unknown")
>    endif()
>  endif()
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare


More information about the llvm-commits mailing list