diff options
author | Petr Hosek <phosek@google.com> | 2023-02-01 08:25:35 +0000 |
---|---|---|
committer | Petr Hosek <phosek@google.com> | 2023-02-22 04:24:49 +0000 |
commit | efae3174f09560353fb0f3d528bcbffe060d5438 (patch) | |
tree | fe45b3f6a87a91d2f5b61b0fffcc0c536f20a1dc /runtimes/CMakeLists.txt | |
parent | 0df66569e529be4bcea06f314c02c6af74989704 (diff) | |
download | llvm-efae3174f09560353fb0f3d528bcbffe060d5438.tar.gz |
[CMake] Unify llvm_check_linker_flag and llvm_check_compiler_linker_flag
These have the same purposes but two different implementations.
llvm_check_compiler_linker_flag uses CMAKE_REQUIRED_FLAGS which affects
flags used both for compilation and linking which is problematic because
some flags may be link-only and trigger unused argument warning when set
during compilation. llvm_check_linker_flag does not have this issue so
we chose it as the prevailaing implementation.
Differential Revision: https://reviews.llvm.org/D143052
Diffstat (limited to 'runtimes/CMakeLists.txt')
-rw-r--r-- | runtimes/CMakeLists.txt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt index 50f782205ab4..74d540f3fb1e 100644 --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -78,7 +78,7 @@ set(LLVM_CMAKE_DIR ${LLVM_MAIN_SRC_DIR}/cmake/modules) set(LLVM_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../llvm) include(CheckLibraryExists) -include(LLVMCheckCompilerLinkerFlag) +include(LLVMCheckLinkerFlag) include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) @@ -110,7 +110,7 @@ if (NOT LLVM_RUNTIMES_LINKING_WORKS) # --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_compiler_linker_flag(C "--unwindlib=none" CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG) + llvm_check_linker_flag(C "--unwindlib=none" CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG) if (CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG) set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --unwindlib=none") @@ -140,7 +140,7 @@ endif() # 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_compiler_linker_flag(CXX "-nostdlib++" CXX_SUPPORTS_NOSTDLIBXX_FLAG) +llvm_check_linker_flag(CXX "-nostdlib++" CXX_SUPPORTS_NOSTDLIBXX_FLAG) if (CXX_SUPPORTS_NOSTDLIBXX_FLAG) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++") endif() |