Revert "[runtimes] Fix building initial libunwind+libcxxabi+libcxx with compiler implied -lunwind"
This reverts commit 7c3d19ab7b
.
This commit was reported as causing build problems for the amdgpu
buildbot in https://reviews.llvm.org/D113253#3137097.
This commit is contained in:
parent
ca18fcc2c0
commit
efbe9ae23f
|
@ -773,13 +773,6 @@ function(cxx_link_system_libraries target)
|
||||||
target_add_link_flags_if_supported(${target} PRIVATE "/nodefaultlib")
|
target_add_link_flags_if_supported(${target} PRIVATE "/nodefaultlib")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (LIBCXX_SUPPORTS_UNWINDLIB_NONE_FLAG AND LIBCXXABI_USE_LLVM_UNWINDER)
|
|
||||||
# If we're linking directly against the libunwind that we're building
|
|
||||||
# in the same invocation, don't try to link in the toolchain's
|
|
||||||
# default libunwind (which may be missing still).
|
|
||||||
target_add_link_flags_if_supported(${target} PRIVATE "--unwindlib=none")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (LIBCXX_HAS_SYSTEM_LIB)
|
if (LIBCXX_HAS_SYSTEM_LIB)
|
||||||
target_link_libraries(${target} PRIVATE System)
|
target_link_libraries(${target} PRIVATE System)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -1,22 +1,9 @@
|
||||||
include(CMakePushCheckState)
|
include(CMakePushCheckState)
|
||||||
include(CheckLibraryExists)
|
include(CheckLibraryExists)
|
||||||
include(CheckLinkerFlag)
|
|
||||||
include(CheckCCompilerFlag)
|
include(CheckCCompilerFlag)
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
include(CheckCSourceCompiles)
|
include(CheckCSourceCompiles)
|
||||||
|
|
||||||
# The compiler driver may be implicitly trying to link against libunwind.
|
|
||||||
# This is normally ok (libcxx relies on an unwinder), but if libunwind is
|
|
||||||
# built in the same cmake invocation as libcxx and we've got
|
|
||||||
# LIBCXXABI_USE_LLVM_UNWINDER set, we'd be linking against the just-built
|
|
||||||
# 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)
|
|
||||||
if (LIBCXX_SUPPORTS_UNWINDLIB_NONE_FLAG)
|
|
||||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --unwindlib=none")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WIN32 AND NOT MINGW)
|
if(WIN32 AND NOT MINGW)
|
||||||
# NOTE(compnerd) this is technically a lie, there is msvcrt, but for now, lets
|
# NOTE(compnerd) this is technically a lie, there is msvcrt, but for now, lets
|
||||||
# let the default linking take care of that.
|
# let the default linking take care of that.
|
||||||
|
|
|
@ -1,21 +1,6 @@
|
||||||
# This file handles building LLVM runtime sub-projects.
|
# This file handles building LLVM runtime sub-projects.
|
||||||
cmake_minimum_required(VERSION 3.13.4)
|
cmake_minimum_required(VERSION 3.13.4)
|
||||||
|
project(Runtimes C CXX ASM)
|
||||||
# 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)
|
|
||||||
|
|
||||||
set(LLVM_ALL_RUNTIMES "compiler-rt;libc;libcxx;libcxxabi;libunwind;openmp")
|
set(LLVM_ALL_RUNTIMES "compiler-rt;libc;libcxx;libcxxabi;libunwind;openmp")
|
||||||
set(LLVM_ENABLE_RUNTIMES "" CACHE STRING
|
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(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)
|
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"
|
||||||
|
)
|
||||||
|
|
||||||
function(get_compiler_rt_path path)
|
function(get_compiler_rt_path path)
|
||||||
foreach(entry ${runtimes})
|
foreach(entry ${runtimes})
|
||||||
get_filename_component(projName ${entry} NAME)
|
get_filename_component(projName ${entry} NAME)
|
||||||
|
@ -93,29 +86,14 @@ if(APPLE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(CheckLibraryExists)
|
include(CheckLibraryExists)
|
||||||
include(CheckLinkerFlag)
|
|
||||||
include(CheckCCompilerFlag)
|
include(CheckCCompilerFlag)
|
||||||
include(CheckCXXCompilerFlag)
|
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.
|
# Disable use of the installed C++ standard library when building runtimes.
|
||||||
# Check for -nostdlib++ first; if there's no C++ standard library yet,
|
# Check for -nostdlib++ first; if there's no C++ standard library yet,
|
||||||
# all check_cxx_compiler_flag commands will fail until we add -nostdlib++
|
# all check_cxx_compiler_flag commands will fail until we add -nostdlib++
|
||||||
# (or -nodefaultlibs).
|
# (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)
|
if (LLVM_RUNTIMES_SUPPORT_NOSTDLIBXX_FLAG)
|
||||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++")
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++")
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue