summaryrefslogtreecommitdiff
path: root/libunwind
diff options
context:
space:
mode:
authorPetr Hosek <phosek@google.com>2023-02-01 08:25:35 +0000
committerPetr Hosek <phosek@google.com>2023-02-22 04:24:49 +0000
commitefae3174f09560353fb0f3d528bcbffe060d5438 (patch)
treefe45b3f6a87a91d2f5b61b0fffcc0c536f20a1dc /libunwind
parent0df66569e529be4bcea06f314c02c6af74989704 (diff)
downloadllvm-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 'libunwind')
-rw-r--r--libunwind/cmake/config-ix.cmake8
1 files changed, 4 insertions, 4 deletions
diff --git a/libunwind/cmake/config-ix.cmake b/libunwind/cmake/config-ix.cmake
index d311477f02c6..ae6caebff3dc 100644
--- a/libunwind/cmake/config-ix.cmake
+++ b/libunwind/cmake/config-ix.cmake
@@ -2,14 +2,14 @@ include(CMakePushCheckState)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckLibraryExists)
-include(LLVMCheckCompilerLinkerFlag)
+include(LLVMCheckLinkerFlag)
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_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)
check_library_exists(c fopen "" LIBUNWIND_HAS_C_LIB)
@@ -31,11 +31,11 @@ endif()
# required for the link to go through. We remove sanitizers from the
# configuration checks to avoid spurious link errors.
-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++")
else()
- llvm_check_compiler_linker_flag(C "-nodefaultlibs" C_SUPPORTS_NODEFAULTLIBS_FLAG)
+ llvm_check_linker_flag(C "-nodefaultlibs" C_SUPPORTS_NODEFAULTLIBS_FLAG)
if (C_SUPPORTS_NODEFAULTLIBS_FLAG)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
endif()