diff --git a/0001-Install-clang-tblgen.patch b/0001-Install-clang-tblgen.patch deleted file mode 100644 index 6bfc2e2af0e339499709a4d58d90657a9fefa764..0000000000000000000000000000000000000000 --- a/0001-Install-clang-tblgen.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 2e106d4cfc909e23e16104725706e4f9dda15974 Mon Sep 17 00:00:00 2001 -From: Nikita Popov -Date: Fri, 5 Aug 2022 08:57:18 +0200 -Subject: [PATCH] Install clang-tblgen - ---- - llvm/cmake/modules/TableGen.cmake | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake -index 4711456776c8..edcc9d0b607d 100644 ---- a/llvm/cmake/modules/TableGen.cmake -+++ b/llvm/cmake/modules/TableGen.cmake -@@ -186,7 +186,10 @@ macro(add_tablegen target project) - endif() - endif() - -- if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR) AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS) -+ # (llvm|mlir|clang)-tblgen may also be used outside the respective projects. -+ if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR OR -+ ${project} STREQUAL CLANG) AND -+ NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS) - set(export_to_llvmexports) - if(${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR - NOT LLVM_DISTRIBUTION_COMPONENTS) --- -2.37.1 - diff --git a/0001-llvm-Add-install-targets-for-gtest.patch b/0001-llvm-Add-install-targets-for-gtest.patch new file mode 100644 index 0000000000000000000000000000000000000000..e84c44402ffbd5c0262f0399c61d687de2d42a80 --- /dev/null +++ b/0001-llvm-Add-install-targets-for-gtest.patch @@ -0,0 +1,32 @@ +From 8cc3870f09d728d9017c72eba9520117a4283fee Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Thu, 17 Nov 2022 09:01:10 +0000 +Subject: Add install targets for gtest + +Stand-alone builds need an installed version of gtest in order to run +the unittests. + +Differential Revision: https://reviews.llvm.org/D137890 +--- + llvm/CMakeLists.txt | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt +index 60e1f29620af..d91338532815 100644 +--- a/llvm/CMakeLists.txt ++++ b/llvm/CMakeLists.txt +@@ -693,6 +693,11 @@ option(LLVM_BUILD_TESTS + "Build LLVM unit tests. If OFF, just generate build targets." OFF) + option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." ON) + ++option(LLVM_INSTALL_GTEST ++ "Install the llvm gtest library. This should be on if you want to do ++ stand-alone builds of the other projects and run their unit tests." OFF) ++ ++ + option(LLVM_BUILD_BENCHMARKS "Add LLVM benchmark targets to the list of default + targets. If OFF, benchmarks still could be built using Benchmarks target." OFF) + option(LLVM_INCLUDE_BENCHMARKS "Generate benchmark targets. If OFF, benchmarks can't be built." ON) +-- +2.34.3 + diff --git a/0201-third-party-Add-install-targets-for-gtest.patch b/0201-third-party-Add-install-targets-for-gtest.patch new file mode 100644 index 0000000000000000000000000000000000000000..5c8613057f4ab45a7562fc1055bcf6ac2d1f3ac0 --- /dev/null +++ b/0201-third-party-Add-install-targets-for-gtest.patch @@ -0,0 +1,47 @@ +From 8cc3870f09d728d9017c72eba9520117a4283fee Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Thu, 17 Nov 2022 09:01:10 +0000 +Subject: Add install targets for gtest + +Stand-alone builds need an installed version of gtest in order to run +the unittests. + +Differential Revision: https://reviews.llvm.org/D137890 +--- + third-party/unittest/CMakeLists.txt | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/third-party/unittest/CMakeLists.txt b/third-party/unittest/CMakeLists.txt +index 0e54e0e57c35..1d2a52730d7d 100644 +--- a/third-party/unittest/CMakeLists.txt ++++ b/third-party/unittest/CMakeLists.txt +@@ -65,12 +65,25 @@ if (NOT LLVM_ENABLE_THREADS) + endif () + + target_include_directories(llvm_gtest +- PUBLIC googletest/include googlemock/include ++ PUBLIC $ ++ $ ++ $ ++ $ + PRIVATE googletest googlemock + ) + + add_subdirectory(UnitTestMain) + ++if (LLVM_INSTALL_GTEST) ++export(TARGETS llvm_gtest llvm_gtest_main LLVMTestingSupport FILE LLVMGTestConfig.cmake) ++install(TARGETS llvm_gtest llvm_gtest_main LLVMTestingSupport EXPORT LLVMGTestConfig ++ ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT llvm_gtest) ++ install(EXPORT LLVMGTestConfig DESTINATION ${LLVM_INSTALL_PACKAGE_DIR} COMPONENT llvm_gtest) ++ add_llvm_install_targets(install-llvm_gtest COMPONENT llvm_gtest DEPENDS llvm_gtest LLVMGTestConfig.cmake) ++ install(DIRECTORY googletest/include/gtest/ DESTINATION include/llvm-gtest/gtest/ COMPONENT llvm_gtest) ++ install(DIRECTORY googlemock/include/gmock/ DESTINATION include/llvm-gmock/gmock/ COMPONENT llvm_gtest) ++endif() ++ + # When LLVM_LINK_LLVM_DYLIB is enabled, libLLVM.so is added to the interface + # link libraries for gtest and gtest_main. This means that any target, like + # unittests for example, that links against gtest will be forced to link +-- +2.34.3 + diff --git a/D145763.diff b/D145763.diff new file mode 100644 index 0000000000000000000000000000000000000000..79de2d734796cd6c8a8cafc658c0df165abccb49 --- /dev/null +++ b/D145763.diff @@ -0,0 +1,21 @@ +diff --git a/llvm/test/tools/llvm-exegesis/PowerPC/lit.local.cfg b/llvm/test/tools/llvm-exegesis/PowerPC/lit.local.cfg +--- a/llvm/test/tools/llvm-exegesis/PowerPC/lit.local.cfg ++++ b/llvm/test/tools/llvm-exegesis/PowerPC/lit.local.cfg +@@ -1,3 +1,6 @@ + if not ('PowerPC' in config.root.targets): + # We need support for PowerPC. + config.unsupported = True ++elif not ('powerpc' in config.root.host_triple): ++ # We need to be running on an PPC host. ++ config.unsupported = True +diff --git a/llvm/test/tools/llvm-exegesis/X86/lit.local.cfg b/llvm/test/tools/llvm-exegesis/X86/lit.local.cfg +--- a/llvm/test/tools/llvm-exegesis/X86/lit.local.cfg ++++ b/llvm/test/tools/llvm-exegesis/X86/lit.local.cfg +@@ -1,3 +1,6 @@ + if not ('X86' in config.root.targets): + # We need support for X86. + config.unsupported = True ++elif not ('x86_64' in config.root.host_triple): ++ # We need to be running on an X86 host. ++ config.unsupported = True + diff --git a/cmake-15.0.7.src.tar.xz b/cmake-15.0.7.src.tar.xz deleted file mode 100644 index 8a482e177d194a1d9ba1fe3fee79a2f3930b0c18..0000000000000000000000000000000000000000 Binary files a/cmake-15.0.7.src.tar.xz and /dev/null differ diff --git a/cmake-16.0.1.src.tar.xz b/cmake-16.0.1.src.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..ee563132336eac9571bda9c89e77153ecee46e8c Binary files /dev/null and b/cmake-16.0.1.src.tar.xz differ diff --git a/llvm-15.0.7.src.tar.xz b/llvm-16.0.1.src.tar.xz similarity index 77% rename from llvm-15.0.7.src.tar.xz rename to llvm-16.0.1.src.tar.xz index 4d65c526e65470b13f02af75b021132756db47a3..6f61771312440e3416b9f3abe0fc0cd8d15d7364 100644 Binary files a/llvm-15.0.7.src.tar.xz and b/llvm-16.0.1.src.tar.xz differ diff --git a/llvm.spec b/llvm.spec index e8e6d5430695404ff071241da451460e92014d15..85a7ad803ba68e31828b94c8d818a62c7f8671b4 100644 --- a/llvm.spec +++ b/llvm.spec @@ -1,4 +1,4 @@ -%define anolis_release 4 +%define anolis_release 1 # We are building with clang for faster/lower memory LTO builds. %global toolchain clang @@ -6,7 +6,7 @@ %undefine _include_frame_pointers # Components enabled if supported by target architecture: -%define gold_arches x86_64 aarch64 +%define gold_arches x86_64 aarch64 loongarch64 %ifarch %{gold_arches} %bcond_without gold %else @@ -20,11 +20,12 @@ # maj_ver, and submit the forked repository with compat_build, which will # produce llvm%{maj_ver}-libs. Otherwise uninstallable clang will cause the # whole toolchain unusable. -%global maj_ver 15 +%global maj_ver 16 %global min_ver 0 -%global patch_ver 7 -%global llvm_srcdir llvm-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:rc%{rc_ver}}.src -%global cmake_srcdir cmake-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:rc%{rc_ver}}.src +%global patch_ver 1 +%global llvm_srcdir llvm-%{maj_ver}.%{min_ver}.%{patch_ver}.src +%global cmake_srcdir cmake-%{maj_ver}.%{min_ver}.%{patch_ver}.src +%global third_party_srcdir third-party-%{maj_ver}.%{min_ver}.%{patch_ver}.src %global _lto_cflags -flto=thin %if %{with compat_build} @@ -52,7 +53,7 @@ %global build_install_prefix %{buildroot}%{install_prefix} -%global llvm_triple %{_host} +%global llvm_triple %{_target_platform} # Don't add -P to Python shebangs # The executable Python scripts in /usr/share/opt-viewer/ import each other @@ -65,24 +66,31 @@ Summary: The Low Level Virtual Machine 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}}/%{llvm_srcdir}.tar.xz -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 - -# Needed to export clang-tblgen during the clang build, needed by the flang docs build. -# TODO: Can be dropped for LLVM 16, see https://reviews.llvm.org/D131282. -Patch3: 0001-Install-clang-tblgen.patch - -BuildRequires: gcc -BuildRequires: gcc-c++ -BuildRequires: clang -BuildRequires: cmake -BuildRequires: ninja-build -BuildRequires: zlib-devel -BuildRequires: libffi-devel -BuildRequires: ncurses-devel -BuildRequires: python3-psutil -BuildRequires: python3-sphinx -BuildRequires: python3-recommonmark +Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}/%{llvm_srcdir}.tar.xz +Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}/%{cmake_srcdir}.tar.xz +Source4: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}/%{third_party_srcdir}.tar.xz + +# Backport from LLVM 17. +Patch0: D145763.diff + +# See https://reviews.llvm.org/D137890 for the next two patches +Patch2: 0001-llvm-Add-install-targets-for-gtest.patch +# Patching third-party dir with a 200 offset in patch number +Patch201: 0201-third-party-Add-install-targets-for-gtest.patch + +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: clang +BuildRequires: cmake +BuildRequires: ninja-build +BuildRequires: zlib-devel +BuildRequires: libffi-devel +BuildRequires: libxml2-devel +BuildRequires: ncurses-devel +BuildRequires: python3-psutil +BuildRequires: python3-sphinx +BuildRequires: python3-recommonmark +BuildRequires: python3-yaml %if %{with gold} BuildRequires: binutils-devel %endif @@ -96,10 +104,6 @@ BuildRequires: libedit-devel BuildRequires: python3-devel BuildRequires: python3-setuptools -# For origin certification -BuildRequires: gnupg2 - - Requires: %{name}-libs = %{version}-%{release} Provides: llvm(major) = %{maj_ver} @@ -196,7 +200,13 @@ This is the main package for llvm-toolset. # but this is not a CACHED variable, so we can't actually set it externally :( cd .. mv %{cmake_srcdir} cmake -%autosetup -n %{llvm_srcdir} -p2 +%setup -T -q -b 4 -n %{third_party_srcdir} +%autopatch -m200 -p2 +cd .. +mv %{third_party_srcdir} third-party + +%setup -T -q -b 0 -n %{llvm_srcdir} +%autopatch -M200 -p2 %py3_shebang_fix \ test/BugPoint/compile-custom.ll.py \ @@ -306,13 +316,14 @@ rm -rf test/tools/UpdateTestChecks %endif install %{build_libdir}/libLLVMTestingSupport.a %{buildroot}%{_libdir} +install %{build_libdir}/libLLVMTestingAnnotations.a %{buildroot}%{_libdir} %global install_srcdir %{buildroot}%{_datadir}/llvm/src # Install gtest sources so clang can use them for gtest install -d %{install_srcdir} install -d %{install_srcdir}/utils/ -cp -R utils/unittest %{install_srcdir}/utils/ +cp -R ../third-party/unittest %{install_srcdir}/utils/ # Clang needs these for running lit tests. cp utils/update_cc_test_checks.py %{install_srcdir}/utils/ @@ -321,7 +332,7 @@ cp -R utils/UpdateTestChecks %{install_srcdir}/utils/ %if %{with gold} # Add symlink to lto plugin in the binutils plugin directory. %{__mkdir_p} %{buildroot}%{_libdir}/bfd-plugins/ -ln -s %{_libdir}/LLVMgold.so %{buildroot}%{_libdir}/bfd-plugins/ +ln -s -t %{buildroot}%{_libdir}/bfd-plugins/ ../LLVMgold.so %endif %else @@ -386,6 +397,8 @@ cp -Rv ../cmake/Modules/* %{buildroot}%{pkg_libdir}/cmake/llvm %generate_compatibility_deps %check +# non reproducible errors +rm test/tools/dsymutil/X86/swift-interface.test %if %{with check} # FIXME: use %%cmake_build instead of %%__ninja @@ -412,7 +425,9 @@ fi %exclude %{_mandir}/man1/llvm-config* %{_mandir}/man1/* %{_bindir}/* +%if %{without compat_build} %{abidir}/*-option.list +%endif %exclude %{_bindir}/llvm-config%{exec_suffix} %exclude %{pkg_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} @@ -520,6 +535,9 @@ fi %endif %changelog +* Wed Apr 5 2023 Funda Wang - 16.0.1-1 +- New version 16.0.1 + * Wed Mar 29 2023 mgb01105731 - 15.0.7-4 - Del Specific Fields diff --git a/third-party-16.0.1.src.tar.xz b/third-party-16.0.1.src.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..837181c4c845519128438be7359d40fefe38c2d2 Binary files /dev/null and b/third-party-16.0.1.src.tar.xz differ