diff --git a/cmake/Modules/CheckLinkerFlag.cmake b/cmake/Modules/CheckCompilerAndLinkerFlag.cmake rename from cmake/Modules/CheckLinkerFlag.cmake rename to cmake/Modules/CheckCompilerAndLinkerFlag.cmake --- a/cmake/Modules/CheckLinkerFlag.cmake +++ b/cmake/Modules/CheckCompilerAndLinkerFlag.cmake @@ -1,7 +1,9 @@ include(CMakePushCheckState) include(CheckCCompilerFlag) -function(llvm_check_linker_flag flag dest) +# N.B. there is a `llvm_check_linker_flag` defined in an (installed) CMake +# module from LLVM proper that is *not* the same as this. +function(llvm_check_compiler_and_linker_flag flag dest) # If testing a flag with check_c_compiler_flag, it gets added to the compile # command only, but not to the linker command in that test. If the flag # is vital for linking to succeed, the test would fail even if it would diff --git a/libcxx/cmake/config-ix.cmake b/libcxx/cmake/config-ix.cmake --- a/libcxx/cmake/config-ix.cmake +++ b/libcxx/cmake/config-ix.cmake @@ -1,6 +1,6 @@ include(CMakePushCheckState) include(CheckLibraryExists) -include(CheckLinkerFlag) +include(CheckCompilerAndLinkerFlag) include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) include(CheckCSourceCompiles) @@ -12,7 +12,7 @@ # libunwind (and the compiler implicit -lunwind wouldn't succeed as the newly # built libunwind isn't installed yet). For those cases, it'd be good to # link with --uwnindlib=none. Check if that option works. -llvm_check_linker_flag("--unwindlib=none" LIBCXX_SUPPORTS_UNWINDLIB_NONE_FLAG) +llvm_check_compiler_and_linker_flag("--unwindlib=none" LIBCXX_SUPPORTS_UNWINDLIB_NONE_FLAG) if (LIBCXX_SUPPORTS_UNWINDLIB_NONE_FLAG) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --unwindlib=none") endif() diff --git a/libunwind/cmake/config-ix.cmake b/libunwind/cmake/config-ix.cmake --- a/libunwind/cmake/config-ix.cmake +++ b/libunwind/cmake/config-ix.cmake @@ -2,14 +2,14 @@ include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) include(CheckLibraryExists) -include(CheckLinkerFlag) +include(CheckCompilerAndLinkerFlag) include(CheckSymbolExists) include(CheckCSourceCompiles) # The compiler driver may be implicitly trying to link against libunwind, which # might not work if libunwind doesn't exist yet. Try to check if # --unwindlib=none is supported, and use that if possible. -llvm_check_linker_flag("--unwindlib=none" LIBUNWIND_SUPPORTS_UNWINDLIB_NONE_FLAG) +llvm_check_compiler_and_linker_flag("--unwindlib=none" LIBUNWIND_SUPPORTS_UNWINDLIB_NONE_FLAG) if (LIBUNWIND_SUPPORTS_UNWINDLIB_NONE_FLAG) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --unwindlib=none") endif() @@ -34,11 +34,11 @@ # required for the link to go through. We remove sanitizers from the # configuration checks to avoid spurious link errors. -llvm_check_linker_flag(-nostdlib++ LIBUNWIND_SUPPORTS_NOSTDLIBXX_FLAG) +llvm_check_compiler_and_linker_flag(-nostdlib++ LIBUNWIND_SUPPORTS_NOSTDLIBXX_FLAG) if (LIBUNWIND_SUPPORTS_NOSTDLIBXX_FLAG) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++") else() - llvm_check_linker_flag(-nodefaultlibs LIBUNWIND_SUPPORTS_NODEFAULTLIBS_FLAG) + llvm_check_compiler_and_linker_flag(-nodefaultlibs LIBUNWIND_SUPPORTS_NODEFAULTLIBS_FLAG) if (LIBUNWIND_SUPPORTS_NODEFAULTLIBS_FLAG) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs") endif() diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -88,7 +88,7 @@ set(LLVM_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../llvm) include(CheckLibraryExists) -include(CheckLinkerFlag) +include(CheckCompilerAndLinkerFlag) include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) @@ -100,7 +100,7 @@ # --unwindlib=none is supported, and use that if possible. # Don't add this if not necessary to fix linking, as it can break using # e.g. ASAN/TSAN. - llvm_check_linker_flag("--unwindlib=none" LLVM_RUNTIMES_SUPPORT_UNWINDLIB_NONE_FLAG) + llvm_check_compiler_and_linker_flag("--unwindlib=none" LLVM_RUNTIMES_SUPPORT_UNWINDLIB_NONE_FLAG) if (LLVM_RUNTIMES_SUPPORT_UNWINDLIB_NONE_FLAG) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --unwindlib=none") endif() @@ -110,7 +110,7 @@ # Check for -nostdlib++ first; if there's no C++ standard library yet, # all check_cxx_compiler_flag commands will fail until we add -nostdlib++ # (or -nodefaultlibs). -llvm_check_linker_flag(-nostdlib++ LLVM_RUNTIMES_SUPPORT_NOSTDLIBXX_FLAG) +llvm_check_compiler_and_linker_flag(-nostdlib++ LLVM_RUNTIMES_SUPPORT_NOSTDLIBXX_FLAG) if (LLVM_RUNTIMES_SUPPORT_NOSTDLIBXX_FLAG) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++") endif()