From fefa2049020a366b9ea9df5e44e4e27f742234a0 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 05 2019 19:43:29 +0000 Subject: import llvm-8.0.1-1.module+el8.1.0+3866+6be7f4d8 --- diff --git a/.gitignore b/.gitignore index 758cf35..02ad497 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/llvm-7.0.1.src.tar.xz +SOURCES/llvm-8.0.1.src.tar.xz diff --git a/.llvm.metadata b/.llvm.metadata index 4022003..59cfa37 100644 --- a/.llvm.metadata +++ b/.llvm.metadata @@ -1 +1 @@ -f97632fcc3186eb0d396492ef8acfc807648580f SOURCES/llvm-7.0.1.src.tar.xz +09964f9eabc364f221a3caefbdaea28557273b4a SOURCES/llvm-8.0.1.src.tar.xz diff --git a/SOURCES/0001-CMake-Don-t-prefer-python2.7.patch b/SOURCES/0001-CMake-Don-t-prefer-python2.7.patch deleted file mode 100644 index ddea299..0000000 --- a/SOURCES/0001-CMake-Don-t-prefer-python2.7.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 1e0f1c5481a96d760f7840d4dde103353a0131f8 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Thu, 30 Aug 2018 11:38:51 -0700 -Subject: [PATCH] CMake: Don't prefer python2.7 - ---- - CMakeLists.txt | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 31df640..2603f1c 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -613,10 +613,6 @@ message(STATUS "LLVM default target triple: ${LLVM_DEFAULT_TARGET_TRIPLE}") - - include(HandleLLVMOptions) - --# Verify that we can find a Python 2 interpreter. Python 3 is unsupported. --# FIXME: We should support systems with only Python 3, but that requires work --# on LLDB. --set(Python_ADDITIONAL_VERSIONS 2.7) - include(FindPythonInterp) - if( NOT PYTHONINTERP_FOUND ) - message(FATAL_ERROR --- -1.8.3.1 - diff --git a/SOURCES/0001-CMake-Split-static-library-exports-into-their-own-ex.patch b/SOURCES/0001-CMake-Split-static-library-exports-into-their-own-ex.patch deleted file mode 100644 index 903821e..0000000 --- a/SOURCES/0001-CMake-Split-static-library-exports-into-their-own-ex.patch +++ /dev/null @@ -1,86 +0,0 @@ -From f9e66a883e1fb748e6ac826fde188efaae249361 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Sat, 29 Apr 2017 02:03:23 +0000 -Subject: [PATCH] CMake: Split static library exports into their own export - file - -Summary: -This is to better support distros which split the static libraries into -their own package. - -The current problem is that any project the includes LLVMConfig.cmake -will fail to configure unless the static libraries are installed. This -is because LLVMConfig.cmake includes LLVMExports.cmake, which throws an -error if it can't find files linked to one of the exported targets. - -This patch resolves the problem by putting the static library targets -into their own export file, LLVMStaticExports.cmake. This file -is optionally included by LLVMConfig.cmake, so distros can put this -new file in their static library package to make LLVMConfig.cmake -no longer depend on these libraries when they are not installed. - -Reviewers: beanz, mgorny, chapuni - -Subscribers: llvm-commits - -Differential Revision: https://reviews.llvm.org/D32668 ---- - cmake/modules/AddLLVM.cmake | 6 +++++- - cmake/modules/CMakeLists.txt | 3 +++ - cmake/modules/LLVMConfig.cmake.in | 2 ++ - 3 files changed, 10 insertions(+), 1 deletion(-) - -diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake -index fd5627e..78f106f 100644 ---- a/cmake/modules/AddLLVM.cmake -+++ b/cmake/modules/AddLLVM.cmake -@@ -635,7 +635,11 @@ macro(add_llvm_library name) - - if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR - NOT LLVM_DISTRIBUTION_COMPONENTS) -- set(export_to_llvmexports EXPORT LLVMExports) -+ if (ARG_SHARED) -+ set(export_to_llvmexports EXPORT LLVMExports) -+ else() -+ set(export_to_llvmexports EXPORT LLVMStaticExports) -+ endif() - set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True) - endif() - -diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt -index 6074e83..e9fcb11 100644 ---- a/cmake/modules/CMakeLists.txt -+++ b/cmake/modules/CMakeLists.txt -@@ -91,6 +91,7 @@ set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}") - set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin") - set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake") - set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS}") -+set(LLVM_CONFIG_STATIC_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMStaticExports.cmake") - configure_file( - LLVMConfig.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake -@@ -107,6 +108,8 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) - if(llvm_has_exports) - install(EXPORT LLVMExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR} - COMPONENT cmake-exports) -+ install(EXPORT LLVMStaticExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR} -+ COMPONENT cmake-exports) - endif() - - install(FILES -diff --git a/cmake/modules/LLVMConfig.cmake.in b/cmake/modules/LLVMConfig.cmake.in -index 0772016..f471625 100644 ---- a/cmake/modules/LLVMConfig.cmake.in -+++ b/cmake/modules/LLVMConfig.cmake.in -@@ -78,6 +78,8 @@ if(NOT TARGET LLVMSupport) - set(LLVM_EXPORTED_TARGETS "@LLVM_CONFIG_EXPORTS@") - include("@LLVM_CONFIG_EXPORTS_FILE@") - @llvm_config_include_buildtree_only_exports@ -+ -+ include("@LLVM_CONFIG_STATIC_EXPORTS_FILE@" OPTIONAL) - endif() - - # By creating intrinsics_gen here, subprojects that depend on LLVM's --- -1.8.3.1 - diff --git a/SOURCES/0001-Deactivate-markdown-doc.patch b/SOURCES/0001-Deactivate-markdown-doc.patch new file mode 100644 index 0000000..87e3a46 --- /dev/null +++ b/SOURCES/0001-Deactivate-markdown-doc.patch @@ -0,0 +1,28 @@ +From eeb9da2ece9a58448c213b900090b32e6d303bff Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Thu, 13 Jun 2019 07:58:59 +0000 +Subject: [PATCH 4/4] Deactivate markdown doc + +--- + llvm/docs/conf.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/llvm/docs/conf.py b/llvm/docs/conf.py +index 7fdcb3d2f52..501b48b540d 100644 +--- a/llvm/docs/conf.py ++++ b/llvm/docs/conf.py +@@ -32,9 +32,9 @@ extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo'] + templates_path = ['_templates'] + + # The suffix of source filenames. +-source_suffix = ['.rst', '.md'] ++source_suffix = ['.rst'] + +-source_parsers = {'.md': 'recommonmark.parser.CommonMarkParser'} ++source_parsers = {} + + # The encoding of source files. + #source_encoding = 'utf-8-sig' +-- +2.20.1 + diff --git a/SOURCES/0001-Disable-threading-in-thinLTO.patch b/SOURCES/0001-Disable-threading-in-thinLTO.patch deleted file mode 100644 index 73c1e31..0000000 --- a/SOURCES/0001-Disable-threading-in-thinLTO.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 7f29c6fcd31ea7fdba8be602cc6fee2d2016fcd3 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Tue, 11 Dec 2018 16:34:40 -0500 -Subject: [PATCH] Disable threading in thinLTO - -/usr/bin/ld.gold does not support threaded plugins if gold itself has -not been linked against pthread. - -https://bugzilla.redhat.com/show_bug.cgi?id=1636479#c16 ---- - lib/LTO/LTO.cpp | 26 +------------------------- - tools/gold/CMakeLists.txt | 1 + - 2 files changed, 2 insertions(+), 25 deletions(-) - -diff --git a/lib/LTO/LTO.cpp b/lib/LTO/LTO.cpp -index 68d210cb..e4369c7f 100644 ---- a/lib/LTO/LTO.cpp -+++ b/lib/LTO/LTO.cpp -@@ -914,7 +914,6 @@ public: - - namespace { - class InProcessThinBackend : public ThinBackendProc { -- ThreadPool BackendThreadPool; - AddStreamFn AddStream; - NativeObjectCache Cache; - TypeIdSummariesByGuidTy TypeIdSummariesByGuid; -@@ -931,7 +930,6 @@ public: - const StringMap &ModuleToDefinedGVSummaries, - AddStreamFn AddStream, NativeObjectCache Cache) - : ThinBackendProc(Conf, CombinedIndex, ModuleToDefinedGVSummaries), -- BackendThreadPool(ThinLTOParallelismLevel), - AddStream(std::move(AddStream)), Cache(std::move(Cache)) { - // Create a mapping from type identifier GUIDs to type identifier summaries. - // This allows backends to use the type identifier GUIDs stored in the -@@ -996,34 +994,12 @@ public: - assert(ModuleToDefinedGVSummaries.count(ModulePath)); - const GVSummaryMapTy &DefinedGlobals = - ModuleToDefinedGVSummaries.find(ModulePath)->second; -- BackendThreadPool.async( -- [=](BitcodeModule BM, ModuleSummaryIndex &CombinedIndex, -- const FunctionImporter::ImportMapTy &ImportList, -- const FunctionImporter::ExportSetTy &ExportList, -- const std::map -- &ResolvedODR, -- const GVSummaryMapTy &DefinedGlobals, -- MapVector &ModuleMap, -- const TypeIdSummariesByGuidTy &TypeIdSummariesByGuid) { -- Error E = runThinLTOBackendThread( -+ return runThinLTOBackendThread( - AddStream, Cache, Task, BM, CombinedIndex, ImportList, ExportList, - ResolvedODR, DefinedGlobals, ModuleMap, TypeIdSummariesByGuid); -- if (E) { -- std::unique_lock L(ErrMu); -- if (Err) -- Err = joinErrors(std::move(*Err), std::move(E)); -- else -- Err = std::move(E); -- } -- }, -- BM, std::ref(CombinedIndex), std::ref(ImportList), std::ref(ExportList), -- std::ref(ResolvedODR), std::ref(DefinedGlobals), std::ref(ModuleMap), -- std::ref(TypeIdSummariesByGuid)); -- return Error::success(); - } - - Error wait() override { -- BackendThreadPool.wait(); - if (Err) - return std::move(*Err); - else -diff --git a/tools/gold/CMakeLists.txt b/tools/gold/CMakeLists.txt -index d2580329..c3bf1b72 100644 ---- a/tools/gold/CMakeLists.txt -+++ b/tools/gold/CMakeLists.txt -@@ -15,4 +15,5 @@ if( LLVM_ENABLE_PIC AND LLVM_BINUTILS_INCDIR ) - gold-plugin.cpp - ) - -+ - endif() --- -2.18.1 - diff --git a/SOURCES/0001-Don-t-set-rpath-when-installing.patch b/SOURCES/0001-Don-t-set-rpath-when-installing.patch deleted file mode 100644 index d92a387..0000000 --- a/SOURCES/0001-Don-t-set-rpath-when-installing.patch +++ /dev/null @@ -1,24 +0,0 @@ -From e67ace2ecb42c24e124f1738dc67b22055a22500 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Thu, 13 Sep 2018 10:10:08 -0700 -Subject: [PATCH] Don't set rpath when installing - ---- - cmake/modules/AddLLVM.cmake | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake -index ce2057f..de309b5 100644 ---- a/cmake/modules/AddLLVM.cmake -+++ b/cmake/modules/AddLLVM.cmake -@@ -1621,6 +1621,7 @@ function(llvm_codesign name) - endfunction() - - function(llvm_setup_rpath name) -+ return() - if(CMAKE_INSTALL_RPATH) - return() - endif() --- -1.8.3.1 - diff --git a/SOURCES/0001-Ensure-that-variant-part-discriminator-is-read-by-Me.patch b/SOURCES/0001-Ensure-that-variant-part-discriminator-is-read-by-Me.patch deleted file mode 100644 index d6380eb..0000000 --- a/SOURCES/0001-Ensure-that-variant-part-discriminator-is-read-by-Me.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 2ad5ac11b17dac347d29191872b2b3d601bbcd1f Mon Sep 17 00:00:00 2001 -From: Jonas Devlieghere -Date: Fri, 21 Sep 2018 12:03:14 +0000 -Subject: [PATCH 1/2] Ensure that variant part discriminator is read by - MetadataLoader - -https://reviews.llvm.org/D42082 introduced variant parts to debug info -in LLVM. Subsequent work on the Rust compiler has found a bug in that -patch; namely, there is a path in MetadataLoader that fails to restore -the discriminator. - -This patch fixes the bug. - -Patch by: Tom Tromey - -Differential revision: https://reviews.llvm.org/D52340 - -llvm-svn: 342725 ---- - llvm/lib/Bitcode/Reader/MetadataLoader.cpp | 2 +- - llvm/test/Assembler/debug-variant-discriminator.ll | 14 ++++++++++++++ - 2 files changed, 15 insertions(+), 1 deletion(-) - create mode 100644 llvm/test/Assembler/debug-variant-discriminator.ll - -diff --git a/lib/Bitcode/Reader/MetadataLoader.cpp b/lib/Bitcode/Reader/MetadataLoader.cpp -index 011c41e2cecd..a7b542efc19e 100644 ---- a/lib/Bitcode/Reader/MetadataLoader.cpp -+++ b/lib/Bitcode/Reader/MetadataLoader.cpp -@@ -1308,7 +1308,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata( - (Context, Tag, Name, File, Line, Scope, BaseType, - SizeInBits, AlignInBits, OffsetInBits, Flags, - Elements, RuntimeLang, VTableHolder, TemplateParams, -- Identifier)); -+ Identifier, Discriminator)); - if (!IsNotUsedInTypeRef && Identifier) - MetadataList.addTypeRef(*Identifier, *cast(CT)); - -diff --git a/test/Assembler/debug-variant-discriminator.ll b/test/Assembler/debug-variant-discriminator.ll -new file mode 100644 -index 000000000000..5be001cad6be ---- /dev/null -+++ b/test/Assembler/debug-variant-discriminator.ll -@@ -0,0 +1,14 @@ -+; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s -+; RUN: verify-uselistorder %s -+ -+; CHECK: !named = !{!0, !1, !2} -+!named = !{!0, !1, !2} -+ -+; CHECK: !0 = !DICompositeType(tag: DW_TAG_structure_type, name: "Outer", size: 64, align: 64, identifier: "Outer") -+; CHECK-NEXT: !1 = !DICompositeType(tag: DW_TAG_variant_part, scope: !0, size: 64, discriminator: !2) -+; CHECK-NEXT: !2 = !DIDerivedType(tag: DW_TAG_member, scope: !1, baseType: !3, size: 64, align: 64, flags: DIFlagArtificial) -+; CHECK-NEXT: !3 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned) -+!0 = !DICompositeType(tag: DW_TAG_structure_type, name: "Outer", size: 64, align: 64, identifier: "Outer") -+!1 = !DICompositeType(tag: DW_TAG_variant_part, scope: !0, size: 64, discriminator: !2) -+!2 = !DIDerivedType(tag: DW_TAG_member, scope: !1, baseType: !3, size: 64, align: 64, flags: DIFlagArtificial) -+!3 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned) --- -2.20.1 - diff --git a/SOURCES/0001-Filter-out-cxxflags-not-supported-by-clang.patch b/SOURCES/0001-Filter-out-cxxflags-not-supported-by-clang.patch index 31b819b..e2f3b26 100644 --- a/SOURCES/0001-Filter-out-cxxflags-not-supported-by-clang.patch +++ b/SOURCES/0001-Filter-out-cxxflags-not-supported-by-clang.patch @@ -1,28 +1,82 @@ -From 5f7fd92155db77c7608e3a07e5dcfad1ec7bd4e4 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Fri, 16 Mar 2018 07:52:33 -0700 -Subject: [PATCH] Filter out cxxflags not supported by clang +From e491bb836e530585e4d278b82725e4cefdd14abc Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Thu, 13 Jun 2019 07:55:37 +0000 +Subject: [PATCH 3/4] Filter-out-cxxflags-not-supported-by-clang --- - tools/llvm-config/CMakeLists.txt | 4 ++++ - 1 file changed, 4 insertions(+) + llvm/cmake/modules/AddLLVM.cmake | 6 +++++- + llvm/cmake/modules/CMakeLists.txt | 3 +++ + llvm/cmake/modules/LLVMConfig.cmake.in | 2 ++ + llvm/tools/llvm-config/CMakeLists.txt | 4 ++++ + 4 files changed, 14 insertions(+), 1 deletion(-) -diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt -index a0bd36c..4193b0e 100644 ---- a/tools/llvm-config/CMakeLists.txt -+++ b/tools/llvm-config/CMakeLists.txt -@@ -34,7 +34,11 @@ set(LLVM_SRC_ROOT ${LLVM_MAIN_SRC_DIR}) +diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake +index 1a417447278..bb10f20cdd6 100644 +--- a/llvm/cmake/modules/AddLLVM.cmake ++++ b/llvm/cmake/modules/AddLLVM.cmake +@@ -664,7 +664,11 @@ macro(add_llvm_library name) + + if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR + NOT LLVM_DISTRIBUTION_COMPONENTS) +- set(export_to_llvmexports EXPORT LLVMExports) ++ if (ARG_SHARED) ++ set(export_to_llvmexports EXPORT LLVMExports) ++ else() ++ set(export_to_llvmexports EXPORT LLVMStaticExports) ++ endif() + set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True) + endif() + +diff --git a/llvm/cmake/modules/CMakeLists.txt b/llvm/cmake/modules/CMakeLists.txt +index f5cc0006fa0..6605dc729c2 100644 +--- a/llvm/cmake/modules/CMakeLists.txt ++++ b/llvm/cmake/modules/CMakeLists.txt +@@ -97,6 +97,7 @@ set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}") + set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin") + set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake") + set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS}") ++set(LLVM_CONFIG_STATIC_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMStaticExports.cmake") + configure_file( + LLVMConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake +@@ -113,6 +114,8 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) + if(llvm_has_exports) + install(EXPORT LLVMExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR} + COMPONENT cmake-exports) ++ install(EXPORT LLVMStaticExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR} ++ COMPONENT cmake-exports) + endif() + + install(FILES +diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in +index 7ca06381d90..44d042c9b11 100644 +--- a/llvm/cmake/modules/LLVMConfig.cmake.in ++++ b/llvm/cmake/modules/LLVMConfig.cmake.in +@@ -84,6 +84,8 @@ if(NOT TARGET LLVMSupport) + set(LLVM_EXPORTED_TARGETS "@LLVM_CONFIG_EXPORTS@") + include("@LLVM_CONFIG_EXPORTS_FILE@") + @llvm_config_include_buildtree_only_exports@ ++ ++ include("@LLVM_CONFIG_STATIC_EXPORTS_FILE@" OPTIONAL) + endif() + + # By creating intrinsics_gen here, subprojects that depend on LLVM's +diff --git a/llvm/tools/llvm-config/CMakeLists.txt b/llvm/tools/llvm-config/CMakeLists.txt +index a7db17386fb..8a796d03b5a 100644 +--- a/llvm/tools/llvm-config/CMakeLists.txt ++++ b/llvm/tools/llvm-config/CMakeLists.txt +@@ -42,7 +42,11 @@ set(LLVM_SRC_ROOT ${LLVM_MAIN_SRC_DIR}) set(LLVM_OBJ_ROOT ${LLVM_BINARY_DIR}) - set(LLVM_CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}") - set(LLVM_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}") + set(LLVM_CPPFLAGS "${LLVM_DEFINITIONS}") + set(LLVM_CFLAGS "${LLVM_C_STD_FLAG} ${LLVM_DEFINITIONS}") +STRING(REGEX REPLACE "-mcet" "" LLVM_CFLAGS ${LLVM_CFLAGS}) +STRING(REGEX REPLACE "-fcf-protection" "" LLVM_CFLAGS ${LLVM_CFLAGS}) - set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${COMPILE_FLAGS} ${LLVM_DEFINITIONS}") + set(LLVM_CXXFLAGS "${LLVM_CXX_STD_FLAG} ${COMPILE_FLAGS} ${LLVM_DEFINITIONS}") +STRING(REGEX REPLACE "-mcet" "" LLVM_CXXFLAGS ${LLVM_CXXFLAGS}) +STRING(REGEX REPLACE "-fcf-protection" "" LLVM_CXXFLAGS ${LLVM_CXXFLAGS}) set(LLVM_BUILD_SYSTEM cmake) set(LLVM_HAS_RTTI ${LLVM_CONFIG_HAS_RTTI}) set(LLVM_DYLIB_VERSION "${LLVM_VERSION_MAJOR}${LLVM_VERSION_SUFFIX}") -- -1.8.3.1 +2.20.1 diff --git a/SOURCES/0001-GlobalISel-Lower-dbg.declare-into-indirect-DBG_VALUE.patch b/SOURCES/0001-GlobalISel-Lower-dbg.declare-into-indirect-DBG_VALUE.patch deleted file mode 100644 index b6ce1d8..0000000 --- a/SOURCES/0001-GlobalISel-Lower-dbg.declare-into-indirect-DBG_VALUE.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 9959e0572c47e3cdedb51d05bf76bb56965ede98 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Fri, 7 Sep 2018 22:19:20 -0700 -Subject: [PATCH] [GlobalISel] Lower dbg.declare into indirect DBG_VALUE - -Summary: -D31439 changed the semantics of dbg.declare to take the address of a -variable as the first argument, making it indirect. It specifically -updated FastISel for this change here: - -https://reviews.llvm.org/D31439#change-WVArzi177jPl - -GlobalISel needs to follow suit, or else it will be missing a level of -indirection in the generated debuginfo. This problem was seen in a Rust -debuginfo test on aarch64, since GlobalISel is used at -O0 for aarch64. - -https://github.com/rust-lang/rust/issues/49807 -https://bugzilla.redhat.com/show_bug.cgi?id=1611597 -https://bugzilla.redhat.com/show_bug.cgi?id=1625768 - -Reviewers: dblaikie, aprantl, t.p.northover, javed.absar, rnk - -Reviewed By: rnk - -Subscribers: #debug-info, rovka, kristof.beyls, JDevlieghere, llvm-commits, tstellar - -Differential Revision: https://reviews.llvm.org/D51749 ---- - lib/CodeGen/GlobalISel/IRTranslator.cpp | 9 ++-- - test/CodeGen/AArch64/GlobalISel/debug-cpp.ll | 67 ++++++++++++++++++++++++++ - test/CodeGen/AArch64/GlobalISel/debug-insts.ll | 4 +- - 3 files changed, 74 insertions(+), 6 deletions(-) - create mode 100644 test/CodeGen/AArch64/GlobalISel/debug-cpp.ll - -diff --git a/lib/CodeGen/GlobalISel/IRTranslator.cpp b/lib/CodeGen/GlobalISel/IRTranslator.cpp -index 75496fb..9926be3 100644 ---- a/lib/CodeGen/GlobalISel/IRTranslator.cpp -+++ b/lib/CodeGen/GlobalISel/IRTranslator.cpp -@@ -763,9 +763,12 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID, - // instructions (in fact, they get ignored if they *do* exist). - MF->setVariableDbgInfo(DI.getVariable(), DI.getExpression(), - getOrCreateFrameIndex(*AI), DI.getDebugLoc()); -- } else -- MIRBuilder.buildDirectDbgValue(getOrCreateVReg(*Address), -- DI.getVariable(), DI.getExpression()); -+ } else { -+ // A dbg.declare describes the address of a source variable, so lower it -+ // into an indirect DBG_VALUE. -+ MIRBuilder.buildIndirectDbgValue(getOrCreateVReg(*Address), -+ DI.getVariable(), DI.getExpression()); -+ } - return true; - } - case Intrinsic::vaend: -diff --git a/test/CodeGen/AArch64/GlobalISel/debug-cpp.ll b/test/CodeGen/AArch64/GlobalISel/debug-cpp.ll -new file mode 100644 -index 0000000..e5a4e55 ---- /dev/null -+++ b/test/CodeGen/AArch64/GlobalISel/debug-cpp.ll -@@ -0,0 +1,67 @@ -+; RUN: llc -global-isel -mtriple=aarch64 %s -stop-after=irtranslator -o - | FileCheck %s -+; RUN: llc -mtriple=aarch64 -global-isel --global-isel-abort=0 -o /dev/null -+ -+; struct NTCopy { -+; NTCopy(); -+; NTCopy(const NTCopy &); -+; int x; -+; }; -+; int foo(NTCopy o) { -+; return o.x; -+; } -+ -+; ModuleID = 'ntcopy.cpp' -+source_filename = "ntcopy.cpp" -+target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" -+target triple = "aarch64-unknown-linux-gnu" -+ -+%struct.NTCopy = type { i32 } -+ -+; CHECK-LABEL: name: _Z3foo6NTCopy -+; CHECK: DBG_VALUE debug-use %{{[0-9]+}}(p0), 0, !23, !DIExpression(), debug-location !24 -+; Function Attrs: noinline nounwind optnone -+define dso_local i32 @_Z3foo6NTCopy(%struct.NTCopy* %o) #0 !dbg !7 { -+entry: -+ call void @llvm.dbg.declare(metadata %struct.NTCopy* %o, metadata !23, metadata !DIExpression()), !dbg !24 -+ %x = getelementptr inbounds %struct.NTCopy, %struct.NTCopy* %o, i32 0, i32 0, !dbg !25 -+ %0 = load i32, i32* %x, align 4, !dbg !25 -+ ret i32 %0, !dbg !26 -+} -+ -+; Function Attrs: nounwind readnone speculatable -+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 -+ -+attributes #0 = { noinline nounwind optnone } -+attributes #1 = { nounwind readnone speculatable } -+ -+!llvm.dbg.cu = !{!0} -+!llvm.module.flags = !{!3, !4, !5} -+!llvm.ident = !{!6} -+ -+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 8.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) -+!1 = !DIFile(filename: "ntcopy.cpp", directory: "/tmp") -+!2 = !{} -+!3 = !{i32 2, !"Dwarf Version", i32 4} -+!4 = !{i32 2, !"Debug Info Version", i32 3} -+!5 = !{i32 1, !"wchar_size", i32 4} -+!6 = !{!"clang version 8.0.0 "} -+!7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foo6NTCopy", scope: !1, file: !1, line: 6, type: !8, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) -+!8 = !DISubroutineType(types: !9) -+!9 = !{!10, !11} -+!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) -+!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "NTCopy", file: !1, line: 1, size: 32, elements: !12, identifier: "_ZTS6NTCopy") -+!12 = !{!13, !14, !18} -+!13 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !11, file: !1, line: 4, baseType: !10, size: 32) -+!14 = !DISubprogram(name: "NTCopy", scope: !11, file: !1, line: 2, type: !15, isLocal: false, isDefinition: false, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false) -+!15 = !DISubroutineType(types: !16) -+!16 = !{null, !17} -+!17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) -+!18 = !DISubprogram(name: "NTCopy", scope: !11, file: !1, line: 3, type: !19, isLocal: false, isDefinition: false, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false) -+!19 = !DISubroutineType(types: !20) -+!20 = !{null, !17, !21} -+!21 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !22, size: 64) -+!22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !11) -+!23 = !DILocalVariable(name: "o", arg: 1, scope: !7, file: !1, line: 6, type: !11) -+!24 = !DILocation(line: 6, column: 16, scope: !7) -+!25 = !DILocation(line: 7, column: 12, scope: !7) -+!26 = !DILocation(line: 7, column: 3, scope: !7) -diff --git a/test/CodeGen/AArch64/GlobalISel/debug-insts.ll b/test/CodeGen/AArch64/GlobalISel/debug-insts.ll -index 8309e00..256eb37 100644 ---- a/test/CodeGen/AArch64/GlobalISel/debug-insts.ll -+++ b/test/CodeGen/AArch64/GlobalISel/debug-insts.ll -@@ -6,18 +6,16 @@ - ; CHECK: - { id: {{.*}}, name: in.addr, type: default, offset: 0, size: {{.*}}, alignment: {{.*}}, - ; CHECK-NEXT: callee-saved-register: '', callee-saved-restored: true, - ; CHECK-NEXT: debug-info-variable: '!11', debug-info-expression: '!DIExpression()', --; CHECK: DBG_VALUE debug-use %0(s32), debug-use $noreg, !11, !DIExpression(), debug-location !12 - define void @debug_declare(i32 %in) #0 !dbg !7 { - entry: - %in.addr = alloca i32, align 4 - store i32 %in, i32* %in.addr, align 4 - call void @llvm.dbg.declare(metadata i32* %in.addr, metadata !11, metadata !DIExpression()), !dbg !12 -- call void @llvm.dbg.declare(metadata i32 %in, metadata !11, metadata !DIExpression()), !dbg !12 - ret void, !dbg !12 - } - - ; CHECK-LABEL: name: debug_declare_vla --; CHECK: DBG_VALUE debug-use %{{[0-9]+}}(p0), debug-use $noreg, !14, !DIExpression(), debug-location !15 -+; CHECK: DBG_VALUE debug-use %{{[0-9]+}}(p0), 0, !14, !DIExpression(), debug-location !15 - define void @debug_declare_vla(i32 %in) #0 !dbg !13 { - entry: - %vla.addr = alloca i32, i32 %in --- -1.8.3.1 - diff --git a/SOURCES/0001-Re-apply-r346985-ADT-Drop-llvm-Optional-clang-specif.patch b/SOURCES/0001-Re-apply-r346985-ADT-Drop-llvm-Optional-clang-specif.patch deleted file mode 100644 index 4f85931..0000000 --- a/SOURCES/0001-Re-apply-r346985-ADT-Drop-llvm-Optional-clang-specif.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 93d58f71134cb97e79c417e540d12940960b529e Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Fri, 16 Nov 2018 00:47:24 +0000 -Subject: [PATCH] Re-apply r346985: [ADT] Drop llvm::Optional clang-specific - optimization for trivially copyable types - -Remove a test case that was added with the optimization we are now -removing. - -git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347004 91177308-0d34-0410-b5e6-96231b3b80d8 ---- - include/llvm/ADT/Optional.h | 18 ------------------ - unittests/ADT/OptionalTest.cpp | 8 -------- - 2 files changed, 26 deletions(-) - -diff --git a/include/llvm/ADT/Optional.h b/include/llvm/ADT/Optional.h -index 353e5d0..9fe9b28 100644 ---- a/include/llvm/ADT/Optional.h -+++ b/include/llvm/ADT/Optional.h -@@ -108,24 +108,6 @@ template struct OptionalStorage { - } - }; - --#if !defined(__GNUC__) || defined(__clang__) // GCC up to GCC7 miscompiles this. --/// Storage for trivially copyable types only. --template struct OptionalStorage { -- AlignedCharArrayUnion storage; -- bool hasVal = false; -- -- OptionalStorage() = default; -- -- OptionalStorage(const T &y) : hasVal(true) { new (storage.buffer) T(y); } -- OptionalStorage &operator=(const T &y) { -- *reinterpret_cast(storage.buffer) = y; -- hasVal = true; -- return *this; -- } -- -- void reset() { hasVal = false; } --}; --#endif - } // namespace optional_detail - - template class Optional { -diff --git a/unittests/ADT/OptionalTest.cpp b/unittests/ADT/OptionalTest.cpp -index 2e09c53..20bc9da 100644 ---- a/unittests/ADT/OptionalTest.cpp -+++ b/unittests/ADT/OptionalTest.cpp -@@ -518,13 +518,5 @@ TEST_F(OptionalTest, OperatorGreaterEqual) { - CheckRelation(InequalityLhs, InequalityRhs, !IsLess); - } - --#if __has_feature(is_trivially_copyable) && defined(_LIBCPP_VERSION) --static_assert(std::is_trivially_copyable>::value, -- "Should be trivially copyable"); --static_assert( -- !std::is_trivially_copyable>::value, -- "Shouldn't be trivially copyable"); --#endif -- - } // end anonymous namespace - --- -1.8.3.1 - diff --git a/SOURCES/0001-Selectively-disable-threading-from-gold.patch b/SOURCES/0001-Selectively-disable-threading-from-gold.patch new file mode 100644 index 0000000..ddeadec --- /dev/null +++ b/SOURCES/0001-Selectively-disable-threading-from-gold.patch @@ -0,0 +1,381 @@ +From 5fd2c900e90445c6efb7b97f8c663e588bcab81b Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Tue, 2 Jul 2019 09:25:52 +0000 +Subject: [PATCH] Selectively disable threading from gold + +Related: rhbz#1636479 +--- + llvm/include/llvm/LTO/LTO.h | 3 + + llvm/include/llvm/LTO/LTOBackend.h | 3 + + llvm/include/llvm/Support/ThreadPool.h | 7 ++ + llvm/lib/LTO/LTO.cpp | 134 ++++++++++++++++++++++++- + llvm/lib/LTO/LTOBackend.cpp | 48 ++++++++- + llvm/lib/Support/ThreadPool.cpp | 6 +- + llvm/tools/gold/gold-plugin.cpp | 7 +- + 7 files changed, 197 insertions(+), 11 deletions(-) + +diff --git a/llvm/include/llvm/LTO/LTO.h b/llvm/include/llvm/LTO/LTO.h +index 534d9b6f3f2..9dfda126540 100644 +--- a/llvm/include/llvm/LTO/LTO.h ++++ b/llvm/include/llvm/LTO/LTO.h +@@ -212,6 +212,7 @@ typedef std::function( + + /// This ThinBackend runs the individual backend jobs in-process. + ThinBackend createInProcessThinBackend(unsigned ParallelismLevel); ++ThinBackend createInProcessThinBackendNoThread(unsigned ParallelismLevel); + + /// This ThinBackend writes individual module indexes to files, instead of + /// running the individual backend jobs. This backend is for distributed builds +@@ -281,6 +282,7 @@ public: + /// The client will receive at most one callback (via either AddStream or + /// Cache) for each task identifier. + Error run(AddStreamFn AddStream, NativeObjectCache Cache = nullptr); ++ Error runNoThread(AddStreamFn AddStream, NativeObjectCache Cache = nullptr); + + private: + Config Conf; +@@ -397,6 +399,7 @@ private: + const SymbolResolution *&ResI, const SymbolResolution *ResE); + + Error runRegularLTO(AddStreamFn AddStream); ++ Error runRegularLTONoThread(AddStreamFn AddStream); + Error runThinLTO(AddStreamFn AddStream, NativeObjectCache Cache); + + mutable bool CalledGetMaxTasks = false; +diff --git a/llvm/include/llvm/LTO/LTOBackend.h b/llvm/include/llvm/LTO/LTOBackend.h +index d4743f6940f..2d6461fa82e 100644 +--- a/llvm/include/llvm/LTO/LTOBackend.h ++++ b/llvm/include/llvm/LTO/LTOBackend.h +@@ -39,6 +39,9 @@ namespace lto { + Error backend(Config &C, AddStreamFn AddStream, + unsigned ParallelCodeGenParallelismLevel, + std::unique_ptr M, ModuleSummaryIndex &CombinedIndex); ++Error backendNoThread(Config &C, AddStreamFn AddStream, ++ unsigned ParallelCodeGenParallelismLevel, ++ std::unique_ptr M, ModuleSummaryIndex &CombinedIndex); + + /// Runs a ThinLTO backend. + Error thinBackend(Config &C, unsigned Task, AddStreamFn AddStream, Module &M, +diff --git a/llvm/include/llvm/Support/ThreadPool.h b/llvm/include/llvm/Support/ThreadPool.h +index 4fdbd528b21..60ea5097114 100644 +--- a/llvm/include/llvm/Support/ThreadPool.h ++++ b/llvm/include/llvm/Support/ThreadPool.h +@@ -98,4 +98,11 @@ private: + }; + } + ++#ifndef ThreadPool ++#undef LLVM_SUPPORT_THREAD_POOL_H ++#define ThreadPool SequentialThreadPool ++#include "llvm/Support/ThreadPool.h" ++#undef ThreadPool ++#endif ++ + #endif // LLVM_SUPPORT_THREAD_POOL_H +diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp +index 3a955060dea..a7b4f45b18c 100644 +--- a/llvm/lib/LTO/LTO.cpp ++++ b/llvm/lib/LTO/LTO.cpp +@@ -861,6 +861,58 @@ Error LTO::run(AddStreamFn AddStream, NativeObjectCache Cache) { + return Result; + } + ++Error LTO::runNoThread(AddStreamFn AddStream, NativeObjectCache Cache) { ++ // Compute "dead" symbols, we don't want to import/export these! ++ DenseSet GUIDPreservedSymbols; ++ DenseMap GUIDPrevailingResolutions; ++ for (auto &Res : GlobalResolutions) { ++ // Normally resolution have IR name of symbol. We can do nothing here ++ // otherwise. See comments in GlobalResolution struct for more details. ++ if (Res.second.IRName.empty()) ++ continue; ++ ++ GlobalValue::GUID GUID = GlobalValue::getGUID( ++ GlobalValue::dropLLVMManglingEscape(Res.second.IRName)); ++ ++ if (Res.second.VisibleOutsideSummary && Res.second.Prevailing) ++ GUIDPreservedSymbols.insert(GlobalValue::getGUID( ++ GlobalValue::dropLLVMManglingEscape(Res.second.IRName))); ++ ++ GUIDPrevailingResolutions[GUID] = ++ Res.second.Prevailing ? PrevailingType::Yes : PrevailingType::No; ++ } ++ ++ auto isPrevailing = [&](GlobalValue::GUID G) { ++ auto It = GUIDPrevailingResolutions.find(G); ++ if (It == GUIDPrevailingResolutions.end()) ++ return PrevailingType::Unknown; ++ return It->second; ++ }; ++ computeDeadSymbolsWithConstProp(ThinLTO.CombinedIndex, GUIDPreservedSymbols, ++ isPrevailing, Conf.OptLevel > 0); ++ ++ // Setup output file to emit statistics. ++ std::unique_ptr StatsFile = nullptr; ++ if (!Conf.StatsFile.empty()) { ++ EnableStatistics(false); ++ std::error_code EC; ++ StatsFile = ++ llvm::make_unique(Conf.StatsFile, EC, sys::fs::F_None); ++ if (EC) ++ return errorCodeToError(EC); ++ StatsFile->keep(); ++ } ++ ++ Error Result = runRegularLTONoThread(AddStream); ++ if (!Result) ++ Result = runThinLTO(AddStream, Cache); ++ ++ if (StatsFile) ++ PrintStatisticsJSON(StatsFile->os()); ++ ++ return Result; ++} ++ + Error LTO::runRegularLTO(AddStreamFn AddStream) { + for (auto &M : RegularLTO.ModsWithSummaries) + if (Error Err = linkRegularLTO(std::move(M), +@@ -928,6 +980,73 @@ Error LTO::runRegularLTO(AddStreamFn AddStream) { + std::move(RegularLTO.CombinedModule), ThinLTO.CombinedIndex); + } + ++Error LTO::runRegularLTONoThread(AddStreamFn AddStream) { ++ for (auto &M : RegularLTO.ModsWithSummaries) ++ if (Error Err = linkRegularLTO(std::move(M), ++ /*LivenessFromIndex=*/true)) ++ return Err; ++ ++ // Make sure commons have the right size/alignment: we kept the largest from ++ // all the prevailing when adding the inputs, and we apply it here. ++ const DataLayout &DL = RegularLTO.CombinedModule->getDataLayout(); ++ for (auto &I : RegularLTO.Commons) { ++ if (!I.second.Prevailing) ++ // Don't do anything if no instance of this common was prevailing. ++ continue; ++ GlobalVariable *OldGV = RegularLTO.CombinedModule->getNamedGlobal(I.first); ++ if (OldGV && DL.getTypeAllocSize(OldGV->getValueType()) == I.second.Size) { ++ // Don't create a new global if the type is already correct, just make ++ // sure the alignment is correct. ++ OldGV->setAlignment(I.second.Align); ++ continue; ++ } ++ ArrayType *Ty = ++ ArrayType::get(Type::getInt8Ty(RegularLTO.Ctx), I.second.Size); ++ auto *GV = new GlobalVariable(*RegularLTO.CombinedModule, Ty, false, ++ GlobalValue::CommonLinkage, ++ ConstantAggregateZero::get(Ty), ""); ++ GV->setAlignment(I.second.Align); ++ if (OldGV) { ++ OldGV->replaceAllUsesWith(ConstantExpr::getBitCast(GV, OldGV->getType())); ++ GV->takeName(OldGV); ++ OldGV->eraseFromParent(); ++ } else { ++ GV->setName(I.first); ++ } ++ } ++ ++ if (Conf.PreOptModuleHook && ++ !Conf.PreOptModuleHook(0, *RegularLTO.CombinedModule)) ++ return Error::success(); ++ ++ if (!Conf.CodeGenOnly) { ++ for (const auto &R : GlobalResolutions) { ++ if (!R.second.isPrevailingIRSymbol()) ++ continue; ++ if (R.second.Partition != 0 && ++ R.second.Partition != GlobalResolution::External) ++ continue; ++ ++ GlobalValue *GV = ++ RegularLTO.CombinedModule->getNamedValue(R.second.IRName); ++ // Ignore symbols defined in other partitions. ++ // Also skip declarations, which are not allowed to have internal linkage. ++ if (!GV || GV->hasLocalLinkage() || GV->isDeclaration()) ++ continue; ++ GV->setUnnamedAddr(R.second.UnnamedAddr ? GlobalValue::UnnamedAddr::Global ++ : GlobalValue::UnnamedAddr::None); ++ if (EnableLTOInternalization && R.second.Partition == 0) ++ GV->setLinkage(GlobalValue::InternalLinkage); ++ } ++ ++ if (Conf.PostInternalizeModuleHook && ++ !Conf.PostInternalizeModuleHook(0, *RegularLTO.CombinedModule)) ++ return Error::success(); ++ } ++ return backendNoThread(Conf, AddStream, RegularLTO.ParallelCodeGenParallelismLevel, ++ std::move(RegularLTO.CombinedModule), ThinLTO.CombinedIndex); ++} ++ + /// This class defines the interface to the ThinLTO backend. + class lto::ThinBackendProc { + protected: +@@ -952,8 +1071,9 @@ public: + }; + + namespace { ++template + class InProcessThinBackend : public ThinBackendProc { +- ThreadPool BackendThreadPool; ++ ThreadEngine BackendThreadPool; + AddStreamFn AddStream; + NativeObjectCache Cache; + std::set CfiFunctionDefs; +@@ -1065,9 +1185,19 @@ ThinBackend lto::createInProcessThinBackend(unsigned ParallelismLevel) { + return [=](Config &Conf, ModuleSummaryIndex &CombinedIndex, + const StringMap &ModuleToDefinedGVSummaries, + AddStreamFn AddStream, NativeObjectCache Cache) { +- return llvm::make_unique( ++ return llvm::make_unique>( ++ Conf, CombinedIndex, ParallelismLevel, ModuleToDefinedGVSummaries, ++ AddStream, Cache); ++ }; ++} ++ThinBackend lto::createInProcessThinBackendNoThread(unsigned ParallelismLevel) { ++ return [=](Config &Conf, ModuleSummaryIndex &CombinedIndex, ++ const StringMap &ModuleToDefinedGVSummaries, ++ AddStreamFn AddStream, NativeObjectCache Cache) { ++ ThinBackendProc* Backend = new InProcessThinBackend( + Conf, CombinedIndex, ParallelismLevel, ModuleToDefinedGVSummaries, + AddStream, Cache); ++ return std::unique_ptr(Backend); + }; + } + +diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp +index 926c419e34a..2c263ed86a9 100644 +--- a/llvm/lib/LTO/LTOBackend.cpp ++++ b/llvm/lib/LTO/LTOBackend.cpp +@@ -333,10 +333,11 @@ void codegen(Config &Conf, TargetMachine *TM, AddStreamFn AddStream, + DwoOut->keep(); + } + +-void splitCodeGen(Config &C, TargetMachine *TM, AddStreamFn AddStream, ++template ++static void splitCodeGen_(Config &C, TargetMachine *TM, AddStreamFn AddStream, + unsigned ParallelCodeGenParallelismLevel, + std::unique_ptr Mod) { +- ThreadPool CodegenThreadPool(ParallelCodeGenParallelismLevel); ++ ThreadPoolEngine CodegenThreadPool(ParallelCodeGenParallelismLevel); + unsigned ThreadCount = 0; + const Target *T = &TM->getTarget(); + +@@ -380,6 +381,17 @@ void splitCodeGen(Config &C, TargetMachine *TM, AddStreamFn AddStream, + // can leave the function scope. + CodegenThreadPool.wait(); + } ++void splitCodeGen(Config &C, TargetMachine *TM, AddStreamFn AddStream, ++ unsigned ParallelCodeGenParallelismLevel, ++ std::unique_ptr Mod) { ++ splitCodeGen_(C, TM, AddStream, ParallelCodeGenParallelismLevel, std::move(Mod)); ++} ++ ++void splitCodeGenNoThread(Config &C, TargetMachine *TM, AddStreamFn AddStream, ++ unsigned ParallelCodeGenParallelismLevel, ++ std::unique_ptr Mod) { ++ splitCodeGen_(C, TM, AddStream, ParallelCodeGenParallelismLevel, std::move(Mod)); ++} + + Expected initAndLookupTarget(Config &C, Module &Mod) { + if (!C.OverrideTriple.empty()) +@@ -439,6 +451,38 @@ Error lto::backend(Config &C, AddStreamFn AddStream, + return finalizeOptimizationRemarks(std::move(DiagnosticOutputFile)); + } + ++Error lto::backendNoThread(Config &C, AddStreamFn AddStream, ++ unsigned ParallelCodeGenParallelismLevel, ++ std::unique_ptr Mod, ++ ModuleSummaryIndex &CombinedIndex) { ++ Expected TOrErr = initAndLookupTarget(C, *Mod); ++ if (!TOrErr) ++ return TOrErr.takeError(); ++ ++ std::unique_ptr TM = createTargetMachine(C, *TOrErr, *Mod); ++ ++ // Setup optimization remarks. ++ auto DiagFileOrErr = lto::setupOptimizationRemarks( ++ Mod->getContext(), C.RemarksFilename, C.RemarksWithHotness); ++ if (!DiagFileOrErr) ++ return DiagFileOrErr.takeError(); ++ auto DiagnosticOutputFile = std::move(*DiagFileOrErr); ++ ++ if (!C.CodeGenOnly) { ++ if (!opt(C, TM.get(), 0, *Mod, /*IsThinLTO=*/false, ++ /*ExportSummary=*/&CombinedIndex, /*ImportSummary=*/nullptr)) ++ return finalizeOptimizationRemarks(std::move(DiagnosticOutputFile)); ++ } ++ ++ if (ParallelCodeGenParallelismLevel == 1) { ++ codegen(C, TM.get(), AddStream, 0, *Mod); ++ } else { ++ splitCodeGenNoThread(C, TM.get(), AddStream, ParallelCodeGenParallelismLevel, ++ std::move(Mod)); ++ } ++ return finalizeOptimizationRemarks(std::move(DiagnosticOutputFile)); ++} ++ + static void dropDeadSymbols(Module &Mod, const GVSummaryMapTy &DefinedGlobals, + const ModuleSummaryIndex &Index) { + std::vector DeadGVs; +diff --git a/llvm/lib/Support/ThreadPool.cpp b/llvm/lib/Support/ThreadPool.cpp +index d0212ca1346..3d760edbcb7 100644 +--- a/llvm/lib/Support/ThreadPool.cpp ++++ b/llvm/lib/Support/ThreadPool.cpp +@@ -19,8 +19,6 @@ + + using namespace llvm; + +-#if LLVM_ENABLE_THREADS +- + // Default to hardware_concurrency + ThreadPool::ThreadPool() : ThreadPool(hardware_concurrency()) {} + +@@ -107,7 +105,7 @@ ThreadPool::~ThreadPool() { + Worker.join(); + } + +-#else // LLVM_ENABLE_THREADS Disabled ++#define ThreadPool SequentialThreadPool + + ThreadPool::ThreadPool() : ThreadPool(0) {} + +@@ -142,5 +140,3 @@ std::shared_future ThreadPool::asyncImpl(TaskTy Task) { + ThreadPool::~ThreadPool() { + wait(); + } +- +-#endif +diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp +index 738cafa6cac..8ef75d2589c 100644 +--- a/llvm/tools/gold/gold-plugin.cpp ++++ b/llvm/tools/gold/gold-plugin.cpp +@@ -848,7 +848,7 @@ static std::unique_ptr createLTO(IndexWriteCallback OnIndexWrite, + Conf.DisableVerify = options::DisableVerify; + Conf.OptLevel = options::OptLevel; + if (options::Parallelism) +- Backend = createInProcessThinBackend(options::Parallelism); ++ Backend = createInProcessThinBackendNoThread(options::Parallelism); + if (options::thinlto_index_only) { + std::string OldPrefix, NewPrefix; + getThinLTOOldAndNewPrefix(OldPrefix, NewPrefix); +@@ -856,6 +856,9 @@ static std::unique_ptr createLTO(IndexWriteCallback OnIndexWrite, + options::thinlto_emit_imports_files, + LinkedObjectsFile, OnIndexWrite); + } ++ if(!Backend) ++ Backend = createInProcessThinBackendNoThread(llvm::heavyweight_hardware_concurrency()); ++ + + Conf.OverrideTriple = options::triple; + Conf.DefaultTriple = sys::getDefaultTargetTriple(); +@@ -1039,7 +1042,7 @@ static std::vector, bool>> runLTO() { + if (!options::cache_dir.empty()) + Cache = check(localCache(options::cache_dir, AddBuffer)); + +- check(Lto->run(AddStream, Cache)); ++ check(Lto->runNoThread(AddStream, Cache)); + + // Write empty output files that may be expected by the distributed build + // system. +-- +2.20.1 + diff --git a/SOURCES/0001-unittests-Don-t-install-TestPlugin.so.patch b/SOURCES/0001-unittests-Don-t-install-TestPlugin.so.patch deleted file mode 100644 index f614036..0000000 --- a/SOURCES/0001-unittests-Don-t-install-TestPlugin.so.patch +++ /dev/null @@ -1,62 +0,0 @@ -From cf1fb43186fd4d97ee2de0b222d44ecc500f82c7 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Mon, 13 Aug 2018 12:22:28 -0700 -Subject: [PATCH] unittests: Don't install TestPlugin.so - -add_llvm_loadable_module adds an install target by default, but this -module is only used for a unit test, so we don't need to instal it. - -This patch adds a NO_INSTALL option to add_llvm_loadable_module that -can be used to disable installation of modules. ---- - cmake/modules/AddLLVM.cmake | 13 ++++++++----- - unittests/Passes/CMakeLists.txt | 2 +- - 2 files changed, 9 insertions(+), 6 deletions(-) - -diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake -index 24ef5e4..1637ba6 100644 ---- a/cmake/modules/AddLLVM.cmake -+++ b/cmake/modules/AddLLVM.cmake -@@ -671,7 +671,8 @@ macro(add_llvm_library name) - endmacro(add_llvm_library name) - - macro(add_llvm_loadable_module name) -- llvm_add_library(${name} MODULE ${ARGN}) -+ cmake_parse_arguments(ARG "NO_INSTALL" "" "" ${ARGN}) -+ llvm_add_library(${name} MODULE ${ARG_UNPARSED_ARGUMENTS}) - if(NOT TARGET ${name}) - # Add empty "phony" target - add_custom_target(${name}) -@@ -693,10 +694,12 @@ macro(add_llvm_loadable_module name) - set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True) - endif() - -- install(TARGETS ${name} -- ${export_to_llvmexports} -- LIBRARY DESTINATION ${dlldir} -- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) -+ if (NOT ARG_NO_INSTALL) -+ install(TARGETS ${name} -+ ${export_to_llvmexports} -+ LIBRARY DESTINATION ${dlldir} -+ ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) -+ endif() - endif() - set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) - endif() -diff --git a/unittests/Passes/CMakeLists.txt b/unittests/Passes/CMakeLists.txt -index d90df20..99390e6 100644 ---- a/unittests/Passes/CMakeLists.txt -+++ b/unittests/Passes/CMakeLists.txt -@@ -14,7 +14,7 @@ add_llvm_unittest(PluginsTests - export_executable_symbols(PluginsTests) - - set(LLVM_LINK_COMPONENTS) --add_llvm_loadable_module(TestPlugin -+add_llvm_loadable_module(TestPlugin NO_INSTALL - TestPlugin.cpp - ) - --- -1.8.3.1 - diff --git a/SOURCES/0002-test-Fix-Assembler-debug-info.ll.patch b/SOURCES/0002-test-Fix-Assembler-debug-info.ll.patch deleted file mode 100644 index d022d97..0000000 --- a/SOURCES/0002-test-Fix-Assembler-debug-info.ll.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 9bfebd6e47cb8513dcd7f7203f29489bdec7bfe4 Mon Sep 17 00:00:00 2001 -From: Jonas Devlieghere -Date: Fri, 21 Sep 2018 12:28:44 +0000 -Subject: [PATCH 2/2] [test] Fix Assembler/debug-info.ll - -Update Assembler/debug-info.ll to contain discriminator. - -llvm-svn: 342727 ---- - llvm/test/Assembler/debug-info.ll | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/test/Assembler/debug-info.ll b/test/Assembler/debug-info.ll -index 5dfb8cd93435..605afc3f1587 100644 ---- a/test/Assembler/debug-info.ll -+++ b/test/Assembler/debug-info.ll -@@ -83,7 +83,7 @@ - ; CHECK-NEXT: !32 = !DIFile(filename: "file", directory: "dir", checksumkind: CSK_MD5, checksum: "000102030405060708090a0b0c0d0e0f") - !35 = !DIFile(filename: "file", directory: "dir", checksumkind: CSK_MD5, checksum: "000102030405060708090a0b0c0d0e0f") - --; CHECK-NEXT: !33 = !DICompositeType(tag: DW_TAG_variant_part, name: "A", scope: !14, size: 64) -+; CHECK-NEXT: !33 = !DICompositeType(tag: DW_TAG_variant_part, name: "A", scope: !14, size: 64, discriminator: !34) - ; CHECK-NEXT: !34 = !DIDerivedType(tag: DW_TAG_member, scope: !33, baseType: !35, size: 64, align: 64, flags: DIFlagArtificial) - ; CHECK-NEXT: !35 = !DIBasicType(name: "u64", size: 64, encoding: DW_ATE_unsigned) - !36 = !DICompositeType(tag: DW_TAG_variant_part, name: "A", scope: !16, size: 64, discriminator: !37) --- -2.20.1 - diff --git a/SOURCES/lit.fedora.cfg.py b/SOURCES/lit.fedora.cfg.py new file mode 100644 index 0000000..1c918b4 --- /dev/null +++ b/SOURCES/lit.fedora.cfg.py @@ -0,0 +1,17 @@ + +config.llvm_tools_dir = '/usr/bin' +config.llvm_shlib_dir = '%(llvm_shlib_dir)s' % lit_config.params + +if hasattr(config, 'host_triple'): + # This means we are running lit regression tests + + # Regression tests write output to this directory, so we need to be able to specify + # a temp directory when invoking lit. e.g. lit -Dllvm_obj_root=/tmp/lit + config.llvm_obj_root = "%(llvm_obj_root)s" % lit_config.params + lit_config.load_config(config, '%(llvm_test_root)s/lit.cfg.py' % lit_config.params) +else: + # This means we are running lit unit tests + + # For unit tests, llvm_obj_root is used to find the unit test binaries. + config.llvm_obj_root = '%(llvm_unittest_bindir)s' % lit_config.params + lit_config.load_config(config, '%(llvm_test_root)s/Unit/lit.cfg.py' % lit_config.params) diff --git a/SOURCES/run-lit-tests b/SOURCES/run-lit-tests index a0a5d5b..a0f27d8 100755 --- a/SOURCES/run-lit-tests +++ b/SOURCES/run-lit-tests @@ -2,7 +2,9 @@ usage() { echo "usage: `basename $0` [OPTIONS]" - echo " --threads NUM The number of threads to use for running tests." + echo " --threads NUM The number of threads to use for running tests." + echo " --multilib-arch ARCH Use this option to test 32-bit libs/binaries on" + echo " 64-bit hosts." } threads_arg='' @@ -13,6 +15,10 @@ while [ $# -gt 0 ]; do shift threads_arg="--threads $1" ;; + --multilib-arch) + shift + ARCH=$1 + ;; * ) echo "unknown option: $1" echo "" @@ -25,15 +31,28 @@ done set -xe -TOOLS_DIR=@TOOLS_DIR@ +if [ -z "$ARCH" ]; then + ARCH=`rpm --eval '%_arch'` +fi + +case $ARCH in + arm) + ;& + i686) + LIB_DIR="/usr/lib/" + ;; + *) + LIB_DIR="/usr/lib64/" + ;; +esac + cd $(mktemp -d) ln -s /usr/include include tar -xzf /usr/share/llvm/src/test.tar.gz -PATH=$PATH:$TOOLS_DIR lit -v -s $threads_arg test \ - -DFileCheck=$TOOLS_DIR/FileCheck \ - -Dcount=$TOOLS_DIR/count \ - -Dnot=$TOOLS_DIR/not \ - -Dlli-child-target=$TOOLS_DIR/lli-child-target \ - -Dllvm-isel-fuzzer=$TOOLS_DIR/llvm-isel-fuzzer \ - -Dllvm-opt-fuzzer=$TOOLS_DIR/llvm-opt-fuzzer \ - -Dyaml-bench=$TOOLS_DIR/yaml-bench +ln -s $ARCH.site.cfg.py test/lit.site.cfg.py +ln -s $ARCH.site.cfg.py test/Unit/lit.site.cfg.py +lit -v -s $threads_arg test \ + -Dllvm_obj_root=`pwd` \ + -Dllvm_test_root=`pwd`/test \ + -Dllvm_unittest_bindir=$LIB_DIR/llvm \ + -Dllvm_shlib_dir=$LIB_DIR diff --git a/SPECS/llvm.spec b/SPECS/llvm.spec index 97a2738..90e93b0 100644 --- a/SPECS/llvm.spec +++ b/SPECS/llvm.spec @@ -1,87 +1,82 @@ # Components enabled if supported by target architecture: -%ifarch %ix86 x86_64 +%define gold_arches %{ix86} x86_64 %{arm} aarch64 %{power64} +%ifarch %{gold_arches} %bcond_without gold %else %bcond_with gold %endif -%global llvm_bindir %{_libdir}/%{name} -%global maj_ver 7 +%global llvm_srcdir llvm-%{version}%{?rc_ver:rc%{rc_ver}}.src + +%global build_llvm_bindir %{buildroot}%{_bindir} +%global llvm_libdir %{_libdir}/%{name} +%global build_llvm_libdir %{buildroot}%{llvm_libdir} +%global maj_ver 8 %global min_ver 0 %global patch_ver 1 +#%%global rc_ver 2 +#%%global compat_version 7.0.1 -%ifarch ppc64 ppc64le -%global host_target PowerPC -# Limit build jobs on ppc64 systems to avoid running out of memory. -%global _smp_mflags -j8 -%endif -%ifnarch i686 +%global pkg_name llvm +%global install_prefix /usr +%global install_libdir %{_libdir} +%global pkg_libdir %{install_libdir} + +%global build_install_prefix %{buildroot}%{install_prefix} +%global build_pkgdocdir %{buildroot}%{_pkgdocdir} + +#%%ifnarch i686 %global enable_test_pkg 1 +#%%endif + +%if !0%{?rhel} +# libedit-devel is a buildroot-only package in RHEL8, so we can't have a +# any run-time depencies on it. +%global use_libedit 1 %endif -Name: llvm +Name: %{pkg_name} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 3%{?dist} +Release: 1%{?rc_ver:.rc%{rc_ver}}%{?dist} Summary: The Low Level Virtual Machine License: NCSA URL: http://llvm.org -Source0: http://llvm.org/releases/%{version}/%{name}-%{version}%{?rc_ver:rc%{rc_ver}}.src.tar.xz +Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-%{rc_ver}}/%{llvm_srcdir}.tar.xz Source1: run-lit-tests +Source2: lit.fedora.cfg.py %if %{defined compat_version} Source100: http://llvm.org/releases/%{compat_version}/%{name}-%{compat_version}.src.tar.xz %endif -Patch3: 0001-CMake-Split-static-library-exports-into-their-own-ex.patch -Patch7: 0001-Filter-out-cxxflags-not-supported-by-clang.patch - -Patch12: 0001-unittests-Don-t-install-TestPlugin.so.patch -# If python2 is available on the system, llvm will try to use it. This patch -# removes the preferences for python2, so we can make sure we always use -# python3. -Patch14: 0001-CMake-Don-t-prefer-python2.7.patch -Patch15: 0001-Don-t-set-rpath-when-installing.patch -Patch16: 0001-Re-apply-r346985-ADT-Drop-llvm-Optional-clang-specif.patch -#rhbz#1636479 -Patch17: 0001-Disable-threading-in-thinLTO.patch -#rhbz#1696190 -Patch19: 0001-GlobalISel-Lower-dbg.declare-into-indirect-DBG_VALUE.patch -#rhbz#1699374 -Patch20: 0001-Ensure-that-variant-part-discriminator-is-read-by-Me.patch -Patch21: 0002-test-Fix-Assembler-debug-info.ll.patch - +Patch2: 0001-Selectively-disable-threading-from-gold.patch +Patch3: 0001-Filter-out-cxxflags-not-supported-by-clang.patch +Patch4: 0001-Deactivate-markdown-doc.patch -%if %{defined compat_version} -# Compat patches -# rhbz#1595996 -Patch1000: 0001-Don-t-run-BV-DAG-Combine-before-legalization-if-it-a.patch -# rhbz#161005 -Patch1001: 0001-SystemZ-TableGen-Fix-shift-count-handling.patch -# rhbz#1562196 -Patch1002: 0001-PowerPC-Do-not-round-values-prior-to-converting-to-i.patch -Patch1003: 0001-CMake-Don-t-prefer-python2.7.patch -%endif - -BuildRequires: gcc -BuildRequires: gcc-c++ +BuildRequires: gcc +BuildRequires: gcc-c++ BuildRequires: cmake +BuildRequires: ninja-build BuildRequires: zlib-devel -BuildRequires: libffi-devel +BuildRequires: libffi-devel BuildRequires: ncurses-devel BuildRequires: python3-sphinx +#BuildRequires: python3-recommonmark BuildRequires: multilib-rpm-config -# This pulls in /usr/bin/python3 -BuildRequires: python3-devel - %if %{with gold} -BuildRequires: binutils-devel +BuildRequires: binutils-devel %endif - %ifarch %{valgrind_arches} # Enable extra functionality when run the LLVM JIT under valgrind. -BuildRequires: valgrind-devel +BuildRequires: valgrind-devel %endif +%if 0%{?use_libedit} +# LLVM's LineEditor library will use libedit if it is available. +BuildRequires: libedit-devel +%endif +# We need python3-devel for pathfix.py. +BuildRequires: python3-devel Requires: %{name}-libs%{?_isa} = %{version}-%{release} @@ -94,8 +89,14 @@ tools as well as libraries with equivalent functionality. %package devel Summary: Libraries and header files for LLVM Requires: %{name}%{?_isa} = %{version}-%{release} -Requires(post): %{_sbindir}/alternatives -Requires(postun): %{_sbindir}/alternatives +# The installed LLVM cmake files will add -ledit to the linker flags for any +# app that requires the libLLVMLineEditor, so we need to make sure +# libedit-devel is available. +%if 0%{?use_libedit} +Requires: libedit-devel +%endif +Requires(post): %{_sbindir}/alternatives +Requires(postun): %{_sbindir}/alternatives %description devel This package contains library and header files needed to develop new native @@ -117,6 +118,7 @@ Shared libraries for the LLVM compiler infrastructure. %package static Summary: LLVM static libraries +Conflicts: %{name}-devel < 8 %description static Static libraries for the LLVM compiler infrastructure. @@ -124,7 +126,7 @@ Static libraries for the LLVM compiler infrastructure. %if 0%{?enable_test_pkg} %package test -Summary: LLVM regression tests. +Summary: LLVM regression tests Requires: %{name}%{?_isa} = %{version}-%{release} Requires: python3-lit # The regression tests need gold. @@ -133,7 +135,6 @@ Requires: binutils Requires: %{name}-devel%{?_isa} = %{version}-%{release} # Bugpoint tests require gcc Requires: gcc -Requires: diffutils Requires: findutils %description test @@ -142,7 +143,7 @@ LLVM regression tests. %endif %package googletest -Summary: LLVM's modified googletest sources. +Summary: LLVM's modified googletest sources %description googletest LLVM's modified googletest sources. @@ -150,44 +151,41 @@ LLVM's modified googletest sources. %prep %if %{defined compat_version} %setup -T -q -b 100 -n llvm-%{compat_version}.src -%patch1000 -p1 -%patch1001 -p1 -%patch1002 -p1 -%patch1003 -p1 %setup -q -n llvm-%{version}%{?rc_ver:rc%{rc_ver}}.src -%patch3 -p1 -%patch7 -p1 -%patch12 -p1 -%patch14 -p1 -%patch15 -p1 -%patch16 -p1 -%patch17 -p1 +%patch2 -p2 +%patch3 -p2 +%patch4 -p2 %else -%autosetup -n %{name}-%{version}%{?rc_ver:rc%{rc_ver}}.src -p1 +%autosetup -n llvm-%{version}%{?rc_ver:rc%{rc_ver}}.src -p2 %endif pathfix.py -i %{__python3} -pn \ test/BugPoint/compile-custom.ll.py \ tools/opt-viewer/*.py -sed -i 's~@TOOLS_DIR@~%{llvm_bindir}~' %{SOURCE1} - %build mkdir -p _build cd _build -%ifarch s390 %ix86 +%ifarch s390 %{arm} %ix86 # Decrease debuginfo verbosity to reduce memory consumption during final library linking %global optflags %(echo %{optflags} | sed 's/-g /-g1 /') %endif # force off shared libs as cmake macros turns it on. -%cmake .. \ +# +# -DCMAKE_INSTALL_RPATH=";" is a workaround for llvm manually setting the +# rpath of libraries and binaries. llvm will skip the manual setting +# if CAMKE_INSTALL_RPATH is set to a value, but cmake interprets this value +# as nothing, so it sets the rpath to "" when installing. +%cmake .. -G Ninja \ -DBUILD_SHARED_LIBS:BOOL=OFF \ + -DLLVM_PARALLEL_LINK_JOBS=1 \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -%ifarch s390 %ix86 + -DCMAKE_INSTALL_RPATH=";" \ +%ifarch s390 s390x %{arm} %ix86 -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ %endif @@ -219,7 +217,8 @@ cd _build \ -DLLVM_INCLUDE_UTILS:BOOL=ON \ -DLLVM_INSTALL_UTILS:BOOL=ON \ - -DLLVM_UTILS_INSTALL_DIR:PATH=%{llvm_bindir} \ + -DLLVM_UTILS_INSTALL_DIR:PATH=%{build_llvm_bindir} \ + -DLLVM_TOOLS_INSTALL_DIR:PATH=bin \ \ -DLLVM_INCLUDE_DOCS:BOOL=ON \ -DLLVM_BUILD_DOCS:BOOL=ON \ @@ -232,14 +231,18 @@ cd _build -DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON \ -DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF \ \ - -DSPHINX_WARNINGS_AS_ERRORS=OFF + -DSPHINX_WARNINGS_AS_ERRORS=OFF \ + -DCMAKE_INSTALL_PREFIX=%{build_install_prefix} \ + -DLLVM_INSTALL_SPHINX_HTML_DIR=%{build_pkgdocdir}/html \ + -DSPHINX_EXECUTABLE=%{_bindir}/sphinx-build-3 -make -O %{?_smp_mflags} +ninja -v -j2 %if %{defined compat_version} mkdir ../compat-build cd ../compat-build %cmake ../../%{name}-%{compat_version}.src \ + -G Ninja \ -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_TARGETS_TO_BUILD="X86;AMDGPU;PowerPC;NVPTX;SystemZ;AArch64;ARM;Mips;BPF" \ @@ -247,46 +250,52 @@ cd ../compat-build -DLLVM_ENABLE_ZLIB:BOOL=ON \ -DLLVM_ENABLE_FFI:BOOL=ON \ -DLLVM_BUILD_LLVM_DYLIB=ON -make -O %{?_smp_mflags} LLVM +ninja -v LLVM # Remove files we don't need to save disk space -mv lib/libLLVM-`echo %{compat_version} | cut -f1,2 -d .`.so .. +mv lib/libLLVM-`echo %{compat_version} | cut -f1 -d .`.so .. rm -Rf * %endif - %install -cd _build -make -O %{?_smp_mflags} install DESTDIR=%{buildroot} +ninja -C _build -v install + + +mkdir -p %{buildroot}/%{_bindir} +mv %{buildroot}/%{_bindir}/llvm-config %{buildroot}/%{_bindir}/llvm-config-%{__isa_bits} +ln -s llvm-config-%{__isa_bits} %{buildroot}/%{_bindir}/llvm-config + +# Fix some man pages +ln -s llvm-config.1 %{buildroot}%{_mandir}/man1/llvm-config-%{__isa_bits}.1 +mv %{buildroot}%{_mandir}/man1/tblgen.1 %{buildroot}%{_mandir}/man1/llvm-tblgen.1 + +# Install binaries needed for lit tests +%if 0%{?enable_test_pkg} +%global test_binaries FileCheck count lli-child-target llvm-PerfectShuffle llvm-isel-fuzzer llvm-opt-fuzzer not yaml-bench + +for f in %{test_binaries} +do + install -m 0755 ./_build/bin/$f %{build_llvm_bindir} +done + +%endif -# fix multi-lib -mv -v %{buildroot}%{_bindir}/llvm-config{,-%{__isa_bits}} %multilib_fix_c_header --file %{_includedir}/llvm/Config/llvm-config.h # Install libraries needed for unittests %if 0%{?__isa_bits} == 64 -%global build_libdir lib64 +%global build_libdir _build/lib64 %else -%global build_libdir lib +%global build_libdir _build/lib %endif install %{build_libdir}/libLLVMTestingSupport.a %{buildroot}%{_libdir} %global install_srcdir %{buildroot}%{_datadir}/llvm/src -%if 0%{?enable_test_pkg} -# Install binaries needed for lit tests -%global test_binaries lli-child-target llvm-isel-fuzzer llvm-opt-fuzzer yaml-bench -for f in %{test_binaries}; do -install -m 0755 ./bin/$f %{buildroot}%{llvm_bindir}/ -done - -%global install_srcdir %{buildroot}%{_datadir}/llvm/src -%global lit_cfg test/lit.site.cfg.py -%global lit_unit_cfg test/Unit/lit.site.cfg.py - -%endif -cd .. +%global lit_cfg test/%{_arch}.site.cfg.py +%global lit_unit_cfg test/Unit/%{_arch}.site.cfg.py +%global lit_fedora_cfg %{_datadir}/llvm/lit.fedora.cfg.py # Install gtest sources so clang can use them for gtest install -d %{install_srcdir} @@ -294,18 +303,18 @@ install -d %{install_srcdir}/utils/ cp -R utils/unittest %{install_srcdir}/utils/ %if 0%{?enable_test_pkg} +# Generate lit config files. Strip off the last line that initiates the +# test run, so we can customize the configuration. +head -n -1 _build/test/lit.site.cfg.py >> %{lit_cfg} +head -n -1 _build/test/Unit/lit.site.cfg.py >> %{lit_unit_cfg} -# Generate lit config files. -cat _build/test/lit.site.cfg.py >> %{lit_cfg} - -# Unit tests write output to this directory, so it can't be in /usr. -sed -i 's~\(config.llvm_obj_root = \)"[^"]\+"~\1"."~' %{lit_cfg} - -cat _build/test/Unit/lit.site.cfg.py >> %{lit_unit_cfg} -sed -i -e s~`pwd`/_build~%{_prefix}~g -e s~`pwd`~.~g %{lit_cfg} %{lit_cfg} %{lit_unit_cfg} +# Install custom fedora config file +cp %{SOURCE2} %{buildroot}%{lit_fedora_cfg} -# obj_root needs to be set to the directory containing the unit test binaries. -sed -i 's~\(config.llvm_obj_root = \)"[^"]\+"~\1"%{llvm_bindir}"~' %{lit_unit_cfg} +# Patch lit config files to load custom fedora config: +for f in %{lit_cfg} %{lit_unit_cfg}; do + echo "lit_config.load_config(config, '%{lit_fedora_cfg}')" >> $f +done install -d %{buildroot}%{_libexecdir}/tests/llvm install -m 0755 %{SOURCE1} %{buildroot}%{_libexecdir}/tests/llvm @@ -316,23 +325,38 @@ install -d %{buildroot}%{_datadir}/llvm/ tar -czf %{install_srcdir}/test.tar.gz test/ # Install the unit test binaries -cp -R _build/unittests %{buildroot}%{llvm_bindir}/ -# FIXME: Can't figure out how to make the find command succeed. -find %{buildroot}%{llvm_bindir} -ignore_readdir_race -iname 'cmake*' -exec rm -Rf '{}' ';' || true - +mkdir -p %{build_llvm_libdir} +cp -R _build/unittests %{build_llvm_libdir}/ +rm -rf `find %{build_llvm_libdir} -iname 'cmake*'` + +# Install libraries used for testing +install -m 0755 %{build_libdir}/BugpointPasses.so %{buildroot}%{_libdir} +install -m 0755 %{build_libdir}/LLVMHello.so %{buildroot}%{_libdir} + +# Install test inputs for PDB tests +echo "%{_datadir}/llvm/src/unittests/DebugInfo/PDB" > %{build_llvm_libdir}/unittests/DebugInfo/PDB/llvm.srcdir.txt +mkdir -p %{buildroot}%{_datadir}/llvm/src/unittests/DebugInfo/PDB/ +cp -R unittests/DebugInfo/PDB/Inputs %{buildroot}%{_datadir}/llvm/src/unittests/DebugInfo/PDB/ %endif + %if %{defined compat_version} cd compat-build -install ../libLLVM-`echo %{compat_version} | cut -f1,2 -d .`.so %{buildroot}%{_libdir} +install ../libLLVM-`echo %{compat_version} | cut -f1 -d .`.so %{buildroot}%{_libdir} %endif %check -cd _build -make check-all || : -%post libs -p /sbin/ldconfig -%postun libs -p /sbin/ldconfig +# TODO: Fix arm +ninja check-all -C _build || \ +%ifarch %{arm} + : +%else + false +%endif + + +%ldconfig_scriptlets libs %post devel %{_sbindir}/update-alternatives --install %{_bindir}/llvm-config llvm-config %{_bindir}/llvm-config-%{__isa_bits} %{__isa_bits} @@ -342,38 +366,45 @@ if [ $1 -eq 0 ]; then %{_sbindir}/update-alternatives --remove llvm-config %{_bindir}/llvm-config-%{__isa_bits} fi + %files +%exclude %{_bindir}/llvm-config* +%exclude %{_bindir}/not +%exclude %{_bindir}/count +%exclude %{_bindir}/yaml-bench +%exclude %{_bindir}/lli-child-target +%exclude %{_bindir}/llvm-isel-fuzzer +%exclude %{_bindir}/llvm-opt-fuzzer %{_bindir}/* -%{_mandir}/man1/*.1.* -%{llvm_bindir} -%exclude %{_bindir}/llvm-config-%{__isa_bits} -%exclude %{_mandir}/man1/llvm-config.1.* + +%exclude %{_mandir}/man1/llvm-config* +%{_mandir}/man1/* + %{_datadir}/opt-viewer -%exclude %{llvm_bindir}/unittests %files libs -%{_libdir}/BugpointPasses.so -%{_libdir}/LLVMHello.so +%{pkg_libdir}/libLLVM-%{maj_ver}.so %if %{with gold} %{_libdir}/LLVMgold.so %endif %{_libdir}/libLLVM-%{maj_ver}.%{min_ver}*.so -%{_libdir}/libLLVM-%{maj_ver}.so %{_libdir}/libLTO.so* +%{pkg_libdir}/libOptRemarks.so* %if %{defined compat_version} -%{_libdir}/libLLVM-6.0.so +%{_libdir}/libLLVM-7.so %endif %files devel -%{_bindir}/llvm-config-%{__isa_bits} -%{_mandir}/man1/llvm-config.1.* +%{_bindir}/llvm-config* +%{_mandir}/man1/llvm-config* %{_includedir}/llvm %{_includedir}/llvm-c %{_libdir}/libLLVM.so %{_libdir}/cmake/llvm +%exclude %{_libdir}/cmake/llvm/LLVMStaticExports.cmake %files doc -%doc %{_docdir}/llvm/html +%doc %{_pkgdocdir}/html %files static %{_libdir}/*.a @@ -383,24 +414,46 @@ fi %if 0%{?enable_test_pkg} %files test %{_libexecdir}/tests/llvm/ -%{llvm_bindir}/unittests/ +%{llvm_libdir}/unittests/ +%{_datadir}/llvm/src/unittests %{_datadir}/llvm/src/test.tar.gz -%{llvm_bindir}/yaml-bench -%{llvm_bindir}/lli-child-target -%{llvm_bindir}/llvm-isel-fuzzer -%{llvm_bindir}/llvm-opt-fuzzer +%{_datadir}/llvm/lit.fedora.cfg.py +%{_bindir}/not +%{_bindir}/count +%{_bindir}/yaml-bench +%{_bindir}/lli-child-target +%{_bindir}/llvm-isel-fuzzer +%{_bindir}/llvm-opt-fuzzer +%{_libdir}/BugpointPasses.so +%{_libdir}/LLVMHello.so %endif %files googletest %{_datadir}/llvm/src/utils %{_libdir}/libLLVMTestingSupport.a + %changelog -* Fri Apr 19 2019 Tom Stellard - 7.0.1-3 -- Backport r342725 from trunk +* Thu Aug 1 2019 sguelton@redhat.com - 8.0.1-1 +- 8.0.1 release + +* Tue Jul 2 2019 sguelton@redhat.com - 8.0.1-0.3.rc2 +- Deactivate multithreading for gold plugin only to fix rhbz#1636479 + +* Mon Jun 17 2019 sguelton@redhat.com - 8.0.1-0.2.rc2 +- Deactivate multithreading instead of patching to fix rhbz#1636479 + +* Thu Jun 13 2019 sguelton@redhat.com - 8.0.1-0.1.rc2 +- 8.0.1rc2 Release + +* Tue May 14 2019 sguelton@redhat.com - 8.0.0-3 +- Disable threading in LTO + +* Wed May 8 2019 sguelton@redhat.com - 8.0.0-2 +- Fix conflicts between llvm-static = 8 and llvm-dev < 8 around LLVMStaticExports.cmake -* Sat Apr 13 2019 Tom Stellard - 7.0.1-2 -- Backport r341969 from LLVM trunk +* Thu May 2 2019 sguelton@redhat.com - 8.0.0-1 +- 8.0.0 Release * Fri Dec 14 2018 Tom Stellard - 7.0.1-1 - 7.0.1 Release