summaryrefslogtreecommitdiff
path: root/runtimes
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2021-12-09 12:54:37 +0200
committerMartin Storsjö <martin@martin.st>2021-12-09 12:56:57 +0200
commit62cff45d765c045b5c7678b3863bd8bffaecae94 (patch)
tree9af16be198a2ef8a49b6f5f7206e3248b84ade57 /runtimes
parentd74a8a78ad06348170dcf5ca3eca6942325cf7cf (diff)
downloadllvm-62cff45d765c045b5c7678b3863bd8bffaecae94.tar.gz
Revert "Reapply [runtimes] Fix building initial libunwind+libcxxabi+libcxx with compiler implied -lunwind"
This reverts commit 317dc31e53b83c1d2a468d7a541925f0cc7d9dce. After that change, OpenMP doesn't find dependencies in the host system (it fails do find e.g. /usr/lib/x86_64-linux-gnu/libelf.so which it found before), which causes some OpenMP target offloading plugins to not be found. This doesn't break the build, but just causes the AMDGPU OpenMP target plugin to be omitted. See https://reviews.llvm.org/D113253#3181934 for the report of this issue.
Diffstat (limited to 'runtimes')
-rw-r--r--runtimes/CMakeLists.txt42
1 files changed, 10 insertions, 32 deletions
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index 8279782a4e7b..eeaff6c43184 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -1,21 +1,6 @@
# This file handles building LLVM runtime sub-projects.
cmake_minimum_required(VERSION 3.13.4)
-
-# Add path for custom and the LLVM build's modules to the CMake module path.
-list(INSERT CMAKE_MODULE_PATH 0
- "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
- "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
- "${CMAKE_CURRENT_SOURCE_DIR}/../cmake"
- "${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules"
- "${CMAKE_CURRENT_SOURCE_DIR}/../llvm/cmake"
- "${CMAKE_CURRENT_SOURCE_DIR}/../llvm/cmake/modules"
-)
-
-# We may have an incomplete toolchain - do language support tests without
-# linking.
-include(EnableLanguageNolink)
-project(Runtimes LANGUAGES NONE)
-llvm_enable_language_nolink(C CXX ASM)
+project(Runtimes C CXX ASM)
set(LLVM_ALL_RUNTIMES "compiler-rt;libc;libcxx;libcxxabi;libunwind;openmp")
set(LLVM_ENABLE_RUNTIMES "" CACHE STRING
@@ -43,6 +28,14 @@ endfunction()
find_package(LLVM PATHS "${LLVM_BINARY_DIR}" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
find_package(Clang PATHS "${LLVM_BINARY_DIR}" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+# Add path for custom and the LLVM build's modules to the CMake module path.
+list(INSERT CMAKE_MODULE_PATH 0
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../llvm/cmake"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../llvm/cmake/modules"
+)
+
set(LLVM_THIRD_PARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../third-party")
function(get_compiler_rt_path path)
@@ -91,29 +84,14 @@ set(LLVM_CMAKE_DIR ${LLVM_MAIN_SRC_DIR}/cmake/modules)
set(LLVM_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../llvm)
include(CheckLibraryExists)
-include(CheckLinkerFlag)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
-
-check_c_compiler_flag("" LLVM_RUNTIMES_LINKING_WORKS)
-if (NOT LLVM_RUNTIMES_LINKING_WORKS)
- # 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.
- # 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)
- if (LLVM_RUNTIMES_SUPPORT_UNWINDLIB_NONE_FLAG)
- set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --unwindlib=none")
- endif()
-endif()
-
# Disable use of the installed C++ standard library when building runtimes.
# 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)
+check_c_compiler_flag(-nostdlib++ LLVM_RUNTIMES_SUPPORT_NOSTDLIBXX_FLAG)
if (LLVM_RUNTIMES_SUPPORT_NOSTDLIBXX_FLAG)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++")
endif()