[compiler-rt] f59f659 - [CMake] Check the builtins library value first
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 6 10:59:37 PDT 2021
Author: Petr Hosek
Date: 2021-08-06T10:59:24-07:00
New Revision: f59f6598790c8a74bcb1ab7e045484925e8bf551
URL: https://github.com/llvm/llvm-project/commit/f59f6598790c8a74bcb1ab7e045484925e8bf551
DIFF: https://github.com/llvm/llvm-project/commit/f59f6598790c8a74bcb1ab7e045484925e8bf551.diff
LOG: [CMake] Check the builtins library value first
When the builtins library isn't found, find_compiler_rt_library
returns NOTFOUND so we'll end up linking against -lNOTFOUND. We need
to check the return value before adding it to the list.
Differential Revision: https://reviews.llvm.org/D107627
Added:
Modified:
compiler-rt/cmake/config-ix.cmake
Removed:
################################################################################
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index d49a4bef1861a..a95c398741867 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -17,6 +17,9 @@ check_library_exists(c fopen "" COMPILER_RT_HAS_LIBC)
if (COMPILER_RT_USE_BUILTINS_LIBRARY)
include(HandleCompilerRT)
find_compiler_rt_library(builtins "" COMPILER_RT_BUILTINS_LIBRARY)
+ # TODO(PR51389): We should check COMPILER_RT_BUILTINS_LIBRARY and report an
+ # error if the value is NOTFOUND rather than silenty continuing but we first
+ # need to fix find_compiler_rt_library on Darwin.
else()
if (ANDROID)
check_library_exists(gcc __gcc_personality_v0 "" COMPILER_RT_HAS_GCC_LIB)
@@ -32,7 +35,10 @@ if (COMPILER_RT_HAS_NODEFAULTLIBS_FLAG)
list(APPEND CMAKE_REQUIRED_LIBRARIES c)
endif ()
if (COMPILER_RT_USE_BUILTINS_LIBRARY)
- list(APPEND CMAKE_REQUIRED_LIBRARIES "${COMPILER_RT_BUILTINS_LIBRARY}")
+ # TODO: remote this check once we address PR51389.
+ if (${COMPILER_RT_BUILTINS_LIBRARY})
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "${COMPILER_RT_BUILTINS_LIBRARY}")
+ endif()
elseif (COMPILER_RT_HAS_GCC_S_LIB)
list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
elseif (COMPILER_RT_HAS_GCC_LIB)
More information about the llvm-commits
mailing list