CMake has a set of 'CMAKE_<LANG>_COMPILER_WORKS' variables to skip checking
of the corresponding compiler during the configuration phase what is used by
LLVM to build runtimes: the llvm/runtimes/CMakeLists.txt file contains calls
of the llvm_ExternalProject_Add function to build the runtime components and
on these calls all the 'CMAKE_<LANG>_COMPILER_WORKS' variables are set to
'ON'.
The patch introduces a new similar variable 'LLVM_LINKER_SKIP_TEST' that is
used to skip checking of the used linker if the 'LLVM_USE_LINKER' variable
is set. The check should be skipped during building runtime components for
non-host environments: at this time the required libraries (libunwind,
builtins, crt, etc.) are not ready and the check will false positive fail.
I think the underlying issue is that the source we're trying to compile here implicitly includes standard libraries. I think it'd be better to use a simpler one in combination with -nostdlib (ideally we would check if -nostdlib is supported first) which should avoid the issue altogether and is more correct.