From d2dbf70a14d4bf8b58ebcbdefd8d6467a09a2502 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 19 Apr 2023 10:29:26 +0200 Subject: [PATCH] Update to LLVM 16.0.1 Resolves: #2178739 --- .gitignore | 94 +------------------ ...Check-for-gtest-headers-even-if-lit..patch | 48 ---------- ...lled-llvm_gtest-in-standalone-builds.patch | 37 ++++++++ lld.spec | 27 ++++-- sources | 6 +- 5 files changed, 64 insertions(+), 148 deletions(-) delete mode 100644 0001-PATCH-lld-CMake-Check-for-gtest-headers-even-if-lit..patch create mode 100644 0001-lld-Use-installed-llvm_gtest-in-standalone-builds.patch diff --git a/.gitignore b/.gitignore index 466cff6..b67dddf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,91 +1,3 @@ -/lld-4.0.0.src.tar.xz -/lld-4.0.1.src.tar.xz -/lld-5.0.0.src.tar.xz -/lld-5.0.1.src.tar.xz -/lld-6.0.0rc1.src.tar.xz -/lld-6.0.0rc2.src.tar.xz -/lld-6.0.0.src.tar.xz -/lld-6.0.1rc1.src.tar.xz -/lld-6.0.1.src.tar.xz -/lld-7.0.0rc1.src.tar.xz -/lld-7.0.0rc2.src.tar.xz -/lld-7.0.0rc3.src.tar.xz -/lld-7.0.0.src.tar.xz -/lld-7.0.1.src.tar.xz -/lld-8.0.0rc1.src.tar.xz -/lld-8.0.0rc2.src.tar.xz -/lld-8.0.0rc3.src.tar.xz -/lld-8.0.0rc4.src.tar.xz -/lld-8.0.0.src.tar.xz -/lld-9.0.0rc2.src.tar.xz -/lld-9.0.0rc3.src.tar.xz -/lld-9.0.0.src.tar.xz -/lld-9.0.0.src.tar.xz.sig -/lld-9.0.1.src.tar.xz -/lld-9.0.1.src.tar.xz.sig -/lld-10.0.0rc1.src.tar.xz -/lld-10.0.0rc1.src.tar.xz.sig -/lld-10.0.0rc2.src.tar.xz -/lld-10.0.0rc2.src.tar.xz.sig -/lld-10.0.0rc3.src.tar.xz -/lld-10.0.0rc3.src.tar.xz.sig -/lld-10.0.0rc4.src.tar.xz -/lld-10.0.0rc4.src.tar.xz.sig -/lld-10.0.0rc5.src.tar.xz -/lld-10.0.0rc5.src.tar.xz.sig -/lld-10.0.0rc6.src.tar.xz -/lld-10.0.0rc6.src.tar.xz.sig -/lld-10.0.0.src.tar.xz -/lld-10.0.0.src.tar.xz.sig -/lld-11.0.0rc1.src.tar.xz -/lld-11.0.0rc1.src.tar.xz.sig -/lld-11.0.0rc2.src.tar.xz -/lld-11.0.0rc2.src.tar.xz.sig -/lld-11.0.0rc3.src.tar.xz -/lld-11.0.0rc3.src.tar.xz.sig -/lld-11.0.0rc5.src.tar.xz -/lld-11.0.0rc5.src.tar.xz.sig -/lld-11.0.0rc6.src.tar.xz -/lld-11.0.0rc6.src.tar.xz.sig -/lld-11.0.0.src.tar.xz -/lld-11.0.0.src.tar.xz.sig -/lld-11.0.1rc1.src.tar.xz -/lld-11.0.1rc1.src.tar.xz.sig -/lld-11.0.1rc2.src.tar.xz -/lld-11.0.1rc2.src.tar.xz.sig -/lld-11.0.1.src.tar.xz -/lld-11.0.1.src.tar.xz.sig -/lld-11.1.0rc1.src.tar.xz -/lld-11.1.0rc1.src.tar.xz.sig -/lld-11.1.0rc2.src.tar.xz -/lld-11.1.0rc2.src.tar.xz.sig -/lld-12.0.0rc1.src.tar.xz -/lld-12.0.0rc1.src.tar.xz.sig -/lld-12.0.0rc2.src.tar.xz -/lld-12.0.0rc2.src.tar.xz.sig -/lld-12.0.0rc3.src.tar.xz -/lld-12.0.0rc3.src.tar.xz.sig -/lld-12.0.0rc4.src.tar.xz -/lld-12.0.0rc4.src.tar.xz.sig -/lld-12.0.0rc5.src.tar.xz -/lld-12.0.0rc5.src.tar.xz.sig -/lld-12.0.0.src.tar.xz -/lld-12.0.0.src.tar.xz.sig -/lld-12.0.1.src.tar.xz -/lld-12.0.1.src.tar.xz.sig -/lld-13.0.0.src.tar.xz -/lld-13.0.0.src.tar.xz.sig -/lld-13.0.1.src.tar.xz -/lld-13.0.1.src.tar.xz.sig -/lld-14.0.0.src.tar.xz -/lld-14.0.0.src.tar.xz.sig -/lld-14.0.5.src.tar.xz -/lld-14.0.5.src.tar.xz.sig -/lld-14.0.6.src.tar.xz -/lld-14.0.6.src.tar.xz.sig -/lld-15.0.1.src.tar.xz -/lld-15.0.1.src.tar.xz.sig -/lld-15.0.6.src.tar.xz -/lld-15.0.6.src.tar.xz.sig -/lld-15.0.7.src.tar.xz -/lld-15.0.7.src.tar.xz.sig +/*.tar.xz +/*.tar.xz.sig +/*.src.rpm diff --git a/0001-PATCH-lld-CMake-Check-for-gtest-headers-even-if-lit..patch b/0001-PATCH-lld-CMake-Check-for-gtest-headers-even-if-lit..patch deleted file mode 100644 index ac8ed67..0000000 --- a/0001-PATCH-lld-CMake-Check-for-gtest-headers-even-if-lit..patch +++ /dev/null @@ -1,48 +0,0 @@ -From 760568cd24acd6ae9083b0dfea2c7c0ea6f0adc2 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Thu, 30 Aug 2018 08:53:56 -0700 -Subject: [PATCH 1/2] [PATCH][lld] CMake: Check for gtest headers even if - lit.py is not present - -This makes it possible to build the unittests even withotu a full -checkout of the llvm source tree. ---- - lld/CMakeLists.txt | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) - -diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt -index d4e561b..a7406d1c 100644 ---- a/lld/CMakeLists.txt -+++ b/lld/CMakeLists.txt -@@ -68,6 +68,15 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) - set(LLVM_UTILS_PROVIDED ON) - endif() - -+ # Check for gtest -+ set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest) -+ if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h -+ AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} -+ AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt) -+ add_subdirectory(${UNITTEST_DIR} utils/unittest) -+ endif() -+ -+ # Check for lit - if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py) - # Note: path not really used, except for checking if lit was found - set(LLVM_LIT ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py) -@@ -77,12 +86,6 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) - set(LLVM_UTILS_PROVIDED ON) - set(LLD_TEST_DEPS FileCheck not) - endif() -- set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest) -- if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h -- AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} -- AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt) -- add_subdirectory(${UNITTEST_DIR} utils/unittest) -- endif() - else() - # Seek installed Lit. - find_program(LLVM_LIT --- -1.8.3.1 - diff --git a/0001-lld-Use-installed-llvm_gtest-in-standalone-builds.patch b/0001-lld-Use-installed-llvm_gtest-in-standalone-builds.patch new file mode 100644 index 0000000..cfada79 --- /dev/null +++ b/0001-lld-Use-installed-llvm_gtest-in-standalone-builds.patch @@ -0,0 +1,37 @@ +From 56464ba865b7df5bf3edb9be7dc3b6a0fbe21e21 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Mon, 13 Mar 2023 18:22:31 +0100 +Subject: [PATCH] [lld] Use installed llvm_gtest in standalone builds + +Use the installed llvm_gtest library instead of rebuilding it locally +when standalone builds are used. This change is now required +as otherwise the build fails due to duplicate llvm_gtest target. +This is based on 82169103958583d3320b3a9a1e6542e8d32ef8da in clang. + +Differential Revision: https://reviews.llvm.org/D145964 +--- + lld/CMakeLists.txt | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt +index 3d6225646fe6..1e9e47393196 100644 +--- a/lld/CMakeLists.txt ++++ b/lld/CMakeLists.txt +@@ -75,11 +75,9 @@ if(LLD_BUILT_STANDALONE) + set(LLVM_UTILS_PROVIDED ON) + set(LLD_TEST_DEPS FileCheck not) + endif() +- set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest) +- if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h +- AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX} +- AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt) +- add_subdirectory(${UNITTEST_DIR} third-party/unittest) ++ ++ if (NOT TARGET llvm_gtest) ++ message(FATAL_ERROR "llvm-gtest not found. Please install llvm-gtest or disable tests with -DLLVM_INCLUDE_TESTS=OFF") + endif() + else() + # Seek installed Lit. +-- +2.39.2 + diff --git a/lld.spec b/lld.spec index 20de5b4..5df3665 100644 --- a/lld.spec +++ b/lld.spec @@ -2,9 +2,10 @@ %bcond_without check %global lld_srcdir lld-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:rc%{rc_ver}}.src -%global maj_ver 15 +%global cmake_srcdir cmake-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:rc%{rc_ver}}.src +%global maj_ver 16 %global min_ver 0 -%global patch_ver 7 +%global patch_ver 1 %global pkg_name lld %global install_prefix /usr @@ -13,18 +14,21 @@ Name: %{pkg_name} Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}} -Release: 4%{?dist} +Release: 1%{?dist} Summary: The LLVM Linker -License: NCSA +License: Apache-2.0 WITH LLVM-exception OR NCSA URL: http://llvm.org Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{lld_srcdir}.tar.xz Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{lld_srcdir}.tar.xz.sig -Source2: release-keys.asc +Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{cmake_srcdir}.tar.xz +Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{cmake_srcdir}.tar.xz.sig +Source4: release-keys.asc ExcludeArch: s390x -Patch0: 0001-PATCH-lld-CMake-Check-for-gtest-headers-even-if-lit..patch +# Backport from LLVM 17. +Patch0: 0001-lld-Use-installed-llvm_gtest-in-standalone-builds.patch # Bundle libunwind header need during build for MachO support Patch1: 0002-PATCH-lld-Import-compact_unwind_encoding.h-from-libu.patch @@ -75,7 +79,13 @@ Shared libraries for LLD. %prep -%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' +%{gpgverify} --keyring='%{SOURCE4}' --signature='%{SOURCE1}' --data='%{SOURCE0}' +%{gpgverify} --keyring='%{SOURCE4}' --signature='%{SOURCE3}' --data='%{SOURCE2}' +%setup -T -q -b 2 -n %{cmake_srcdir} +# TODO: It would be more elegant to set -DLLVM_COMMON_CMAKE_UTILS=%{_builddir}/%{cmake_srcdir}, +# but this is not a CACHED variable, so we can't actually set it externally :( +cd .. +mv %{cmake_srcdir} cmake %autosetup -n %{lld_srcdir} -p2 @@ -151,6 +161,9 @@ fi %changelog +* Wed Apr 19 2023 Nikita Popov - 16.0.1-1 +- Update to LLVM 16.0.1 + * Tue Jan 31 2023 Konrad Kleine - 15.0.7-4 - Fixup for obsoleting lld-test < 15.0.7 diff --git a/sources b/sources index 76661bd..4436654 100644 --- a/sources +++ b/sources @@ -1,2 +1,4 @@ -SHA512 (lld-15.0.7.src.tar.xz) = 5dc0690c1eb3c37ee29c4add65a08f7b93ce1363cf9099243c9dc1124d1ca77fe19bbf24dad3984de4553eda716f706d49dff63461b709bec6645272e67f0178 -SHA512 (lld-15.0.7.src.tar.xz.sig) = f0cf9c7ef3c99f17c40bd28436ecfdbd939f8e145f2ccc5f8c52ec846b633dc073e6bd5dc6cdc6ce213f7404a491ea992440b5d0ba080ba68aadf480f9a5d373 +SHA512 (lld-16.0.1.src.tar.xz) = fe9566a1aeaafdd80568dfa9553936ecf144f79ec774bb02d85eb4e140d1a5434a953ddbd18e6c3f1413d37d21a48a7e6eff2c25ff622a50c6ca3af4c3dff61f +SHA512 (lld-16.0.1.src.tar.xz.sig) = a9ad4d394fa7998285e72596a1c7c15ddb8537a9ff19388c95487b75420cb745f52d6673540bcc6c86e950cd2a81485cfff9743cc846f14a80c50a4a69d98b6a +SHA512 (cmake-16.0.1.src.tar.xz) = 7a0f01a82660a953e06b1df267918542205ac46f151d284dca74255c36fe5ccd995266638a85ce502a81cdd5e76ff3311e5f8488e09d0abbf22ee07cec186f5f +SHA512 (cmake-16.0.1.src.tar.xz.sig) = 8d49050e9b04df253a5bb2fa3b27796f204d085610432826bef6bb6cab876990d67e7fd5267fc89fadf21d88da73c535c82ae6ea0e1c867f7cd5efac244b0fa2