[clang] Disable LTO and LLD on SystemZ for stage3 builds

LLD does not support SystemZ, so it doesn't make sense to use it for
boostrap/stage3 builds, and using LTO in these cases won't work.

Differential Revision: https://reviews.llvm.org/D89942
This commit is contained in:
Timm Bäder 2021-03-09 11:51:09 +01:00
parent fee9054232
commit d9ef6bc426
2 changed files with 29 additions and 4 deletions

View File

@ -640,6 +640,11 @@ if (CLANG_ENABLE_BOOTSTRAP)
set(BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${NEXT_CLANG_STAGE}-bins/)
if(BOOTSTRAP_LLVM_ENABLE_LLD)
# adding lld to clang-bootstrap-deps without having it enabled in
# LLVM_ENABLE_PROJECTS just generates a cryptic error message.
if (NOT "lld" IN_LIST LLVM_ENABLE_PROJECTS)
message(FATAL_ERROR "LLD is enabled in the boostrap build, but lld is not in LLVM_ENABLE_PROJECTS")
endif()
add_dependencies(clang-bootstrap-deps lld)
endif()

View File

@ -1,14 +1,34 @@
set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "")
set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
# Use LLD do have less requirements on system linker, unless we're on an apple
# platform where the system compiler is to be prefered.
if(APPLE)
# Use LLD to have fewer requirements on system linker, unless we're on an apple
# platform where the system compiler is to be preferred.
set(BOOTSTRAP_LLVM_ENABLE_LLD OFF CACHE BOOL "")
set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
elseif(CMAKE_HOST_UNIX)
# s390/SystemZ is unsupported by LLD, so don't try to enable LTO if it
# cannot work.
# We do our own uname business here since the appropriate variables from CMake
# and llvm are not yet available.
find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
if(CMAKE_UNAME)
exec_program(${CMAKE_UNAME} ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
RETURN_VALUE val)
endif(CMAKE_UNAME)
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "s390")
set(BOOTSTRAP_LLVM_ENABLE_LTO OFF CACHE BOOL "")
set(BOOTSTRAP_LLVM_ENABLE_LLD OFF CACHE BOOL "")
else()
else()
set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
endif()
else()
set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
endif()