mirror of
https://git.proxmox.com/git/llvm-toolchain
synced 2025-06-16 19:58:03 +00:00
Merge branch '12-llvm-runtimes-build' into '12'
LLVM llvm/clang 12 toolchain with runtimes build See merge request pkg-llvm-team/llvm-toolchain!73
This commit is contained in:
commit
d24d6ab126
23
debian/changelog
vendored
23
debian/changelog
vendored
@ -1,3 +1,26 @@
|
|||||||
|
llvm-toolchain-12 (1:12.0.1-11) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
|
* evolve llvm build configuration in rules to leverage the two stage build
|
||||||
|
with runtimes support whereby the resulting stage2 (final) compiler is used
|
||||||
|
to build the stage2 (final) runtimes as part of a single monolithic build
|
||||||
|
* the stage2 runtimes build now includes compiler-rt, libcxx and libcxxabi as
|
||||||
|
well as libunwind and openmp where supported. Additionally, legacy
|
||||||
|
corresponding standalone build targets are removed from the rules file
|
||||||
|
* patch openmp build to include required runtimes as dependencies to build
|
||||||
|
targets so they are built first when included as part of a runtimes build
|
||||||
|
since openmp can depend on them
|
||||||
|
* patch libclc build to set rpath for prepare_builtins build utility to find
|
||||||
|
correct stage2 libs at runtime when executed as part of a build
|
||||||
|
* patch libcxx build so that if libatomic is found, only link it if libgcc is
|
||||||
|
the rtlib
|
||||||
|
* patch compiler-rt build to suppress xray and testing warns when not enabled
|
||||||
|
* patch llvm linker detection to account for vendor being prepended to lld
|
||||||
|
version string
|
||||||
|
* remove several existing patches incorporating workarounds no longer required
|
||||||
|
by the modified build configuration
|
||||||
|
|
||||||
|
-- Erik Maciejewski <mr.emacski@gmail.com> Wed, 06 Oct 2021 01:25:08 -0700
|
||||||
|
|
||||||
llvm-toolchain-12 (1:12.0.1-10) UNRELEASED; urgency=medium
|
llvm-toolchain-12 (1:12.0.1-10) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* If parallel is not set in DEB_BUILD_OPTIONS, use nproc
|
* If parallel is not set in DEB_BUILD_OPTIONS, use nproc
|
||||||
|
1
debian/control
vendored
1
debian/control
vendored
@ -6,6 +6,7 @@ Maintainer: LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>
|
|||||||
Uploaders: Sylvestre Ledru <sylvestre@debian.org>, Gianfranco Costamagna <locutusofborg@debian.org>
|
Uploaders: Sylvestre Ledru <sylvestre@debian.org>, Gianfranco Costamagna <locutusofborg@debian.org>
|
||||||
Build-Depends: debhelper (>= 9.0), cmake, ninja-build,
|
Build-Depends: debhelper (>= 9.0), cmake, ninja-build,
|
||||||
chrpath, texinfo, sharutils,
|
chrpath, texinfo, sharutils,
|
||||||
|
libelf-dev,
|
||||||
libffi-dev,
|
libffi-dev,
|
||||||
lsb-release, patchutils, diffstat, xz-utils, python3-dev,
|
lsb-release, patchutils, diffstat, xz-utils, python3-dev,
|
||||||
libedit-dev, libncurses5-dev, swig, python3-six, python3-sphinx (>= 1.3.6),
|
libedit-dev, libncurses5-dev, swig, python3-six, python3-sphinx (>= 1.3.6),
|
||||||
|
33
debian/patches/compilerrt-fix-warn-xray-testing.diff
vendored
Normal file
33
debian/patches/compilerrt-fix-warn-xray-testing.diff
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
suppress warnings for xray and testing when not enabled
|
||||||
|
Index: llvm-toolchain-12_12.0.1/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
|
||||||
|
===================================================================
|
||||||
|
--- llvm-toolchain-12_12.0.1.orig/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
|
||||||
|
+++ llvm-toolchain-12_12.0.1/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
|
||||||
|
@@ -242,15 +242,15 @@ macro(load_llvm_config)
|
||||||
|
|
||||||
|
# Detect if we have the LLVMXRay and TestingSupport library installed and
|
||||||
|
# available from llvm-config.
|
||||||
|
+ set(COMPILER_RT_HAS_LLVMXRAY FALSE)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${LLVM_CONFIG_PATH} "--ldflags" "--libs" "xray"
|
||||||
|
RESULT_VARIABLE HAD_ERROR
|
||||||
|
OUTPUT_VARIABLE CONFIG_OUTPUT
|
||||||
|
ERROR_QUIET)
|
||||||
|
- if (HAD_ERROR)
|
||||||
|
+ if (HAD_ERROR AND COMPILER_RT_BUILD_XRAY)
|
||||||
|
message(WARNING "llvm-config finding xray failed with status ${HAD_ERROR}")
|
||||||
|
- set(COMPILER_RT_HAS_LLVMXRAY FALSE)
|
||||||
|
- else()
|
||||||
|
+ elseif(COMPILER_RT_BUILD_XRAY)
|
||||||
|
string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";" CONFIG_OUTPUT ${CONFIG_OUTPUT})
|
||||||
|
list(GET CONFIG_OUTPUT 0 LDFLAGS)
|
||||||
|
list(GET CONFIG_OUTPUT 1 LIBLIST)
|
||||||
|
@@ -267,7 +267,7 @@ macro(load_llvm_config)
|
||||||
|
RESULT_VARIABLE HAD_ERROR
|
||||||
|
OUTPUT_VARIABLE CONFIG_OUTPUT
|
||||||
|
ERROR_QUIET)
|
||||||
|
- if (HAD_ERROR)
|
||||||
|
+ if (HAD_ERROR AND COMPILER_RT_INCLUDE_TESTS)
|
||||||
|
message(WARNING "llvm-config finding testingsupport failed with status ${HAD_ERROR}")
|
||||||
|
elseif(COMPILER_RT_INCLUDE_TESTS)
|
||||||
|
string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";" CONFIG_OUTPUT ${CONFIG_OUTPUT})
|
@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
tools/llvm-config/llvm-config.cpp | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
Index: llvm-toolchain-snapshot_11~++20200326111000+4673699a470/llvm/tools/llvm-config/llvm-config.cpp
|
|
||||||
===================================================================
|
|
||||||
--- llvm-toolchain-snapshot_11~++20200326111000+4673699a470.orig/llvm/tools/llvm-config/llvm-config.cpp
|
|
||||||
+++ llvm-toolchain-snapshot_11~++20200326111000+4673699a470/llvm/tools/llvm-config/llvm-config.cpp
|
|
||||||
@@ -561,9 +561,9 @@ int main(int argc, char **argv) {
|
|
||||||
} else if (Arg == "--shared-mode") {
|
|
||||||
PrintSharedMode = true;
|
|
||||||
} else if (Arg == "--obj-root") {
|
|
||||||
- OS << ActivePrefix << '\n';
|
|
||||||
+ OS << ActivePrefix << "/build/" << '\n';
|
|
||||||
} else if (Arg == "--src-root") {
|
|
||||||
- OS << LLVM_SRC_ROOT << '\n';
|
|
||||||
+ OS << ActivePrefix << "/build/" << '\n';
|
|
||||||
} else if (Arg == "--ignore-libllvm") {
|
|
||||||
LinkDyLib = false;
|
|
||||||
LinkMode = BuiltSharedLibs ? LinkModeShared : LinkModeAuto;
|
|
16
debian/patches/libclc-fix-prepare_builtins-rpath.diff
vendored
Normal file
16
debian/patches/libclc-fix-prepare_builtins-rpath.diff
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
set rpath for prepare_builtins build utility to find correct stage2
|
||||||
|
libs at runtime when executed as part of a build
|
||||||
|
Index: llvm-toolchain-12_12.0.1/libclc/CMakeLists.txt
|
||||||
|
===================================================================
|
||||||
|
--- llvm-toolchain-12_12.0.1.orig/libclc/CMakeLists.txt
|
||||||
|
+++ llvm-toolchain-12_12.0.1/libclc/CMakeLists.txt
|
||||||
|
@@ -139,6 +139,9 @@ target_compile_options( prepare_builtins
|
||||||
|
target_compile_definitions( prepare_builtins PRIVATE ${LLVM_VERSION_DEFINE} )
|
||||||
|
target_link_libraries( prepare_builtins PRIVATE ${LLVM_LIBS} )
|
||||||
|
target_link_libraries( prepare_builtins PRIVATE ${LLVM_SYSTEM_LIBS} )
|
||||||
|
+set_target_properties( prepare_builtins
|
||||||
|
+ PROPERTIES INSTALL_RPATH "${LLVM_LIBDIR}"
|
||||||
|
+ BUILD_WITH_INSTALL_RPATH "ON")
|
||||||
|
|
||||||
|
# Setup arch devices
|
||||||
|
set( r600--_devices cedar cypress barts cayman )
|
24
debian/patches/libcxx-libatomic-only-with-gcc-rtlib.diff
vendored
Normal file
24
debian/patches/libcxx-libatomic-only-with-gcc-rtlib.diff
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
if libatomic is found only link it if libgcc is the rtlib
|
||||||
|
Index: llvm-toolchain-12_12.0.1/libcxx/CMakeLists.txt
|
||||||
|
===================================================================
|
||||||
|
--- llvm-toolchain-12_12.0.1.orig/libcxx/CMakeLists.txt
|
||||||
|
+++ llvm-toolchain-12_12.0.1/libcxx/CMakeLists.txt
|
||||||
|
@@ -756,12 +756,14 @@ function(cxx_link_system_libraries targe
|
||||||
|
endif()
|
||||||
|
elseif (LIBCXX_HAS_GCC_LIB)
|
||||||
|
target_link_libraries(${target} PRIVATE gcc)
|
||||||
|
+ if (LIBCXX_HAS_ATOMIC_LIB)
|
||||||
|
+ target_link_libraries(${target} PRIVATE atomic)
|
||||||
|
+ endif()
|
||||||
|
elseif (LIBCXX_HAS_GCC_S_LIB)
|
||||||
|
target_link_libraries(${target} PRIVATE gcc_s)
|
||||||
|
- endif()
|
||||||
|
-
|
||||||
|
- if (LIBCXX_HAS_ATOMIC_LIB)
|
||||||
|
- target_link_libraries(${target} PRIVATE atomic)
|
||||||
|
+ if (LIBCXX_HAS_ATOMIC_LIB)
|
||||||
|
+ target_link_libraries(${target} PRIVATE atomic)
|
||||||
|
+ endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (MINGW)
|
32
debian/patches/lld-use-link-atomic-i386.diff
vendored
32
debian/patches/lld-use-link-atomic-i386.diff
vendored
@ -1,32 +0,0 @@
|
|||||||
Index: llvm-toolchain-snapshot_12~++20201021061106+4b7dafd9046/lld/tools/lld/CMakeLists.txt
|
|
||||||
===================================================================
|
|
||||||
--- llvm-toolchain-snapshot_12~++20201021061106+4b7dafd9046.orig/lld/tools/lld/CMakeLists.txt
|
|
||||||
+++ llvm-toolchain-snapshot_12~++20201021061106+4b7dafd9046/lld/tools/lld/CMakeLists.txt
|
|
||||||
@@ -1,10 +1,18 @@
|
|
||||||
+set(LLD_ATOMIC_LIB "")
|
|
||||||
+
|
|
||||||
set(LLVM_LINK_COMPONENTS
|
|
||||||
Support
|
|
||||||
)
|
|
||||||
|
|
||||||
+if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i386" OR
|
|
||||||
+ CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i686" OR
|
|
||||||
+ CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64"
|
|
||||||
+ )
|
|
||||||
+ list(APPEND LLD_ATOMIC_LIB "atomic")
|
|
||||||
+endif()
|
|
||||||
+
|
|
||||||
add_lld_tool(lld
|
|
||||||
lld.cpp
|
|
||||||
-
|
|
||||||
SUPPORT_PLUGINS
|
|
||||||
)
|
|
||||||
export_executable_symbols_for_plugins(lld)
|
|
||||||
@@ -18,6 +26,7 @@ target_link_libraries(lld
|
|
||||||
lldMachO2
|
|
||||||
lldMinGW
|
|
||||||
lldWasm
|
|
||||||
+ ${LLD_ATOMIC_LIB}
|
|
||||||
)
|
|
||||||
|
|
||||||
install(TARGETS lld
|
|
15
debian/patches/llvm-fix-lld-linker-check.diff
vendored
Normal file
15
debian/patches/llvm-fix-lld-linker-check.diff
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
remove regex anchor in lld linker detection to account for vendor, if
|
||||||
|
specified, being prepended to lld version string
|
||||||
|
Index: llvm-toolchain-12_12.0.1/llvm/cmake/modules/AddLLVM.cmake
|
||||||
|
===================================================================
|
||||||
|
--- llvm-toolchain-12_12.0.1.orig/llvm/cmake/modules/AddLLVM.cmake
|
||||||
|
+++ llvm-toolchain-12_12.0.1/llvm/cmake/modules/AddLLVM.cmake
|
||||||
|
@@ -196,7 +196,7 @@ if (NOT DEFINED LLVM_LINKER_DETECTED)
|
||||||
|
set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
|
||||||
|
set(LLVM_LINKER_IS_GOLD YES CACHE INTERNAL "")
|
||||||
|
message(STATUS "Linker detection: GNU Gold")
|
||||||
|
- elseif("${stdout}" MATCHES "^LLD")
|
||||||
|
+ elseif("${stdout}" MATCHES "LLD")
|
||||||
|
set(LLVM_LINKER_DETECTED YES CACHE INTERNAL "")
|
||||||
|
set(LLVM_LINKER_IS_LLD YES CACHE INTERNAL "")
|
||||||
|
message(STATUS "Linker detection: LLD")
|
162
debian/patches/openmp-fix-runtimes-build.diff
vendored
Normal file
162
debian/patches/openmp-fix-runtimes-build.diff
vendored
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
include required runtimes as dependencies to openmp targets to make sure
|
||||||
|
they are built first when included as part of a runtimes build since openmp
|
||||||
|
can depend on them
|
||||||
|
Index: llvm-toolchain-12_12.0.1/llvm/runtimes/CMakeLists.txt
|
||||||
|
===================================================================
|
||||||
|
--- llvm-toolchain-12_12.0.1.orig/llvm/runtimes/CMakeLists.txt
|
||||||
|
+++ llvm-toolchain-12_12.0.1/llvm/runtimes/CMakeLists.txt
|
||||||
|
@@ -236,6 +236,7 @@ function(runtime_default_target)
|
||||||
|
-DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE}
|
||||||
|
-DLLVM_ENABLE_PROJECTS_USED=${LLVM_ENABLE_PROJECTS_USED}
|
||||||
|
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default}
|
||||||
|
+ -DCMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}
|
||||||
|
-DCMAKE_C_COMPILER_TARGET=${TARGET_TRIPLE}
|
||||||
|
-DCMAKE_CXX_COMPILER_TARGET=${TARGET_TRIPLE}
|
||||||
|
-DCMAKE_ASM_COMPILER_TARGET=${TARGET_TRIPLE}
|
||||||
|
@@ -440,7 +441,7 @@ if(runtimes)
|
||||||
|
# build directory cannot find the C++ headers in certain configurations.
|
||||||
|
# I need to build a mechanism for runtime projects to provide CMake code
|
||||||
|
# that executes at LLVM configuration time to handle this case.
|
||||||
|
- add_dependencies(clang-bootstrap-deps runtimes-configure)
|
||||||
|
+ #add_dependencies(clang-bootstrap-deps runtimes-configure)
|
||||||
|
# We need to add the runtimes as a dependency because compiler-rt can be
|
||||||
|
# built as part of runtimes and we need the profile runtime for PGO
|
||||||
|
add_dependencies(clang-bootstrap-deps runtimes)
|
||||||
|
Index: llvm-toolchain-12_12.0.1/openmp/CMakeLists.txt
|
||||||
|
===================================================================
|
||||||
|
--- llvm-toolchain-12_12.0.1.orig/openmp/CMakeLists.txt
|
||||||
|
+++ llvm-toolchain-12_12.0.1/openmp/CMakeLists.txt
|
||||||
|
@@ -83,6 +83,28 @@ option(OPENMP_ENABLE_LIBOMPTARGET_PROFIL
|
||||||
|
${ENABLE_LIBOMPTARGET})
|
||||||
|
option(OPENMP_ENABLE_LIBOMP_PROFILING "Enable time profiling for libomp." OFF)
|
||||||
|
|
||||||
|
+option(OPENMP_USE_LLVM_UNWINDER "Build and use the LLVM unwinder" OFF)
|
||||||
|
+
|
||||||
|
+option(LIBOMP_ENABLE_RTTI "Enabling RTTI forces libomp to be a c++ lib" ${LLVM_ENABLE_RTTI})
|
||||||
|
+
|
||||||
|
+macro(add_runtimes_build_depends_if_needed target)
|
||||||
|
+ if(RUNTIMES_BUILD)
|
||||||
|
+ # required for rtti and libomp/libomptarget profiling if enabled
|
||||||
|
+ add_dependencies(${target} cxx-headers cxxabi_static cxx_static cxxabi_shared cxx_shared)
|
||||||
|
+ if(OPENMP_USE_LLVM_UNWINDER AND (NOT target STREQUAL "omp" AND NOT LIBOMP_ENABLE_RTTI))
|
||||||
|
+ add_dependencies(${target} unwind_static unwind_shared)
|
||||||
|
+ get_target_property(target_link_flags ${target} LINK_FLAGS)
|
||||||
|
+ set(runtimes_link_flags "-lunwind")
|
||||||
|
+ if(target_link_flags)
|
||||||
|
+ set(runtimes_link_flags "${target_link_flags} -lunwind")
|
||||||
|
+ endif()
|
||||||
|
+ set_target_properties(${target}
|
||||||
|
+ PROPERTIES
|
||||||
|
+ LINK_FLAGS "${runtimes_link_flags}")
|
||||||
|
+ endif()
|
||||||
|
+ endif()
|
||||||
|
+endmacro()
|
||||||
|
+
|
||||||
|
# Build host runtime library, after LIBOMPTARGET variables are set since they are needed
|
||||||
|
# to enable time profiling support in the OpenMP runtime.
|
||||||
|
add_subdirectory(runtime)
|
||||||
|
Index: llvm-toolchain-12_12.0.1/openmp/cmake/HandleOpenMPOptions.cmake
|
||||||
|
===================================================================
|
||||||
|
--- llvm-toolchain-12_12.0.1.orig/openmp/cmake/HandleOpenMPOptions.cmake
|
||||||
|
+++ llvm-toolchain-12_12.0.1/openmp/cmake/HandleOpenMPOptions.cmake
|
||||||
|
@@ -29,7 +29,8 @@ append_if(OPENMP_HAVE_WNO_EXTRA_FLAG "-W
|
||||||
|
append_if(OPENMP_HAVE_WNO_PEDANTIC_FLAG "-Wno-pedantic" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||||
|
append_if(OPENMP_HAVE_WNO_MAYBE_UNINITIALIZED_FLAG "-Wno-maybe-uninitialized" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||||
|
|
||||||
|
-append_if(OPENMP_HAVE_STD_GNUPP14_FLAG "-std=gnu++14" CMAKE_CXX_FLAGS)
|
||||||
|
-if (NOT OPENMP_HAVE_STD_GNUPP14_FLAG)
|
||||||
|
- append_if(OPENMP_HAVE_STD_CPP14_FLAG "-std=c++14" CMAKE_CXX_FLAGS)
|
||||||
|
+# prefer c++14 over gnu++14?
|
||||||
|
+append_if(OPENMP_HAVE_STD_CPP14_FLAG "-std=c++14" CMAKE_CXX_FLAGS)
|
||||||
|
+if (NOT OPENMP_HAVE_STD_CPP14_FLAG)
|
||||||
|
+ append_if(OPENMP_HAVE_STD_GNUPP14_FLAG "-std=gnu++14" CMAKE_CXX_FLAGS)
|
||||||
|
endif()
|
||||||
|
Index: llvm-toolchain-12_12.0.1/openmp/libomptarget/plugins/CMakeLists.txt
|
||||||
|
===================================================================
|
||||||
|
--- llvm-toolchain-12_12.0.1.orig/openmp/libomptarget/plugins/CMakeLists.txt
|
||||||
|
+++ llvm-toolchain-12_12.0.1/openmp/libomptarget/plugins/CMakeLists.txt
|
||||||
|
@@ -36,6 +36,8 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tma
|
||||||
|
add_library("omptarget.rtl.${tmachine_libname}" SHARED
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../generic-elf-64bit/src/rtl.cpp)
|
||||||
|
|
||||||
|
+ add_runtimes_build_depends_if_needed("omptarget.rtl.${tmachine_libname}")
|
||||||
|
+
|
||||||
|
# Install plugin under the lib destination folder.
|
||||||
|
install(TARGETS "omptarget.rtl.${tmachine_libname}"
|
||||||
|
LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}")
|
||||||
|
Index: llvm-toolchain-12_12.0.1/openmp/libomptarget/plugins/cuda/CMakeLists.txt
|
||||||
|
===================================================================
|
||||||
|
--- llvm-toolchain-12_12.0.1.orig/openmp/libomptarget/plugins/cuda/CMakeLists.txt
|
||||||
|
+++ llvm-toolchain-12_12.0.1/openmp/libomptarget/plugins/cuda/CMakeLists.txt
|
||||||
|
@@ -44,6 +44,8 @@ else()
|
||||||
|
set (LIBOMPTARGET_DEP_LIBRARIES ${CMAKE_DL_LIBS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
+add_runtimes_build_depends_if_needed(omptarget.rtl.cuda)
|
||||||
|
+
|
||||||
|
# Install plugin under the lib destination folder.
|
||||||
|
install(TARGETS omptarget.rtl.cuda LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}")
|
||||||
|
|
||||||
|
Index: llvm-toolchain-12_12.0.1/openmp/libomptarget/src/CMakeLists.txt
|
||||||
|
===================================================================
|
||||||
|
--- llvm-toolchain-12_12.0.1.orig/openmp/libomptarget/src/CMakeLists.txt
|
||||||
|
+++ llvm-toolchain-12_12.0.1/openmp/libomptarget/src/CMakeLists.txt
|
||||||
|
@@ -48,6 +48,8 @@ set_target_properties(omptarget
|
||||||
|
PROPERTIES
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY ${LIBOMPTARGET_LIBRARY_DIR})
|
||||||
|
|
||||||
|
+add_runtimes_build_depends_if_needed(omptarget)
|
||||||
|
+
|
||||||
|
# Install libomptarget under the lib destination folder.
|
||||||
|
install(TARGETS omptarget LIBRARY COMPONENT omptarget
|
||||||
|
DESTINATION "${OPENMP_INSTALL_LIBDIR}")
|
||||||
|
Index: llvm-toolchain-12_12.0.1/openmp/runtime/CMakeLists.txt
|
||||||
|
===================================================================
|
||||||
|
--- llvm-toolchain-12_12.0.1.orig/openmp/runtime/CMakeLists.txt
|
||||||
|
+++ llvm-toolchain-12_12.0.1/openmp/runtime/CMakeLists.txt
|
||||||
|
@@ -287,6 +287,10 @@ if(LIBOMP_STATS)
|
||||||
|
set(LIBOMP_USE_STDCPPLIB TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
+if(LIBOMP_ENABLE_RTTI)
|
||||||
|
+ set(LIBOMP_USE_STDCPPLIB TRUE)
|
||||||
|
+endif()
|
||||||
|
+
|
||||||
|
# Shared library can be switched to a static library
|
||||||
|
set(LIBOMP_ENABLE_SHARED TRUE CACHE BOOL
|
||||||
|
"Shared library instead of static library?")
|
||||||
|
Index: llvm-toolchain-12_12.0.1/openmp/runtime/src/CMakeLists.txt
|
||||||
|
===================================================================
|
||||||
|
--- llvm-toolchain-12_12.0.1.orig/openmp/runtime/src/CMakeLists.txt
|
||||||
|
+++ llvm-toolchain-12_12.0.1/openmp/runtime/src/CMakeLists.txt
|
||||||
|
@@ -134,6 +134,7 @@ endif()
|
||||||
|
if(NOT ${LIBOMP_USE_STDCPPLIB})
|
||||||
|
set(LIBOMP_LINKER_LANGUAGE C)
|
||||||
|
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES)
|
||||||
|
+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++")
|
||||||
|
else()
|
||||||
|
set(LIBOMP_LINKER_LANGUAGE CXX)
|
||||||
|
endif()
|
||||||
|
@@ -162,6 +163,8 @@ set_target_properties(omp PROPERTIES
|
||||||
|
LINKER_LANGUAGE ${LIBOMP_LINKER_LANGUAGE}
|
||||||
|
)
|
||||||
|
|
||||||
|
+add_runtimes_build_depends_if_needed(omp)
|
||||||
|
+
|
||||||
|
# Get the library's location within the build tree for the unit tester
|
||||||
|
if(NOT WIN32)
|
||||||
|
get_target_property(LIBOMP_LIBRARY_DIR omp LIBRARY_OUTPUT_DIRECTORY)
|
||||||
|
Index: llvm-toolchain-12_12.0.1/openmp/tools/archer/CMakeLists.txt
|
||||||
|
===================================================================
|
||||||
|
--- llvm-toolchain-12_12.0.1.orig/openmp/tools/archer/CMakeLists.txt
|
||||||
|
+++ llvm-toolchain-12_12.0.1/openmp/tools/archer/CMakeLists.txt
|
||||||
|
@@ -14,6 +14,9 @@ if(LIBOMP_OMPT_SUPPORT)
|
||||||
|
add_library(archer SHARED ompt-tsan.cpp)
|
||||||
|
add_library(archer_static STATIC ompt-tsan.cpp)
|
||||||
|
|
||||||
|
+ add_runtimes_build_depends_if_needed(archer)
|
||||||
|
+ add_runtimes_build_depends_if_needed(archer_static)
|
||||||
|
+
|
||||||
|
install(TARGETS archer archer_static
|
||||||
|
LIBRARY DESTINATION ${OPENMP_INSTALL_LIBDIR}
|
||||||
|
ARCHIVE DESTINATION ${OPENMP_INSTALL_LIBDIR})
|
10
debian/patches/series
vendored
10
debian/patches/series
vendored
@ -27,7 +27,6 @@ do-not-fail-on-unexpected-pass.diff
|
|||||||
disable-display-PASS-UNSUPPORTED-XFAIL.diff
|
disable-display-PASS-UNSUPPORTED-XFAIL.diff
|
||||||
|
|
||||||
# llvm-config
|
# llvm-config
|
||||||
fix-llvm-config-obj-src-root.patch
|
|
||||||
0001-llvm-cmake-resolve-symlinks-in-LLVMConfig.cmake.patch
|
0001-llvm-cmake-resolve-symlinks-in-LLVMConfig.cmake.patch
|
||||||
|
|
||||||
# Lib names
|
# Lib names
|
||||||
@ -126,9 +125,6 @@ risc/clang-riscv64-multiarch.diff
|
|||||||
sparc/sparc-D98574-clang-def.patch
|
sparc/sparc-D98574-clang-def.patch
|
||||||
sparc/sparc-D98575-compiler-rt.patch
|
sparc/sparc-D98575-compiler-rt.patch
|
||||||
|
|
||||||
# Compiler-rt - workaround
|
|
||||||
workaround-bug-42994-use-linker.diff
|
|
||||||
|
|
||||||
# bug 939472
|
# bug 939472
|
||||||
#try-to-unbreak-thinlto.diff
|
#try-to-unbreak-thinlto.diff
|
||||||
#D67877-cmake-clang-example.patch
|
#D67877-cmake-clang-example.patch
|
||||||
@ -138,7 +134,6 @@ x86-fuzzer.patch
|
|||||||
python3-shebang.patch
|
python3-shebang.patch
|
||||||
print-lldb-path.patch
|
print-lldb-path.patch
|
||||||
libcxx-armhf-ftbfs.diff
|
libcxx-armhf-ftbfs.diff
|
||||||
lld-use-link-atomic-i386.diff
|
|
||||||
#bring-reporter-back.patch
|
#bring-reporter-back.patch
|
||||||
D99501-ignore-lto-auto.diff
|
D99501-ignore-lto-auto.diff
|
||||||
scan-build-py-fix-analyze-path.diff
|
scan-build-py-fix-analyze-path.diff
|
||||||
@ -146,3 +141,8 @@ scan-build-py-fix-default-bin.diff
|
|||||||
|
|
||||||
libclc-llvm-spirv.diff
|
libclc-llvm-spirv.diff
|
||||||
omp-riscv64.patch
|
omp-riscv64.patch
|
||||||
|
llvm-fix-lld-linker-check.diff
|
||||||
|
compilerrt-fix-warn-xray-testing.diff
|
||||||
|
openmp-fix-runtimes-build.diff
|
||||||
|
libclc-fix-prepare_builtins-rpath.diff
|
||||||
|
libcxx-libatomic-only-with-gcc-rtlib.diff
|
||||||
|
20
debian/patches/symbolizer-path.diff
vendored
20
debian/patches/symbolizer-path.diff
vendored
@ -1,7 +1,7 @@
|
|||||||
Index: llvm-toolchain-snapshot_11~++20200326111000+4673699a470/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
|
Index: llvm-toolchain-12_12.0.1/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
|
||||||
===================================================================
|
===================================================================
|
||||||
--- llvm-toolchain-snapshot_11~++20200326111000+4673699a470.orig/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
|
--- llvm-toolchain-12_12.0.1.orig/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
|
||||||
+++ llvm-toolchain-snapshot_11~++20200326111000+4673699a470/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
|
+++ llvm-toolchain-12_12.0.1/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
|
||||||
@@ -25,6 +25,10 @@
|
@@ -25,6 +25,10 @@
|
||||||
#include "sanitizer_symbolizer_internal.h"
|
#include "sanitizer_symbolizer_internal.h"
|
||||||
#include "sanitizer_symbolizer_libbacktrace.h"
|
#include "sanitizer_symbolizer_libbacktrace.h"
|
||||||
@ -13,7 +13,7 @@ Index: llvm-toolchain-snapshot_11~++20200326111000+4673699a470/compiler-rt/lib/s
|
|||||||
|
|
||||||
#include <dlfcn.h> // for dlsym()
|
#include <dlfcn.h> // for dlsym()
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -428,7 +432,7 @@ static SymbolizerTool *ChooseExternalSym
|
@@ -433,7 +437,7 @@ static SymbolizerTool *ChooseExternalSym
|
||||||
return new(*allocator) AtosSymbolizer(found_path, allocator);
|
return new(*allocator) AtosSymbolizer(found_path, allocator);
|
||||||
}
|
}
|
||||||
#endif // SANITIZER_MAC
|
#endif // SANITIZER_MAC
|
||||||
@ -22,3 +22,15 @@ Index: llvm-toolchain-snapshot_11~++20200326111000+4673699a470/compiler-rt/lib/s
|
|||||||
VReport(2, "Using llvm-symbolizer found at: %s\n", found_path);
|
VReport(2, "Using llvm-symbolizer found at: %s\n", found_path);
|
||||||
return new(*allocator) LLVMSymbolizer(found_path, allocator);
|
return new(*allocator) LLVMSymbolizer(found_path, allocator);
|
||||||
}
|
}
|
||||||
|
Index: llvm-toolchain-12_12.0.1/compiler-rt/lib/sanitizer_common/CMakeLists.txt
|
||||||
|
===================================================================
|
||||||
|
--- llvm-toolchain-12_12.0.1.orig/compiler-rt/lib/sanitizer_common/CMakeLists.txt
|
||||||
|
+++ llvm-toolchain-12_12.0.1/compiler-rt/lib/sanitizer_common/CMakeLists.txt
|
||||||
|
@@ -195,6 +195,7 @@ set(SANITIZER_IMPL_HEADERS
|
||||||
|
)
|
||||||
|
|
||||||
|
include_directories(..)
|
||||||
|
+include_directories(${LLVM_INCLUDE_DIR})
|
||||||
|
|
||||||
|
set(SANITIZER_COMMON_DEFINITIONS
|
||||||
|
HAVE_RPC_XDR_H=${HAVE_RPC_XDR_H})
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
Index: llvm-toolchain-snapshot_11~++20200326111000+4673699a470/compiler-rt/lib/hwasan/CMakeLists.txt
|
|
||||||
===================================================================
|
|
||||||
--- llvm-toolchain-snapshot_11~++20200326111000+4673699a470.orig/compiler-rt/lib/hwasan/CMakeLists.txt
|
|
||||||
+++ llvm-toolchain-snapshot_11~++20200326111000+4673699a470/compiler-rt/lib/hwasan/CMakeLists.txt
|
|
||||||
@@ -43,9 +43,9 @@ append_list_if(COMPILER_RT_HWASAN_WITH_I
|
|
||||||
|
|
||||||
set(HWASAN_RTL_CFLAGS ${SANITIZER_COMMON_CFLAGS})
|
|
||||||
append_rtti_flag(OFF HWASAN_RTL_CFLAGS)
|
|
||||||
-append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC HWASAN_RTL_CFLAGS)
|
|
||||||
+append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC -fuse-ld=gold HWASAN_RTL_CFLAGS)
|
|
||||||
# Prevent clang from generating libc calls.
|
|
||||||
-append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding HWASAN_RTL_CFLAGS)
|
|
||||||
+append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding -fuse-ld=gold HWASAN_RTL_CFLAGS)
|
|
||||||
|
|
||||||
set(HWASAN_DYNAMIC_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})
|
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ if(ANDROID)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
-set(HWASAN_DYNAMIC_CFLAGS ${HWASAN_RTL_CFLAGS})
|
|
||||||
+set(HWASAN_DYNAMIC_CFLAGS ${HWASAN_RTL_CFLAGS} -fuse-ld=gold)
|
|
||||||
append_list_if(COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC
|
|
||||||
-ftls-model=initial-exec HWASAN_DYNAMIC_CFLAGS)
|
|
||||||
append_list_if(MSVC /DEBUG HWASAN_DYNAMIC_LINK_FLAGS)
|
|
||||||
@@ -132,7 +132,7 @@ foreach(arch ${HWASAN_SUPPORTED_ARCH})
|
|
||||||
LIBS clang_rt.hwasan-${arch} clang_rt.hwasan_cxx-${arch}
|
|
||||||
EXTRA hwasan.syms.extra)
|
|
||||||
set(VERSION_SCRIPT_FLAG
|
|
||||||
- -Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/clang_rt.hwasan-dynamic-${arch}.vers)
|
|
||||||
+ -Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/clang_rt.hwasan-dynamic-${arch}.vers -fuse-ld=gold)
|
|
||||||
set_property(SOURCE
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp
|
|
||||||
APPEND PROPERTY
|
|
5
debian/qualify-clang.sh
vendored
5
debian/qualify-clang.sh
vendored
@ -1412,8 +1412,9 @@ echo "Testing all other sanitizers ..."
|
|||||||
echo "int main() { return 1; }" > foo.c
|
echo "int main() { return 1; }" > foo.c
|
||||||
# fails to run on i386 with the following error:
|
# fails to run on i386 with the following error:
|
||||||
#clang: error: unsupported option '-fsanitize=efficiency-working-set' for target 'i686-pc-linux-gnu'
|
#clang: error: unsupported option '-fsanitize=efficiency-working-set' for target 'i686-pc-linux-gnu'
|
||||||
clang-$VERSION -fsanitize=efficiency-working-set -o foo foo.c || true
|
# seems like esan was removed from clang: https://github.com/llvm/llvm-project/commit/885b790f89b6068ec4caad8eaa51aa8098327059
|
||||||
./foo &> /dev/null || true
|
#clang-$VERSION -fsanitize=efficiency-working-set -o foo foo.c || true
|
||||||
|
#./foo &> /dev/null || true
|
||||||
|
|
||||||
cat > "$TEMPDIR/test.c" <<EOF
|
cat > "$TEMPDIR/test.c" <<EOF
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
330
debian/rules
vendored
330
debian/rules
vendored
@ -1,7 +1,9 @@
|
|||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
# polly, openmp & lldb aren't enabled for every platform
|
# polly & lldb aren't enabled for every platform
|
||||||
PROJECTS = clang;clang-tools-extra;libcxx;libcxxabi;compiler-rt;lld;debuginfo-tests
|
PROJECTS = clang;clang-tools-extra;lld;debuginfo-tests
|
||||||
|
# openmp & libunwind aren't enabled for every platform
|
||||||
|
RUNTIMES = compiler-rt;libcxx;libcxxabi
|
||||||
|
|
||||||
TARGET_BUILD := build-llvm
|
TARGET_BUILD := build-llvm
|
||||||
TARGET_BUILD_STAGE2 := $(TARGET_BUILD)/tools/clang/stage2-bins
|
TARGET_BUILD_STAGE2 := $(TARGET_BUILD)/tools/clang/stage2-bins
|
||||||
@ -40,17 +42,24 @@ CXXFLAGS_EXTRA =
|
|||||||
CFLAGS_EXTRA =
|
CFLAGS_EXTRA =
|
||||||
CONFIGURE_EXTRA =
|
CONFIGURE_EXTRA =
|
||||||
CMAKE_EXTRA = -DPYTHON_EXECUTABLE=/usr/bin/python3
|
CMAKE_EXTRA = -DPYTHON_EXECUTABLE=/usr/bin/python3
|
||||||
CMAKE_LIBCXX_EXTRA =
|
STAGE1_CMAKE_EXTRA =
|
||||||
|
# prepend bootstrap prefix to CMAKE_EXTRA vars
|
||||||
|
BOOTSTRAP_CMAKE_EXTRA = $(foreach extra,$(CMAKE_EXTRA), $(subst -D,-DBOOTSTRAP_,$(extra)))
|
||||||
|
|
||||||
BASE_PATH := $(CURDIR)
|
BASE_PATH := $(CURDIR)
|
||||||
LIBCXX_EXCEPTIONS :=ON
|
STAGE1_BIN_DIR := $(BASE_PATH)/$(TARGET_BUILD)/bin
|
||||||
|
STAGE1_LIB_DIR := $(BASE_PATH)/$(TARGET_BUILD)/lib
|
||||||
|
STAGE2_BIN_DIR := $(BASE_PATH)/$(TARGET_BUILD_STAGE2)/bin
|
||||||
|
STAGE2_LIB_DIR := $(BASE_PATH)/$(TARGET_BUILD_STAGE2)/lib
|
||||||
|
|
||||||
|
LIBCXX_EXCEPTIONS := ON
|
||||||
ifneq (,$(filter $(DEB_HOST_ARCH),s390x))
|
ifneq (,$(filter $(DEB_HOST_ARCH),s390x))
|
||||||
LIBCXX_EXCEPTIONS :=OFF
|
LIBCXX_EXCEPTIONS :=OFF
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter $(DEB_HOST_ARCH),i386 armel mips mipsel powerpc powerpcspe riscv64))
|
ifneq (,$(filter $(DEB_HOST_ARCH),i386 armel mips mipsel powerpc powerpcspe riscv64))
|
||||||
CMAKE_EXTRA += -DLIBOMP_LIBFLAGS="-latomic" -DCMAKE_SHARED_LINKER_FLAGS="-latomic"
|
CMAKE_EXTRA += -DCMAKE_SHARED_LINKER_FLAGS="-latomic"
|
||||||
|
STAGE1_CMAKE_EXTRA += -DCMAKE_SHARED_LINKER_FLAGS="-latomic"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter $(DEB_HOST_ARCH),sparc sparc64))
|
ifneq (,$(filter $(DEB_HOST_ARCH),sparc sparc64))
|
||||||
@ -83,6 +92,7 @@ ifneq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)
|
|||||||
Z3_FLAG = -DLLVM_ENABLE_Z3_SOLVER=ON
|
Z3_FLAG = -DLLVM_ENABLE_Z3_SOLVER=ON
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
CMAKE_EXTRA += $(Z3_FLAG)
|
||||||
|
|
||||||
# Change the default CPU for s390x
|
# Change the default CPU for s390x
|
||||||
ZARCH=z196
|
ZARCH=z196
|
||||||
@ -101,23 +111,22 @@ ifneq (,$(findstring $(DEB_HOST_ARCH),armel))
|
|||||||
# 3.8 fails to build, disable the compiler_rt builtins
|
# 3.8 fails to build, disable the compiler_rt builtins
|
||||||
# See http://lists.llvm.org/pipermail/llvm-dev/2016-May/099761.html
|
# See http://lists.llvm.org/pipermail/llvm-dev/2016-May/099761.html
|
||||||
CMAKE_EXTRA += -DCOMPILER_RT_BUILD_BUILTINS=OFF
|
CMAKE_EXTRA += -DCOMPILER_RT_BUILD_BUILTINS=OFF
|
||||||
# Check for ancient libstdc++ fails due to atomics usage
|
STAGE1_CMAKE_EXTRA += -DCOMPILER_RT_BUILD_BUILTINS=OFF
|
||||||
CMAKE_LIBCXX_EXTRA += -DLLVM_COMPILER_CHECKED=ON
|
|
||||||
# Prevent clang from getting a > v4t default
|
# Prevent clang from getting a > v4t default
|
||||||
# See bug #868779
|
# See bug #868779
|
||||||
CMAKE_EXTRA += -DLLVM_HOST_TRIPLE=arm-linux-gnueabi
|
STAGE1_CMAKE_EXTRA += -DLLVM_HOST_TRIPLE=arm-linux-gnueabi
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
ifneq (,$(findstring $(DEB_HOST_ARCH),armhf))
|
ifneq (,$(findstring $(DEB_HOST_ARCH),armhf))
|
||||||
# avoid an issue with openmp on armhf
|
# avoid an issue with openmp on armhf
|
||||||
CMAKE_EXTRA += -DLLVM_HOST_TRIPLE=armv7l-unknown-linux-gnueabihf
|
STAGE1_CMAKE_EXTRA += -DLLVM_HOST_TRIPLE=armv7l-unknown-linux-gnueabihf
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter $(DEB_HOST_ARCH),mips64el))
|
ifneq (,$(filter $(DEB_HOST_ARCH),mips64el))
|
||||||
# avoid an issue with search path on mips64el
|
# avoid an issue with search path on mips64el
|
||||||
# https://bugs.llvm.org/show_bug.cgi?id=41204
|
# https://bugs.llvm.org/show_bug.cgi?id=41204
|
||||||
CMAKE_EXTRA += -DLLVM_HOST_TRIPLE=mips64el-linux-gnuabi64
|
STAGE1_CMAKE_EXTRA += -DLLVM_HOST_TRIPLE=mips64el-linux-gnuabi64
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@ -142,23 +151,11 @@ ifeq ($(LLVM_SPIRV_INSTALLED),yes)
|
|||||||
LIBCLC_TARGETS_TO_BUILD := $(LIBCLC_TARGETS_TO_BUILD)";spirv-mesa3d-;spirv64-mesa3d-"
|
LIBCLC_TARGETS_TO_BUILD := $(LIBCLC_TARGETS_TO_BUILD)";spirv-mesa3d-;spirv64-mesa3d-"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Disabled:
|
|
||||||
# Host compiler does not support '-fuse-ld=lld'
|
|
||||||
# USE_LLD_ARCHS := amd64
|
|
||||||
# ifneq (,$(filter $(DEB_HOST_ARCH),$(USE_LLD_ARCHS)))
|
|
||||||
# CMAKE_EXTRA += -DLLVM_ENABLE_LLD=ON
|
|
||||||
# endif
|
|
||||||
|
|
||||||
BINUTILS_GOLD_ARCHS := amd64 arm64 armhf i386 ppc64 ppc64el x32 s390x hurd-i386 kfreebsd-amd64 kfreebsd-i386
|
BINUTILS_GOLD_ARCHS := amd64 arm64 armhf i386 ppc64 ppc64el x32 s390x hurd-i386 kfreebsd-amd64 kfreebsd-i386
|
||||||
ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' binutils) ge 2.23.1-1~exp3 ; echo $$?),0)
|
ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' binutils) ge 2.23.1-1~exp3 ; echo $$?),0)
|
||||||
ifneq (,$(filter $(DEB_HOST_ARCH),$(BINUTILS_GOLD_ARCHS)))
|
ifneq (,$(filter $(DEB_HOST_ARCH),$(BINUTILS_GOLD_ARCHS)))
|
||||||
# -fused-ld=gold enables the gold linker (but is not supported by all archs / distro)
|
STAGE1_CMAKE_EXTRA += -DLLVM_USE_LINKER=gold
|
||||||
LDFLAGS_EXTRA += -fuse-ld=gold
|
STAGE1_CMAKE_EXTRA += -DLLVM_BINUTILS_INCDIR=/usr/include/
|
||||||
#--no-keep-files-mapped --no-map-whole-files
|
|
||||||
CXXFLAGS_EXTRA += -fuse-ld=gold
|
|
||||||
CFLAGS_EXTRA += -fuse-ld=gold
|
|
||||||
#-Wl,--no-keep-files-mapped -Wl,--no-map-whole-files
|
|
||||||
CMAKE_EXTRA += -DLLVM_BINUTILS_INCDIR=/usr/include/
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -175,11 +172,12 @@ ifneq (,$(filter codecoverage,$(DEB_BUILD_OPTIONS)))
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Enable for bootstrap
|
# Enable for bootstrap
|
||||||
LDFLAGS_EXTRA += -fPIC -Wno-unused-command-line-argument -Wno-unknown-warning-option -Wl,--build-id
|
CFLAGS_EXTRA += -Wno-unused-command-line-argument
|
||||||
CXXFLAGS_EXTRA += -fPIC -Wno-unused-command-line-argument -Wno-unknown-warning-option
|
CXXFLAGS_EXTRA += -Wno-unused-command-line-argument
|
||||||
BOOTSTRAP_CXXFLAGS_EXTRA = $(CXXFLAGS_EXTRA) # Nothing for now. Keeping in case we need it
|
LDFLAGS_EXTRA += -Wno-unused-command-line-argument -Wl,--build-id
|
||||||
CFLAGS_EXTRA += -fPIC -Wno-unused-command-line-argument -Wno-unknown-warning-option
|
BOOTSTRAP_CFLAGS_EXTRA = $(CFLAGS_EXTRA)
|
||||||
BOOTSTRAP_CFLAGS_EXTRA = $(CFLAGS_EXTRA) # Nothing for now. Keeping in case we need it
|
BOOTSTRAP_CXXFLAGS_EXTRA = $(CXXFLAGS_EXTRA)
|
||||||
|
BOOTSTRAP_LDFLAGS_EXTRA =
|
||||||
|
|
||||||
# Enable polly (or not)
|
# Enable polly (or not)
|
||||||
POLLY_ENABLE=yes
|
POLLY_ENABLE=yes
|
||||||
@ -189,22 +187,28 @@ else
|
|||||||
PROJECTS+=;polly
|
PROJECTS+=;polly
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Enable openmp (or not)
|
|
||||||
OPENMP_ENABLE=yes
|
|
||||||
ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel powerpc powerpcspe sparc64 s390x x32))
|
|
||||||
OPENMP_ENABLE=no
|
|
||||||
else
|
|
||||||
PROJECTS+=;openmp
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Enable libunwind (or not)
|
# Enable libunwind (or not)
|
||||||
LIBUNWIND_ENABLE=yes
|
LIBUNWIND_ENABLE=yes
|
||||||
ifneq (,$(filter $(DEB_HOST_ARCH), s390x armel mipsel hurd-i386 powerpc sparc sparc64 x32))
|
ifneq (,$(filter $(DEB_HOST_ARCH), s390x armel mipsel hurd-i386 powerpc sparc sparc64 x32))
|
||||||
LIBUNWIND_ENABLE=no
|
LIBUNWIND_ENABLE=no
|
||||||
else
|
else
|
||||||
PROJECTS += ;libunwind
|
RUNTIMES += ;libunwind
|
||||||
CMAKE_LIBCXX_EXTRA += -DLIBCXXABI_USE_LLVM_UNWINDER=ON \
|
# this is also added to stage2 via CLANG_BOOTSTRAP_PASSTHROUGH
|
||||||
-DLIBUNWIND_USE_COMPILER_RT=ON
|
STAGE1_CMAKE_EXTRA += -DLIBCXXABI_USE_LLVM_UNWINDER=ON
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Enable openmp (or not)
|
||||||
|
OPENMP_ENABLE=yes
|
||||||
|
ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel powerpc powerpcspe sparc64 s390x x32))
|
||||||
|
OPENMP_ENABLE=no
|
||||||
|
else
|
||||||
|
RUNTIMES+=;openmp
|
||||||
|
# this is also added to stage2 via CLANG_BOOTSTRAP_PASSTHROUGH
|
||||||
|
STAGE1_CMAKE_EXTRA += -DLIBOMP_LIBFLAGS="-lm"
|
||||||
|
ifeq ($(LIBUNWIND_ENABLE),yes)
|
||||||
|
# this is also added to stage2 via CLANG_BOOTSTRAP_PASSTHROUGH
|
||||||
|
STAGE1_CMAKE_EXTRA += -DOPENMP_USE_LLVM_UNWINDER=ON
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
RUN_TEST=yes
|
RUN_TEST=yes
|
||||||
@ -233,7 +237,8 @@ ifneq (,$(filter scan-build,$(DEB_BUILD_OPTIONS)))
|
|||||||
# no need to run tests in this case
|
# no need to run tests in this case
|
||||||
RUN_TEST=no
|
RUN_TEST=no
|
||||||
CONFIGURE_EXTRA += --enable-assertions
|
CONFIGURE_EXTRA += --enable-assertions
|
||||||
CMAKE_EXTRA += -DLLVM_ENABLE_ASSERTIONS=ON
|
# will also be applied to stage2 via CLANG_BOOTSTRAP_PASSTHROUGH
|
||||||
|
STAGE1_CMAKE_EXTRA += -DLLVM_ENABLE_ASSERTIONS=ON
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter coverity,$(DEB_BUILD_OPTIONS)))
|
ifneq (,$(filter coverity,$(DEB_BUILD_OPTIONS)))
|
||||||
@ -246,7 +251,8 @@ ifneq (,$(filter coverity,$(DEB_BUILD_OPTIONS)))
|
|||||||
PRE_PROCESS_CONF=
|
PRE_PROCESS_CONF=
|
||||||
COVERITY_ENABLE=1
|
COVERITY_ENABLE=1
|
||||||
CONFIGURE_EXTRA += --enable-assertions
|
CONFIGURE_EXTRA += --enable-assertions
|
||||||
CMAKE_EXTRA += -DLLVM_ENABLE_ASSERTIONS=ON
|
# will also be applied to stage2 via CLANG_BOOTSTRAP_PASSTHROUGH
|
||||||
|
STAGE1_CMAKE_EXTRA += -DLLVM_ENABLE_ASSERTIONS=ON
|
||||||
# no need to run tests in this case
|
# no need to run tests in this case
|
||||||
RUN_TEST=no
|
RUN_TEST=no
|
||||||
else
|
else
|
||||||
@ -270,7 +276,7 @@ LLD_ENABLE=yes
|
|||||||
|
|
||||||
ifneq (,$(filter $(DEB_HOST_ARCH_OS),linux))
|
ifneq (,$(filter $(DEB_HOST_ARCH_OS),linux))
|
||||||
# only for linux
|
# only for linux
|
||||||
CMAKE_EXTRA += -DLLVM_USE_PERF=yes -DLLVM_ENABLE_LIBPFM=ON
|
CMAKE_EXTRA += -DLLVM_USE_PERF=ON -DLLVM_ENABLE_LIBPFM=ON
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Only enable it for archs supporting gold
|
# Only enable it for archs supporting gold
|
||||||
@ -321,12 +327,15 @@ endif
|
|||||||
|
|
||||||
GENERATOR=Ninja
|
GENERATOR=Ninja
|
||||||
|
|
||||||
|
# enables cmake build targets like stage2-[target_name]
|
||||||
|
ENABLED_STAGE2_CMAKE_BUILD_TARGETS = check-all;check-llvm;check-clang;check-clang-tools;check-lld;check-libcxx;check-libcxxabi;check-sanitizer;llvm-config;test-suite
|
||||||
|
|
||||||
%:
|
%:
|
||||||
dh $@ $(DH_OPTIONS)
|
dh $@ $(DH_OPTIONS)
|
||||||
|
|
||||||
# For some reasons, some spaces are added, removing them
|
# For some reasons, some spaces are added, removing them
|
||||||
PROJECTS_LIST := $(shell echo "$(PROJECTS)"|sed -e "s| ||g")
|
PROJECTS_LIST := $(shell echo "$(PROJECTS)"|sed -e "s| ||g")
|
||||||
#RUNTIMES_LIST := $(shell echo "$(RUNTIMES)"|sed -e "s| ||g")
|
RUNTIMES_LIST := $(shell echo "$(RUNTIMES)"|sed -e "s| ||g")
|
||||||
|
|
||||||
preconfigure:
|
preconfigure:
|
||||||
|
|
||||||
@ -343,7 +352,7 @@ preconfigure:
|
|||||||
@echo "DISTRO=$(DISTRO)"
|
@echo "DISTRO=$(DISTRO)"
|
||||||
@echo "GCC_VERSION=$(GCC_VERSION)"
|
@echo "GCC_VERSION=$(GCC_VERSION)"
|
||||||
@echo "PROJECTS=$(PROJECTS_LIST)"
|
@echo "PROJECTS=$(PROJECTS_LIST)"
|
||||||
# @echo "RUNTIMES=$(RUNTIMES_LIST)"
|
@echo "RUNTIMES=$(RUNTIMES_LIST)"
|
||||||
@echo "LLVM_VERSION=$(LLVM_VERSION)"
|
@echo "LLVM_VERSION=$(LLVM_VERSION)"
|
||||||
@echo "LLVM_VERSION_FULL=$(LLVM_VERSION_FULL)"
|
@echo "LLVM_VERSION_FULL=$(LLVM_VERSION_FULL)"
|
||||||
@echo "LLVM_VERSION_SNAPSHOT=$(LLVM_VERSION_SNAPSHOT)"
|
@echo "LLVM_VERSION_SNAPSHOT=$(LLVM_VERSION_SNAPSHOT)"
|
||||||
@ -414,6 +423,14 @@ override_dh_auto_configure: preconfigure
|
|||||||
--xml-option append_arg:"replace/llvm::AlignOf<NextTy>::Alignment/(llvm::AlignOf<NextTy>::Alignment)"; \
|
--xml-option append_arg:"replace/llvm::AlignOf<NextTy>::Alignment/(llvm::AlignOf<NextTy>::Alignment)"; \
|
||||||
fi)
|
fi)
|
||||||
|
|
||||||
|
# Fails with No target "unwind_static"
|
||||||
|
# -DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON \
|
||||||
|
# -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY=OFF \
|
||||||
|
# -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY=ON \
|
||||||
|
#- to libc++ when libunwind is built
|
||||||
|
#- Matches what is done on brew:
|
||||||
|
#- https://bit.ly/3kDNpC9
|
||||||
|
|
||||||
echo "Running tests: $(RUN_TEST)"
|
echo "Running tests: $(RUN_TEST)"
|
||||||
echo "Using cmake: $(CMAKE_BIN)"; \
|
echo "Using cmake: $(CMAKE_BIN)"; \
|
||||||
CFLAGS="$(CFLAGS_EXTRA)" \
|
CFLAGS="$(CFLAGS_EXTRA)" \
|
||||||
@ -421,49 +438,92 @@ override_dh_auto_configure: preconfigure
|
|||||||
LDFLAGS="$(LDFLAGS_EXTRA)" \
|
LDFLAGS="$(LDFLAGS_EXTRA)" \
|
||||||
LD_LIBRARY_PATH=$$LD_LIBRARY_PATH $(PRE_PROCESS_CONF) $(CMAKE_BIN) -S llvm/ -B $(TARGET_BUILD) \
|
LD_LIBRARY_PATH=$$LD_LIBRARY_PATH $(PRE_PROCESS_CONF) $(CMAKE_BIN) -S llvm/ -B $(TARGET_BUILD) \
|
||||||
-G $(GENERATOR) \
|
-G $(GENERATOR) \
|
||||||
-DLLVM_ENABLE_PROJECTS="$(PROJECTS_LIST)" \
|
|
||||||
-DCMAKE_SUPPRESS_REGENERATION=ON \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-$(LLVM_VERSION) \
|
-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-$(LLVM_VERSION) \
|
||||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
-DCMAKE_SUPPRESS_REGENERATION=ON \
|
||||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(opt_flags)" \
|
-DPACKAGE_VENDOR=$(VENDOR) \
|
||||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
|
|
||||||
-DLLVM_LINK_LLVM_DYLIB=ON \
|
|
||||||
-DLLVM_INSTALL_UTILS=ON \
|
|
||||||
-DLLVM_VERSION_SUFFIX= \
|
|
||||||
-DLLVM_ENABLE_SPHINX=ON \
|
|
||||||
-DSPHINX_WARNINGS_AS_ERRORS=OFF \
|
|
||||||
-DLLVM_ENABLE_RTTI=ON \
|
|
||||||
-DLLVM_ENABLE_FFI=ON \
|
|
||||||
-DLLVM_ENABLE_DUMP=ON \
|
|
||||||
-DLIBCLANG_LIBRARY_VERSION=$(SONAME_EXT) \
|
|
||||||
-DCLANG_LINK_CLANG_DYLIB=ON \
|
|
||||||
-DENABLE_LINKER_BUILD_ID=ON \
|
-DENABLE_LINKER_BUILD_ID=ON \
|
||||||
-DCOMPILER_RT_USE_LIBCXX=NO \
|
-DLLVM_TARGETS_TO_BUILD=Native \
|
||||||
-DLIBUNWIND_USE_COMPILER_RT=ON \
|
-DLLVM_ENABLE_PROJECTS="$(PROJECTS_LIST)" \
|
||||||
$(Z3_FLAG) \
|
-DLLVM_ENABLE_RUNTIMES="$(RUNTIMES_LIST)" \
|
||||||
$(CMAKE_EXTRA) \
|
-DLLVM_ENABLE_PIC=ON \
|
||||||
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="AVR" \
|
-DLLVM_ENABLE_RTTI=ON \
|
||||||
|
-DLVVM_ENABLE_ZLIB=OFF \
|
||||||
|
-DLLVM_BUILD_DOCS=OFF \
|
||||||
|
-DLLVM_INCLUDE_GO_TESTS=OFF \
|
||||||
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
|
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
|
||||||
-DCLANG_VENDOR=$(VENDOR) \
|
-DCLANG_PLUGIN_SUPPORT=OFF \
|
||||||
-DCLANG_ENABLE_BOOTSTRAP=ON \
|
|
||||||
-DCLANG_BUILD_EXAMPLES=OFF \
|
-DCLANG_BUILD_EXAMPLES=OFF \
|
||||||
-DLLVM_POLLY_LINK_INTO_TOOLS=ON \
|
-DCLANG_DEFAULT_LINKER=ld \
|
||||||
-DBOOTSTRAP_CMAKE_CXX_FLAGS='$(BOOTSTRAP_CXXFLAGS_EXTRA)' \
|
-DCLANG_DEFAULT_CXX_STDLIB=libstdc++ \
|
||||||
-DBOOTSTRAP_CMAKE_C_FLAGS='$(BOOTSTRAP_CFLAGS_EXTRA)' \
|
-DCLANG_DEFAULT_RTLIB=libgcc \
|
||||||
-DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_VERBOSE_MAKEFILE;CMAKE_BUILD_TYPE;CMAKE_CXX_FLAGS_RELWITHDEBINFO;LLVM_LINK_LLVM_DYLIB;LLVM_INSTALL_UTILS;LLVM_VERSION_SUFFIX;LLVM_ENABLE_SPHINX;SPHINX_WARNINGS_AS_ERRORS;LLVM_BUILD_LLVM_DYLIB;LLVM_ENABLE_RTTI;LLVM_ENABLE_FFI;LIBCLANG_LIBRARY_VERSION;ENABLE_LINKER_BUILD_ID;POLLY_BUNDLED_JSONCPP;LLVM_EXPERIMENTAL_TARGETS_TO_BUILD;LLVM_USE_PERF;LLVM_ENABLE_ASSERTIONS;LLVM_BINUTILS_INCDIR;LLVM_HOST_TRIPLE;LLVM_COMPILER_CHECKED;COMPILER_RT_BUILD_BUILTINS;LIBOMP_LIBFLAGS;CMAKE_SHARED_LINKER_FLAGS;PYTHON_EXECUTABLE;LLVM_ENABLE_Z3_SOLVER;LLVM_POLLY_LINK_INTO_TOOLS;CLANG_VENDOR;LIBUNWIND_USE_COMPILER_RT"; \
|
-DCOMPILER_RT_BUILD_XRAY=OFF \
|
||||||
|
-DCOMPILER_RT_INCLUDE_TESTS=OFF \
|
||||||
|
-DCOMPILER_RT_USE_LIBCXX=NO \
|
||||||
|
-DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \
|
||||||
|
-DLIBUNWIND_ENABLE_SHARED=ON \
|
||||||
|
-DLIBUNWIND_USE_COMPILER_RT=ON \
|
||||||
|
-DLIBUNWIND_INSTALL_LIBRARY=OFF \
|
||||||
|
-DLIBCXXABI_ENABLE_SHARED=ON \
|
||||||
|
-DLIBCXXABI_USE_COMPILER_RT=ON \
|
||||||
|
-DLIBCXXABI_INSTALL_LIBRARY=OFF \
|
||||||
|
-DLIBCXX_ENABLE_SHARED=ON \
|
||||||
|
-DLIBCXX_USE_COMPILER_RT=ON \
|
||||||
|
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
|
||||||
|
-DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON \
|
||||||
|
-DLIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=OFF \
|
||||||
|
-DLIBCXX_INSTALL_LIBRARY=OFF \
|
||||||
|
-DOPENMP_ENABLE_LIBOMP_PROFILING=OFF \
|
||||||
|
-DOPENMP_ENABLE_LIBOMPTARGET_PROFILING=OFF \
|
||||||
|
-DLIBOMP_ENABLE_RTTI=OFF \
|
||||||
|
-DLIBOMP_OMPT_SUPPORT=OFF \
|
||||||
|
$(STAGE1_CMAKE_EXTRA) \
|
||||||
|
-DBUILTINS_CMAKE_ARGS="-DCMAKE_SYSTEM_NAME=Linux;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
|
||||||
|
-DRUNTIMES_CMAKE_ARGS="-DCMAKE_SYSTEM_NAME=Linux;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
|
||||||
|
-DCLANG_ENABLE_BOOTSTRAP=ON \
|
||||||
|
-DCLANG_BOOTSTRAP_TARGETS="$(ENABLED_STAGE2_CMAKE_BUILD_TARGETS)" \
|
||||||
|
-DBOOTSTRAP_CMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||||
|
-DBOOTSTRAP_CMAKE_C_FLAGS_RELWITHDEBINFO="$(opt_flags)" \
|
||||||
|
-DBOOTSTRAP_CMAKE_CXX_FLAGS_RELWITHDEBINFO="$(opt_flags)" \
|
||||||
|
-DBOOTSTRAP_CMAKE_CXX_FLAGS="$(BOOTSTRAP_CXXFLAGS_EXTRA)" \
|
||||||
|
-DBOOTSTRAP_CMAKE_C_FLAGS="$(BOOTSTRAP_CFLAGS_EXTRA)" \
|
||||||
|
-DBOOTSTRAP_CMAKE_SHARED_LINKER_FLAGS="$(BOOTSTRAP_LDFLAGS_EXTRA)" \
|
||||||
|
-DBOOTSTRAP_CMAKE_MODULE_LINKER_FLAGS="$(BOOTSTRAP_LDFLAGS_EXTRA)" \
|
||||||
|
-DBOOTSTRAP_CMAKE_EXE_LINKER_FLAGS="$(BOOTSTRAP_LDFLAGS_EXTRA)" \
|
||||||
|
-DBOOTSTRAP_LLVM_ENABLE_FFI=ON \
|
||||||
|
-DBOOTSTRAP_LLVM_ENABLE_DUMP=ON \
|
||||||
|
-DBOOTSTRAP_LLVM_ENABLE_LIBPFM=ON \
|
||||||
|
-DBOOTSTRAP_LLVM_ENABLE_SPHINX=ON \
|
||||||
|
-DBOOTSTRAP_SPHINX_WARNINGS_AS_ERRORS=OFF \
|
||||||
|
-DBOOTSTRAP_LLVM_USE_RELATIVE_PATHS_IN_FILES=ON \
|
||||||
|
-DBOOTSTRAP_LLVM_INSTALL_UTILS=ON \
|
||||||
|
-DBOOTSTRAP_LLVM_VERSION_SUFFIX= \
|
||||||
|
-DBOOTSTRAP_LLVM_POLLY_LINK_INTO_TOOLS=ON \
|
||||||
|
-DBOOTSTRAP_LLVM_EXPERIMENTAL_TARGETS_TO_BUILD="AVR" \
|
||||||
|
-DBOOTSTRAP_LLVM_LINK_LLVM_DYLIB=ON \
|
||||||
|
-DBOOTSTRAP_CLANG_LINK_CLANG_DYLIB=ON \
|
||||||
|
-DBOOTSTRAP_LIBCLANG_LIBRARY_VERSION=$(SONAME_EXT) \
|
||||||
|
-DBOOTSTRAP_LIBCXXABI_ENABLE_EXCEPTIONS=$(LIBCXX_EXCEPTIONS) \
|
||||||
|
-DBOOTSTRAP_LIBCXX_ENABLE_EXCEPTIONS=$(LIBCXX_EXCEPTIONS) \
|
||||||
|
-DBOOTSTRAP_LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON \
|
||||||
|
$(BOOTSTRAP_CMAKE_EXTRA) \
|
||||||
|
-DBOOTSTRAP_BUILTINS_CMAKE_ARGS="-DCMAKE_SYSTEM_NAME=Linux;-DCMAKE_BUILD_TYPE=RelWithDebInfo;-DCMAKE_C_FLAGS_RELWITHDEBINFO=$(opt_flags);-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=$(opt_flags);-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
|
||||||
|
-DBOOTSTRAP_RUNTIMES_CMAKE_ARGS="-DCMAKE_CXX_FLAGS=$(BOOTSTRAP_CXXFLAGS_EXTRA);-DCMAKE_EXE_LINKER_FLAGS=$(BOOTSTRAP_LDFLAGS_EXTRA) -L$(STAGE1_LIB_DIR);-DCMAKE_SHARED_LINKER_FLAGS=$(BOOTSTRAP_LDFLAGS_EXTRA) -L$(STAGE1_LIB_DIR);-DCMAKE_MODULE_LINKER_FLAGS=$(BOOTSTRAP_LDFLAGS_EXTRA) -L$(STAGE1_LIB_DIR);-DCMAKE_SYSTEM_NAME=Linux;-DCMAKE_BUILD_TYPE=RelWithDebInfo;-DCMAKE_C_FLAGS_RELWITHDEBINFO=$(opt_flags);-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=$(opt_flags);-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
|
||||||
|
-DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_SUPPRESS_REGENERATION;ENABLE_LINKER_BUILD_ID;LLVM_HOST_TRIPLE;LLVM_ENABLE_PIC;LLVM_ENABLE_RTTI;LLVM_ENABLE_ASSERTIONS;LLVM_INCLUDE_GO_TESTS;LLVM_BINUTILS_INCDIR;LLVM_USE_LINKER;CLANG_DEFAULT_LINKER;CLANG_DEFAULT_CXX_STDLIB;CLANG_DEFAULT_RTLIB;COMPILER_RT_USE_LIBCXX;COMPILER_RT_USE_BUILTINS_LIBRARY;COMPILER_RT_INCLUDE_TESTS;LIBUNWIND_ENABLE_SHARED;LIBCXXABI_ENABLE_SHARED;LIBCXXABI_USE_COMPILER_RT;LIBCXXABI_USE_LLVM_UNWINDER;LIBCXX_USE_COMPILER_RT;LIBCXX_ENABLE_SHARED;LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY;LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY;OPENMP_USE_LLVM_UNWINDER;LIBOMP_LIBFLAGS;LIBOMP_ENABLE_RTTI;PYTHON_EXECUTABLE"
|
||||||
FOUND_VERSION=`grep LLVM_VERSION_STRING build-llvm/include/llvm/Config/llvm-config.h|cut -d\" -f2`; \
|
FOUND_VERSION=`grep LLVM_VERSION_STRING build-llvm/include/llvm/Config/llvm-config.h|cut -d\" -f2`; \
|
||||||
if ! echo "$(LLVM_VERSION_FULL)"|grep "$$FOUND_VERSION"; then \
|
if ! echo "$(LLVM_VERSION_FULL)"|grep "$$FOUND_VERSION"; then \
|
||||||
echo "mistmatch of version. Found: $$FOUND_VERSION / Expected: $(LLVM_VERSION_FULL)"; \
|
echo "mistmatch of version. Found: $$FOUND_VERSION / Expected: $(LLVM_VERSION_FULL)"; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# ninja
|
# ninja
|
||||||
VERBOSE=-v
|
VERBOSE=-v
|
||||||
|
|
||||||
debian-full-build:
|
debian-full-build:
|
||||||
$(PRE_PROCESS) ninja $(NJOBS) -C $(TARGET_BUILD) $(VERBOSE) stage2
|
echo "Using cmake: $(CMAKE_BIN)"
|
||||||
|
# linker hack so stage2 can link against stage1 libs at runtime
|
||||||
|
LD_LIBRARY_PATH=$(STAGE1_LIB_DIR):$$LD_LIBRARY_PATH \
|
||||||
|
VERBOSE=1 $(PRE_PROCESS) $(CMAKE_BIN) --build $(TARGET_BUILD) $(NJOBS) --target stage2
|
||||||
|
|
||||||
# Check the stage 2 build worked
|
# Check the stage 2 build worked
|
||||||
if ! readelf --string-dump .comment $(TARGET_BUILD_STAGE2)/bin/clang 2>&1|grep -q "clang version"; then \
|
if ! readelf --string-dump .comment $(TARGET_BUILD_STAGE2)/bin/clang 2>&1|grep -q "clang version"; then \
|
||||||
@ -474,8 +534,6 @@ debian-full-build:
|
|||||||
echo "libclang-$(LLVM_VERSION).so.1 depends on libclang-cpp. Should not be the case"; \
|
echo "libclang-$(LLVM_VERSION).so.1 depends on libclang-cpp. Should not be the case"; \
|
||||||
exit 2; \
|
exit 2; \
|
||||||
fi
|
fi
|
||||||
# $(PRE_PROCESS) make $(NJOBS) -C $(TARGET_BUILD) $(VERBOSE) CFLAGS="$(CFLAGS_EXTRA)" CXXFLAGS="$(CXXFLAGS_EXTRA)" LDFLAGS="$(LDFLAGS_EXTRA)" REQUIRES_RTTI=1 DEBUGMAKE=1 runtimes
|
|
||||||
|
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
debian-libfuzzer-build:
|
debian-libfuzzer-build:
|
||||||
@ -484,104 +542,33 @@ ifeq (${LIBFUZZER_ENABLE},yes)
|
|||||||
CFLAGS=`dpkg-buildflags --get CFLAGS`; \
|
CFLAGS=`dpkg-buildflags --get CFLAGS`; \
|
||||||
CFLAGS="$$CFLAGS `dpkg-buildflags --get CPPFLAGS`"; \
|
CFLAGS="$$CFLAGS `dpkg-buildflags --get CPPFLAGS`"; \
|
||||||
echo $$CFLAGS; \
|
echo $$CFLAGS; \
|
||||||
$(BASE_PATH)/$(TARGET_BUILD_STAGE2)/bin/clang++ -c $$CFLAGS -std=c++11 $(BASE_PATH)/compiler-rt/lib/fuzzer/*.cpp -IFuzzer; \
|
$(STAGE2_BIN_DIR)/clang++ -c $$CFLAGS -std=c++11 $(BASE_PATH)/compiler-rt/lib/fuzzer/*.cpp -IFuzzer; \
|
||||||
ar ruv libFuzzer.a Fuzzer*.o
|
ar ruv libFuzzer.a Fuzzer*.o
|
||||||
endif
|
endif
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
# The various options to build libc++ and libc++abi
|
|
||||||
|
|
||||||
LIBCXX_CMAKE_OPTIONS := \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-$(LLVM_VERSION) \
|
|
||||||
-DLLVM_CONFIG_PATH=$(CURDIR)/$(TARGET_BUILD_STAGE2)/bin/llvm-config \
|
|
||||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
||||||
-DCMAKE_CXX_COMPILER=$(CURDIR)/$(TARGET_BUILD_STAGE2)/bin/clang++ \
|
|
||||||
-DCMAKE_C_COMPILER=$(CURDIR)/$(TARGET_BUILD_STAGE2)/bin/clang \
|
|
||||||
-DCMAKE_CXX_FLAGS="$(LIBCXXFLAGS)" \
|
|
||||||
-DCMAKE_EXE_LINKER_FLAGS="" \
|
|
||||||
-DCMAKE_SHARED_LINKER_FLAGS="" \
|
|
||||||
-DCMAKE_MODULE_LINKER_FLAGS="" \
|
|
||||||
-DCMAKE_AR=$(CURDIR)/$(TARGET_BUILD_STAGE2)/bin/llvm-ar \
|
|
||||||
-DCMAKE_RANLIB=$(CURDIR)/$(TARGET_BUILD_STAGE2)/bin/llvm-ranlib \
|
|
||||||
-DLLVM_EXTERNAL_LIT=$(BASE_PATH)/llvm/utils/lit/lit.py \
|
|
||||||
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
|
|
||||||
$(CMAKE_EXTRA)
|
|
||||||
|
|
||||||
debian-libcxxabi-build:
|
|
||||||
# Builds libcxxabi
|
|
||||||
echo "Using cmake: $(CMAKE_BIN)"; \
|
|
||||||
cd libcxxabi && \
|
|
||||||
CXXFLAGS="$(CXXFLAGS_EXTRA)" LDFLAGS="$(LDFLAGS_EXTRA)" \
|
|
||||||
$(PRE_PROCESS_CONF) $(CMAKE_BIN) \
|
|
||||||
-S . -B build \
|
|
||||||
-G $(GENERATOR) \
|
|
||||||
$(LIBCXX_CMAKE_OPTIONS) \
|
|
||||||
-DLIBCXXABI_LIBCXX_PATH=$(BASE_PATH)/libcxx \
|
|
||||||
-DLIBCXXABI_LIBCXX_LIBRARY_PATH=$(BASE_PATH)/libcxx/build/lib \
|
|
||||||
-DLIBCXXABI_LIBCXX_INCLUDES=$(BASE_PATH)/libcxx/include \
|
|
||||||
-DLIBCXXABI_ENABLE_EXCEPTIONS=$(LIBCXX_EXCEPTIONS) \
|
|
||||||
-DLIBCXXABI_USE_COMPILER_RT=ON \
|
|
||||||
-DLLVM_ENABLE_RTTI=ON \
|
|
||||||
$(CMAKE_LIBCXX_EXTRA) && \
|
|
||||||
$(PRE_PROCESS_CONF) ninja -C build/ $(VERBOSE)
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
# Fails with $<TARGET_LINKER_FILE:unwind_static>
|
|
||||||
# No target "unwind_static"
|
|
||||||
# on 12. Will test with 13
|
|
||||||
# -DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON \
|
|
||||||
# -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY=OFF \
|
|
||||||
# -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY=ON \
|
|
||||||
N
|
|
||||||
#- to libc++ when libunwind is built
|
|
||||||
#- Matches what is done on brew:
|
|
||||||
#- https://bit.ly/3kDNpC9
|
|
||||||
|
|
||||||
debian-libcxx-build:
|
|
||||||
# Builds libcxx
|
|
||||||
echo "Using cmake: $(CMAKE_BIN)"; \
|
|
||||||
cd libcxx && \
|
|
||||||
$(PRE_PROCESS_CONF) $(CMAKE_BIN) \
|
|
||||||
CXXFLAGS="$(CXXFLAGS_EXTRA)" LDFLAGS="$(LDFLAGS_EXTRA)" \
|
|
||||||
-S . -B build \
|
|
||||||
-G $(GENERATOR) \
|
|
||||||
$(LIBCXX_CMAKE_OPTIONS) \
|
|
||||||
-DLIBCXX_CXX_ABI=libcxxabi \
|
|
||||||
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=$(BASE_PATH)/libcxxabi/include \
|
|
||||||
-DLIBCXX_CXX_ABI_LIBRARY_PATH=$(BASE_PATH)/libcxxabi/build/lib \
|
|
||||||
-DLIBCXX_ENABLE_EXCEPTIONS=$(LIBCXX_EXCEPTIONS) \
|
|
||||||
-DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON \
|
|
||||||
-DLIBCXX_USE_COMPILER_RT=ON \
|
|
||||||
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
|
|
||||||
-DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON \
|
|
||||||
-DLIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=OFF \
|
|
||||||
$(CMAKE_LIBCXX_EXTRA) && \
|
|
||||||
$(PRE_PROCESS_CONF) ninja -C build/ $(VERBOSE)
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
|
|
||||||
debian-libclc-build:
|
debian-libclc-build:
|
||||||
# Builds libclc
|
# Builds libclc
|
||||||
|
|
||||||
mkdir -p libclc/build
|
mkdir -p libclc/build
|
||||||
|
echo "Using cmake: $(CMAKE_BIN)"
|
||||||
CMAKE_BIN=cmake; \
|
|
||||||
if test -f /tmp/cmake/bin/cmake; then \
|
|
||||||
CMAKE_BIN=/tmp/cmake/bin/cmake; \
|
|
||||||
fi; \
|
|
||||||
echo "Using cmake: $$CMAKE_BIN"; \
|
|
||||||
cd libclc/build && \
|
cd libclc/build && \
|
||||||
$$CMAKE_BIN ../ \
|
$(CMAKE_BIN) ../ \
|
||||||
-G $(GENERATOR) \
|
-G $(GENERATOR) \
|
||||||
|
-DCMAKE_C_COMPILER=$(STAGE2_BIN_DIR)/clang \
|
||||||
|
-DCMAKE_CXX_COMPILER=$(STAGE2_BIN_DIR)/clang++ \
|
||||||
|
-DCMAKE_CXX_FLAGS="$(BOOTSTRAP_CXXFLAGS_EXTRA)" \
|
||||||
|
-DCMAKE_SHARED_LINKER_FLAGS="$(BOOTSTRAP_LDFLAGS_EXTRA) -L$(STAGE2_LIB_DIR)" \
|
||||||
|
-DCMAKE_MODULE_LINKER_FLAGS="$(BOOTSTRAP_LDFLAGS_EXTRA) -L$(STAGE2_LIB_DIR)" \
|
||||||
|
-DCMAKE_EXE_LINKER_FLAGS="$(BOOTSTRAP_LDFLAGS_EXTRA) -L$(STAGE2_LIB_DIR)" \
|
||||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||||
-DCMAKE_INSTALL_DATADIR=lib \
|
-DCMAKE_INSTALL_DATADIR=lib \
|
||||||
-DCMAKE_INSTALL_INCLUDEDIR=include \
|
-DCMAKE_INSTALL_INCLUDEDIR=include \
|
||||||
-DLLVM_CONFIG=$(CURDIR)/$(TARGET_BUILD_STAGE2)/bin/llvm-config \
|
-DLLVM_CONFIG=$(STAGE2_BIN_DIR)/llvm-config \
|
||||||
-DLIBCLC_TARGETS_TO_BUILD=$(LIBCLC_TARGETS_TO_BUILD); \
|
-DLIBCLC_TARGETS_TO_BUILD=$(LIBCLC_TARGETS_TO_BUILD); \
|
||||||
ninja $(VERBOSE)
|
ninja $(NJOBS) $(VERBOSE)
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
override_dh_auto_build: debian-full-build debian-libfuzzer-build debian-libcxxabi-build debian-libcxx-build debian-libclc-build
|
override_dh_auto_build: debian-full-build debian-libfuzzer-build debian-libclc-build
|
||||||
|
|
||||||
override_dh_prep: build_doc
|
override_dh_prep: build_doc
|
||||||
dh_prep
|
dh_prep
|
||||||
@ -655,26 +642,21 @@ override_dh_auto_install:
|
|||||||
|
|
||||||
# Only run on executable, not script
|
# Only run on executable, not script
|
||||||
chrpath -d `find $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/bin/ -type f -executable -exec file -i '{}' \; | grep 'x-executable; charset=binary'|cut -d: -f1`
|
chrpath -d `find $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/bin/ -type f -executable -exec file -i '{}' \; | grep 'x-executable; charset=binary'|cut -d: -f1`
|
||||||
chrpath -d libcxxabi/build/lib/libc++abi.so.1.0
|
|
||||||
chrpath -d libcxx/build/lib/libc++.so.1.0
|
|
||||||
|
|
||||||
: # libclang
|
: # libclang
|
||||||
cd debian/tmp/usr/lib/llvm-$(LLVM_VERSION)/lib/ && rm -f libclang.so.$(SONAME_EXT) libclang-$(LLVM_VERSION).so; \
|
cd debian/tmp/usr/lib/llvm-$(LLVM_VERSION)/lib/ && rm -f libclang.so.$(SONAME_EXT); \
|
||||||
ln -s libclang-$(LLVM_VERSION).so.$(SONAME_EXT) libclang.so.$(SONAME_EXT)
|
ln -s libclang-$(LLVM_VERSION).so.$(SONAME_EXT) libclang.so.$(SONAME_EXT)
|
||||||
|
|
||||||
: # libomp
|
|
||||||
cd debian/tmp/usr/lib/llvm-$(LLVM_VERSION)/lib && rm -f libomp.so; \
|
|
||||||
ln -s libomp.so.$(SONAME_OPENMP) libomp.so
|
|
||||||
|
|
||||||
if test "$(LIBUNWIND_ENABLE)" = yes; then \
|
if test "$(LIBUNWIND_ENABLE)" = yes; then \
|
||||||
mkdir -p debian/tmp/usr/include/libunwind; \
|
mkdir -p debian/tmp/usr/include/libunwind; \
|
||||||
cp -R libunwind/include/* debian/tmp/usr/include/libunwind/; \
|
cp -R libunwind/include/* debian/tmp/usr/include/libunwind/; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
: # libomp
|
||||||
if test "$(OPENMP_ENABLE)" = yes; then \
|
if test "$(OPENMP_ENABLE)" = yes; then \
|
||||||
mkdir -p debian/tmp/usr/lib/llvm-$(LLVM_VERSION)/include/openmp; \
|
cd debian/tmp/usr/lib/llvm-$(LLVM_VERSION)/lib; \
|
||||||
cp -f openmp/runtime/exports/common*/include/* debian/tmp/usr/lib/llvm-$(LLVM_VERSION)/include/openmp; \
|
ln -s libomp.so.$(SONAME_OPENMP) libomp.so; \
|
||||||
cd debian/tmp/usr/lib/llvm-$(LLVM_VERSION)/lib && cp libomp.so.$(SONAME_OPENMP) libomp-$(LLVM_VERSION).so.$(SONAME_OPENMP); \
|
cp libomp.so.$(SONAME_OPENMP) libomp-$(LLVM_VERSION).so.$(SONAME_OPENMP); \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove artifact (where compiler-rt is built)
|
# Remove artifact (where compiler-rt is built)
|
||||||
@ -714,8 +696,6 @@ endif
|
|||||||
rm -rf $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/build/utils/lit/lit/__pycache__/ \
|
rm -rf $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/build/utils/lit/lit/__pycache__/ \
|
||||||
$(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/build/utils/lit/lit/*/__pycache__/
|
$(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/build/utils/lit/lit/*/__pycache__/
|
||||||
|
|
||||||
DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C libcxxabi/build install
|
|
||||||
DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C libcxx/build install
|
|
||||||
DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C libclc/build install
|
DESTDIR=$(DEB_INST) ninja $(VERBOSE) -C libclc/build install
|
||||||
|
|
||||||
# Rename binaries
|
# Rename binaries
|
||||||
@ -769,8 +749,8 @@ endif
|
|||||||
# Manage the polly files. Sometimes, we build them. Sometimes not.
|
# Manage the polly files. Sometimes, we build them. Sometimes not.
|
||||||
if test "$(POLLY_ENABLE)" = yes; then \
|
if test "$(POLLY_ENABLE)" = yes; then \
|
||||||
mkdir -p $(CURDIR)/debian/libclang-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/lib/ $(CURDIR)/debian/libclang-common-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/include/polly/; \
|
mkdir -p $(CURDIR)/debian/libclang-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/lib/ $(CURDIR)/debian/libclang-common-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/include/polly/; \
|
||||||
mv -f $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/libpolly* \
|
mv -f $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/libPolly* \
|
||||||
$(CURDIR)/debian/libclang-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/lib/; \
|
$(CURDIR)/debian/libclang-common-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/lib/; \
|
||||||
rm -rf $(CURDIR)/debian/libclang-common-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/include/polly; \
|
rm -rf $(CURDIR)/debian/libclang-common-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/include/polly; \
|
||||||
mv -f $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/include/polly/ \
|
mv -f $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/include/polly/ \
|
||||||
$(CURDIR)/debian/libclang-common-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/include/; \
|
$(CURDIR)/debian/libclang-common-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/include/; \
|
||||||
@ -911,10 +891,10 @@ endif
|
|||||||
ninja $(VERBOSE) -C $(TARGET_BUILD_STAGE2) check-sanitizer || true
|
ninja $(VERBOSE) -C $(TARGET_BUILD_STAGE2) check-sanitizer || true
|
||||||
|
|
||||||
# Libcxx
|
# Libcxx
|
||||||
ninja $(VERBOSE) -C libcxx/build check-libcxx || true
|
ninja $(VERBOSE) -C $(TARGET_BUILD_STAGE2) check-libcxx || true
|
||||||
|
|
||||||
# Libcxxabi
|
# Libcxxabi
|
||||||
ninja $(VERBOSE) -C libcxxabi/build check-libcxxabi || true
|
ninja $(VERBOSE) -C $(TARGET_BUILD_STAGE2) check-libcxxabi || true
|
||||||
|
|
||||||
# Libclc
|
# Libclc
|
||||||
ninja $(VERBOSE) -C libclc/build test || true
|
ninja $(VERBOSE) -C libclc/build test || true
|
||||||
|
Loading…
Reference in New Issue
Block a user