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.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Tested on Solaris x86/SPARC with gcc and clang setup to run Solari ld.
Tested on Linux x86 with gcc and clang setup to run different kinds of linkers (Gold, Gnu, LLD).
Note, that there is also existing code in cmake/modules/HandleLLVMOptions.cmake that runs sorta linker detection for Windows,
as well as setting up variables that describe linker features like LLVM_HAVE_LINK_VERSION_SCRIPT.
Ideally it all should be centralized in one place and handle each and every platform.
I'm not trying to be that ambitious here. Just expanding on what already existed.
I'm not sure if you need this. At least for https://bugs.llvm.org/show_bug.cgi?id=33698, it seems you can use --color-diagnostics (instead of -color-diagnostics).
33698 is not the only reason to know "is-Solaris-ld" answer.
There are more places where linker flags are being handled and where SunOS assumed == Solaris-ld, which is wrong:
cmake/modules/AddLLVM.cmake: COMMENT "Creating export file for ${target_name}") if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") set_property(TARGET ${target_name} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-M,${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
It is then perhaps better to add a use of LLVM_LINKER_IS_SOLARISLD to this patch to demonstrate that this patch has at least one usage?