From 5826a876b063f4b5041be2eaac07473b78f956ed Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 21 Apr 2025 20:29:48 +0000 Subject: [PATCH] Sync with Fedora 20.1.8 release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This includes the following commits from Fedora Rawhide: commit e8450de3763841effd232d029796b13893d01008 (fedora/rawhide, fedora/main, fedora/HEAD) Author: Jesus Checa Hidalgo Date: Tue Jun 3 13:52:36 2025 +0200 rpminspect: disable abidiff inspection We need to disable abidiff due to huge memory consumption, leading to OOM kill of the whole rpminspect run. Check https://docs.testing-farm.io/Testing%20Farm/0.1/errors.html#TFE-1 commit 4122c8e2cf7048dbb36d3fef2706035c5983af99 Author: Nikita Popov Date: Wed Jul 9 16:52:44 2025 +0200 Add sources commit a55f6275c7175c2ffab6617505255437f54647f1 Author: Nikita Popov Date: Wed Jul 9 16:35:08 2025 +0200 Update to LLVM 20.1.8 commit 2d2a67ae36ee014eb11505b2703f363a2034dd4c Author: Kashyap Chamarthy Date: Sat Mar 15 12:24:09 2025 +0800 More riscv64-related enablement Notes: - Cherry-pick from here (from Songsong Zhang) and resolve conflicts throughout the spec: https://gitlab.com/fedoravforce/llvm/-/commit/2485502 ("Add riscv64 support", 2025-03-15) - Add Songsong's and David Abdurachmanov's Signed-off-by. Signed-off-by: Kashyap Chamarthy Signed-off-by: David Abdurachmanov Signed-off-by: Songsong Zhang commit b6af79edd7a6ad680074346d7bad9cb897cb67aa Author: Tom Stellard Date: Tue Jun 17 17:52:14 2025 +0000 Disable PGO on RHEL We don't want to enable this on RHEL until LLVM 21. commit 04d85f9ad423149d065e53ebb9f8a335ebf5d5c5 Author: Nikita Popov Date: Thu Jun 19 14:55:36 2025 +0200 Update to LLVM 20.1.7 commit 074e1117c9683ecc6d23febfab9aac1b43d4dcf0 Author: Tulio Magno Quites Machado Filho Date: Wed Jun 18 14:23:56 2025 -0300 Revert "Update to 20.1.7 upstream release" This reverts commit fe638c1523ac3356fbe3cd200e23a787348dfd01. commit fe638c1523ac3356fbe3cd200e23a787348dfd01 Author: Tulio Magno Quites Machado Filho Date: Wed Jun 18 14:18:59 2025 -0300 Update to 20.1.7 upstream release - Resolves: rhbz#2356810 Upstream tag: llvmorg-20.1.7 Upstream commit: 6146a88f Commit authored by Packit automation (https://packit.dev/) commit bc6106065d8e2a021945eebdd8f9f1bb549bff84 Author: Nikita Popov Date: Thu Apr 24 15:47:01 2025 +0200 Fix alternatives handling This implements multiple fixes to the handling of llvm-config alternatives: * Increase alternative priority for new versions. Otherwise we'll give all versions the same priority. The new one will be something like 2064 for the 64-bit LLVM 20 llvm-config binary. * Remove old llvm-config-64/llvm-config-32 alternative. This is only needed once, so suppress the error. * Do not remove no longer used llvm-config-64/32 in postun scriptlet. Instead remove the llvm-config in install_bindir. However, now that the path will be the same for compat and non-compat LLVM, only do this on uninstall, not on upgrade. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2361779 commit 97e4be2d5af4bc11d84156d654fcc90bc8282e95 Author: Nikita Popov Date: Mon Jun 16 10:15:05 2025 +0000 Use libdir suffix in versioned prefix as well Use the lib/lib64 distinction for the versioned prefix, to avoid a mismatch with the default prefix. This means that the versioned prefix now has libraries in /usr/lib64/llvmN/lib64. This should fix the issue https://src.fedoraproject.org/rpms/llvm/pull-request/446 ran into. This would also be needed if we wanted to switch to installing into libexec. commit 6aa8bd5628713c0b1750013be521a43a083a44dc Author: Timm Bäder Date: Mon Jun 16 09:58:52 2025 +0200 Add task-taskwait-nested test to LIT_XFAIL on ppc This test fails on ppc, so add it to the XFAIL list like the other similar tests. It would be better to fix the root cause, but in the meantime, add it to XFAIL to unblock the snapshot builds. commit 595c2a20d256bf8e3b2ac8687c0029b42e64878d Author: Nikita Popov Date: Fri Jun 6 13:32:06 2025 +0000 Invert symlink direction This is an alternative to: https://src.fedoraproject.org/rpms/llvm/pull-request/439. Instead of undoing the prefix change completely, this instead inverts the direction of the symlinks: The non-compat package ships all the files in the default prefix, but has symlinks from the versioned prefix to the default prefix. The implementation approach is to install everything into the versioned prefix first (keeping things unified between compat and non-compat build initially) and to then move and symlink in post-processing. The llvm-config setup here stays the same as it currently is, with llvm-config executables being installed in the versioned prefix, while the one in the default prefix is managed by alternatives. This patch does not fix the issues with alternatives handling, we'd apply https://src.fedoraproject.org/rpms/llvm/pull-request/417 on top of this patch for that. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2365079. commit 1301bd98a994fc804500a6a67a228b08ad3c18a1 Author: Nikita Popov Date: Fri Jun 13 09:40:04 2025 +0200 Add llvm-test-mustache-spec to file list New utility added in https://github.com/llvm/llvm-project/pull/142813. As this is only intended for testing purposes, I've added this to llvm-test rather than the main llvm package. commit e88791282d6fe227f06b81754bde4d22389a4a0d Author: Tulio Magno Quites Machado Filho Date: Fri Jun 6 14:19:00 2025 -0300 Restrict performance comparison to Fedora Avoid running the performance comparison on RHEL in order to avoid the issues when building pip packages on ppc64le and s390x. It was suggested to keep the unused code around for future work. commit 218571e7577abac26fe1d72c75b7982314bbca40 Author: Tulio Magno Quites Machado Filho Date: Mon Jun 9 10:54:51 2025 -0300 Add a BuildRequires on llvm when building with pgo PGO builds require llvm-profdata which is provided by the llvm package. Previously, the build used to pass because llvm-test-suite requires llvm. As we restrict the execution of the perf comparison on snapshot builds, llvm-test-suite won't be installed anymore. commit 125ec5201ef19c606d16fb527235bc4add26e8a7 Author: Konrad Kleine Date: Fri Jun 6 21:10:20 2025 +0200 131099 landend upstream. Remove for LLVM 21 commit 7363eb378e2fa1737126898ccc92b221ab2aadcc Author: Tulio Magno Quites Machado Filho Date: Fri Jun 6 15:34:05 2025 -0300 Fixes the weekday in the last changelog entry. Fixes: 69452b5 (Rebuilt for Python 3.14, 2025-06-04) commit 69452b53301689070c0f4104eb0a724a52b39032 Author: Python Maint Date: Wed Jun 4 20:13:30 2025 +0200 Rebuilt for Python 3.14 commit ecc118b5881f6c02e56970e26f60b0d68b4f195a Author: Konrad Kleine Date: Thu Jun 5 16:27:29 2025 +0200 Filter out some tests that didn't pass after 4 runs The following tests did fail on i386 and s390x even after 4 runs so we filter them out entirely on all archs. ``` libomp :: affinity/kmp-abs-hw-subset.c libomp :: ompt/teams/distribute_dispatch.c libomp :: worksharing/for/omp_collapse_many_GELTGT_int.c libomp :: worksharing/for/omp_collapse_many_GTGEGT_int.c libomp :: worksharing/for/omp_collapse_many_LTLEGE_int.c libomp :: worksharing/for/omp_collapse_one_int.c ``` See https://github.com/fedora-llvm-team/llvm-snapshots/issues/1484#issuecomment-2938924999 commit 382a7b1ed75852a4095b5c9eaa6a24e839976fc0 Author: Python Maint Date: Wed Jun 4 20:13:30 2025 +0200 Rebuilt for Python 3.14 commit 169ddb98dd7be9a7e5e5740709cf8a8c9859f364 Author: Python Maint Date: Wed Jun 4 13:33:11 2025 +0200 Bootstrap for Python 3.14 commit a1789ade5bb17250a5d5d13af77e279e9842afef Author: Python Maint Date: Wed Jun 4 12:35:59 2025 +0200 Rebuilt for Python 3.14 commit 823b4c7cabf8dd8f3d9343f2bcb6768e729b769e Author: Tulio Magno Quites Machado Filho Date: Tue Jun 3 14:22:09 2025 -0300 Revert "Fix build on ppc64le with newer glibc >= 2.42" This is not necessary anymore. commit 2a66bbb2a287cdd9d6fa3ed48309aeaa28ddcf96 Author: Python Maint Date: Tue Jun 3 23:35:20 2025 +0200 Rebuilt for Python 3.14 commit c146b5347273db26aa97a3613497d92846922a26 Author: Konrad Kleine Date: Fri May 30 10:12:00 2025 +0200 Allow openmp tests to re-run two times Once https://github.com/llvm/llvm-project/pull/141851 is merged, we can use the new lit-option `--max-retries-per-test=` in order to re-run openmp tests. This change makes use of this option and configures it, so that openmp tests are re-run 4 times if needed. To prove that this works, we no longer filter out the flaky tests. Once https://github.com/llvm/llvm-project/pull/142413 lands we can add `--show-attempts-count` to show how many attempts were actually needed. See also: * https://issues.redhat.com/browse/LLVM-145 * https://github.com/llvm/llvm-project/issues/127796 * https://github.com/llvm/llvm-project/issues/117773 commit faa5ec673f97fde4681eb3cad5d8dcb773ba5ff2 Author: Nikita Popov Date: Fri May 30 10:37:17 2025 +0200 Remove build conditions print The additional output can break tooling, at least rpmdev-bumpspec no longer works. commit c27c4368842ba45e03e40bd762235a1ff9dc39cb Author: Nikita Popov Date: Fri May 30 10:35:50 2025 +0200 Update to LLVM 20.1.6 commit f422c621c686267d51338e032ee9d135ec76a083 Author: Konrad Kleine Date: Fri May 23 10:16:34 2025 +0200 [make] Add mock-install-debugging-tools target commit a7997da77298f4e81519f6db7817b9ed102cc981 Author: Konrad Kleine Date: Mon Oct 7 20:05:33 2024 +0000 Bring in PGO (Profile Guided Optimization) This enable PGO (Profile Guided Optimization) on Fedora >=41 and RHEL >= 9 for non x86 machines. This is a four step process: 1. We use the system clang compiler to build an instrumented version of LLVM. The first build of LLVM is rather small because it only features the native subset of targets to build (`LLVM_TARGETS_TO_BUILD=Native`) and no tests or whatsoever is built. 2. We run a special `cmake` target (`generate-profdata`) that collects profile data information. Eventually this information is also packaged as `llvm-pgo.profdata`. 3. We feed the profile information into another final build of LLVM that gets packaged later. 4. If we are on a platform that provides the `llvm-test-suite` package we run a performance comparison of the system compiler against the PGOed compiler. This is meant as a sanity check. We package the output of that comparison (if available) as `results-system-vs-pgo.txt`. The criteria to run this performance comparison is influenced by the `run_pgo_perf_comparison` global. For snapshot builds we even run the comparison for RHEL platforms where usually the `llvm-test-suite` is not available. There we provide it through this COPR project: [@fedora-llvm-team/llvm-test-suite](https://copr.fedorainfracloud.org/coprs/g/fedora-llvm-team/llvm-test-suite/). We pass `--build-id=sha1` to lld when building final stage with PGO LLD uses "fast" as the algortithm for generating build-id values while ld.bfd uses "sha1" by default. We need to get lld to use the same algorithm or otherwise we end up with errors like thise one: ``` build-id found in [...]/usr/lib64/llvm21/bin/llvm-debuginfod-find too small ``` NOTE: We decided to not do a bootstrap build of clang. NOTE: To disable PGO change `%bcond_without pgo` to `%bcond_with pgo` in the one line where it is conditionally defined. All the relevant changes are build-condition fenced with `%if %{with pgo}`. commit f924fc03691b1f53f4df833b03567583dcc61532 Author: Nikita Popov Date: Mon May 26 11:31:32 2025 +0200 Backport patch for i686 test failure Backport of https://github.com/llvm/llvm-project/pull/141083, which fixes the test failure observed on i686 rawhide when building LLVM 20.1.5. commit d69a61641fd5b2d767dacaacbf269881daefb0df Author: Nikita Popov Date: Thu May 22 15:05:06 2025 +0200 Fix pfalse-v4i1.ll test failure commit 1856c827f30a56720dcc96b3680d7b16bb883d60 Author: Nikita Popov Date: Thu May 22 12:22:26 2025 +0200 Update to LLVM 20.1.5 commit 826a9779f009d39a704eb808905415f5d8bb8d3b Author: Nikita Popov Date: Thu May 22 12:15:30 2025 +0200 Revert "Remove alternatives support for llvm-config" This reverts commit 6de26fdc8f1d9eeafb1685f5df276683e267a003. commit 173b986e236d4700a23e0d962b4bfbe1d4992e28 Author: Nikita Popov Date: Thu May 22 12:14:22 2025 +0200 Revert "Do not create symlinks on i686" This reverts commit b54ab1714baa8a559fb9d23a529325930d95a3ef. commit 0d8798c20f945d3b65ad73c6d4e04bad43845d0e Author: Konrad Kleine Date: Mon May 19 09:26:53 2025 +0200 Fix tests/README.md commit 98fb350da703c802754066447551cae45fe1de8a Author: Tulio Magno Quites Machado Filho Date: Tue May 6 13:14:26 2025 -0300 Disable offload on ppc64le on RHEL <= 9 1. Add a conditional in order to control the build of offload libraries. 2. Use this conditional when building for %{ix86}. 3. Disable the build of offload for ppc64le on RHEL <= 9 due to the lack of support for the IBM long double format. As offload starts to depend more on libc on LLVM 21, it started to depend on long double code that never supported the IBM long double format. commit 7e3bdab681572b7451c3491ce1630b4f24d9d88e Author: Tom Stellard Date: Tue Apr 29 21:42:41 2025 +0000 Fix build on ppc64le with newer glibc >= 2.42 commit 76a6138716bf9e28baae1facc457a040c215e917 Author: Nikita Popov Date: Tue May 6 10:53:47 2025 +0000 Build bundled compat libraries with LLVM_LINK_LLVM_DYLIB commit 6da48c6c216a0c23df17e9c8e86168234497dd5d Author: Nikita Popov Date: Tue May 6 12:02:54 2025 +0200 Update to LLVM 20.1.4 commit b54ab1714baa8a559fb9d23a529325930d95a3ef Author: Nikita Popov Date: Mon May 5 13:16:35 2025 +0000 Do not create symlinks on i686 Currently, it's not possible to install llvm-devel.i686 and llvm-devel.x86_64 at the same time, breaking multilib support. The reason is that binary symlinks between the two packages conflict, and unlikely for file conflicts, dnf treats these as an error. Fix this by not shipping any symlinks in the default prefix on i686. This means that i686 packages only ship the contents of /usr/lib/llvmN. This allows conflict-free co-installation with the x86_64 packages. I have opted to drop *all* of the symlinks in the default prefix on i686, but this is not strictly necessary. E.g. keeping lib symlinks should be fine. But I think it's cleaner to just say that i686 has everything in the llvm prefix only, rather than trying to be more precise. commit 6de26fdc8f1d9eeafb1685f5df276683e267a003 Author: Nikita Popov Date: Fri Apr 25 07:58:17 2025 +0000 Remove alternatives support for llvm-config llvm-config and llvm-config-N are now plain symlinks to the llvm-config in the llvm prefix, just like all other binaries. In order to remove the old alternaties setup, I'm running alternatives --remove-all in a pre scriptlet. This should remove the old alternatives before the new symlink directly owned by the package is added. This also fixes https://bugzilla.redhat.com/show_bug.cgi?id=2361779. commit 4dcd1b2b522424374853b1abf083ff222b8c39af Author: Konrad Kleine Date: Fri May 2 18:12:15 2025 +0200 Move -DLLVM_ENABLE_FFI=ON to cmake_common_args to be picked up by compat builds as well. commit bfe6f05cfb4a137b38ad1f2108b30359dfcf35cb Author: Nikita Popov Date: Wed Apr 30 09:04:13 2025 +0200 Fix patch application The patch has been merged for LLVM 21, only apply to LLVM 20. commit 992fe1c72b0022a530a9e23191dcfa5bd6088edc Author: Tom Stellard Date: Thu Apr 17 22:23:04 2025 +0000 crtbegin and crtend objects were added for s390x commit 900fd17135ded05c243e67821afb8f84432abb48 Author: Tom Stellard Date: Sat Apr 26 00:08:40 2025 +0000 Fix build with glibc >= 2.42 https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/5E553SEIQLUFO66BEDBRSJLT3RKNYZXI/ commit c2137635d63da341b280fbc388c9b6e53a63fe64 Author: Tom Stellard Date: Thu Apr 24 17:58:24 2025 +0000 Handle new libompdevice.a libraries See https://github.com/llvm/llvm-project/commit/db0f754c5af8e6c96770533520bf8b17fc0dc977 commit 4ace38733e85982e89a9e1a57feb607196339f41 Author: Tom Stellard Date: Mon Apr 21 20:29:48 2025 +0000 Disable libedit on rhel 8 Resolves: RHEL-81021 --- .copr/Makefile | 33 +++ 131801.patch | 46 ---- 20-131099.patch | 28 +++ Makefile | 18 +- gating.yaml | 1 + llvm.spec | 645 +++++++++++++++++++++++++++++++++++++++++------- rpminspect.yaml | 5 + sources | 4 +- 8 files changed, 640 insertions(+), 140 deletions(-) create mode 100644 .copr/Makefile delete mode 100644 131801.patch create mode 100644 20-131099.patch diff --git a/.copr/Makefile b/.copr/Makefile new file mode 100644 index 0000000..60013ce --- /dev/null +++ b/.copr/Makefile @@ -0,0 +1,33 @@ +# See https://docs.pagure.org/copr.copr/user_documentation.html#make-srpm +# See for the --setopt option in the enabling of copr repo see: +# https://pagure.io/copr/copr/issue/184 + +COPR_USERNAME=$(shell rpm --eval %copr_username) +COPR_PROJECT=$(shell rpm --eval %copr_projectname) +YYYYMMDD=$(shell date +%Y%m%d) + +required_packages=git tar xz curl fedpkg +outdir?=$(shell pwd) +spec?=llvm.spec + +.PHONY: srpm +srpm: + @echo "Check for required packages needed by snapshot-info.sh: $(required_packages)" + rpm -q $(required_packages) || dnf install -y $(required_packages) --setopt=install_weak_deps=False + + @echo "Fetch information about today's snapshot" + YYYYMMDD=$(YYYYMMDD) ./.copr/snapshot-info.sh > version.spec.inc + + @echo "Get sources" + fedpkg --release rawhide sources --outdir $(shell pwd) + + @echo "Remove left-over llvm-project tarball and signature" + rm -vf $(shell pwd)/llvm-project-*.tar.xz* + + @echo "Finally build SRPM" + rpmbuild \ + --with=snapshot_build \ + --define "_srcrpmdir $(outdir)" \ + --define "_sourcedir $(shell pwd)" \ + --define "_disable_source_fetch 0" \ + -bs $(spec) diff --git a/131801.patch b/131801.patch deleted file mode 100644 index 853fba8..0000000 --- a/131801.patch +++ /dev/null @@ -1,46 +0,0 @@ -From d25887408ee9fb78d68787ff7388cba254aced6f Mon Sep 17 00:00:00 2001 -From: Nikita Popov -Date: Tue, 18 Mar 2025 14:36:06 +0100 -Subject: [PATCH] [GlobalMerge][PPC] Don't merge globals in llvm.metadata - section - -The llvm.metadata section is not emitted and has special semantics. -We should not merge globals in it, similarly to how we already -skip merging of `llvm.xyz` globals. - -Fixes https://github.com/llvm/llvm-project/issues/131394. ---- - llvm/lib/CodeGen/GlobalMerge.cpp | 3 ++- - llvm/test/CodeGen/PowerPC/global-merge-llvm-metadata.ll | 9 +++++++++ - 2 files changed, 11 insertions(+), 1 deletion(-) - create mode 100644 llvm/test/CodeGen/PowerPC/global-merge-llvm-metadata.ll - -diff --git a/llvm/lib/CodeGen/GlobalMerge.cpp b/llvm/lib/CodeGen/GlobalMerge.cpp -index 1aedc447935b7..ca743918cec24 100644 ---- a/llvm/lib/CodeGen/GlobalMerge.cpp -+++ b/llvm/lib/CodeGen/GlobalMerge.cpp -@@ -711,7 +711,8 @@ bool GlobalMergeImpl::run(Module &M) { - continue; - - // Ignore all 'special' globals. -- if (GV.getName().starts_with("llvm.") || GV.getName().starts_with(".llvm.")) -+ if (GV.getName().starts_with("llvm.") || -+ GV.getName().starts_with(".llvm.") || Section == "llvm.metadata") - continue; - - // Ignore all "required" globals: -diff --git a/llvm/test/CodeGen/PowerPC/global-merge-llvm-metadata.ll b/llvm/test/CodeGen/PowerPC/global-merge-llvm-metadata.ll -new file mode 100644 -index 0000000000000..7db092e13afeb ---- /dev/null -+++ b/llvm/test/CodeGen/PowerPC/global-merge-llvm-metadata.ll -@@ -0,0 +1,9 @@ -+; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -+ -+@index = global i32 0, align 4 -+@.str = private unnamed_addr constant [1 x i8] zeroinitializer, section "llvm.metadata" -+@.str.1 = private unnamed_addr constant [7 x i8] c"test.c\00", section "llvm.metadata" -+@llvm.global.annotations = appending global [1 x { ptr, ptr, ptr, i32, ptr }] [{ ptr, ptr, ptr, i32, ptr } { ptr @index, ptr @.str, ptr @.str.1, i32 1, ptr null }], section "llvm.metadata" -+ -+; CHECK-NOT: .set -+; CHECK-NOT: _MergedGlobals diff --git a/20-131099.patch b/20-131099.patch new file mode 100644 index 0000000..0b66256 --- /dev/null +++ b/20-131099.patch @@ -0,0 +1,28 @@ +From e43271ec7438ecb78f99db134aeca274a47f6c28 Mon Sep 17 00:00:00 2001 +From: Konrad Kleine +Date: Thu, 13 Mar 2025 09:12:24 +0100 +Subject: [PATCH] Filter out configuration file from compile commands + +The commands to run the compilation when printed with `-###` contain +various irrelevant lines for the perf-training. Most of them are +filtered out already but when configured with +`CLANG_CONFIG_FILE_SYSTEM_DIR` a new line like the following is +added and needs to be filtered out: + +`Configuration file: /etc/clang/x86_64-redhat-linux-gnu-clang.cfg` +--- + clang/utils/perf-training/perf-helper.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/clang/utils/perf-training/perf-helper.py b/clang/utils/perf-training/perf-helper.py +index 80c6356d0497c..29904aded5ab0 100644 +--- a/clang/utils/perf-training/perf-helper.py ++++ b/clang/utils/perf-training/perf-helper.py +@@ -237,6 +237,7 @@ def get_cc1_command_for_args(cmd, env): + or ln.startswith("InstalledDir:") + or ln.startswith("LLVM Profile Note") + or ln.startswith(" (in-process)") ++ or ln.startswith("Configuration file:") + or " version " in ln + ): + continue diff --git a/Makefile b/Makefile index 902d857..242e15d 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ # Tweak this to centos-stream-9-x86_64 to build for CentOS MOCK_CHROOT?=fedora-rawhide-x86_64 MOCK_OPTS?= -MOCK_OPTS_RELEASE?=--no-clean --no-cleanup-after --without lto_build --define "debug_package %{nil}" $(MOCK_OPTS) +MOCK_OPTS_RELEASE?=--no-clean --no-cleanup-after --without lto_build --without pgo --define "debug_package %{nil}" $(MOCK_OPTS) MOCK_OPTS_SNAPSHOT?=$(MOCK_OPTS_RELEASE) --with snapshot_build $(MOCK_OPTS) YYYYMMDD?=$(shell date +%Y%m%d) SOURCEDIR=$(shell pwd) @@ -103,6 +103,22 @@ edit-last-failing-script: get-last-run-script mockbuild-rerun-last-script: get-last-run-script mock --root=$(MOCK_CHROOT) --shell 'sh -e $(last_run_script)' +.PHONY: mock-shell +## Run an interactive mock shell with bash +mock-shell: + mock --root=$(MOCK_CHROOT) --shell bash + +######### Help debug inside mock environment + +.PHONY: mock-install-debugging-tools +## This will install gdb, gdb-dashboard, vim, valgrind, lldb and +## other tools into your mock environment for you to debug any +## problems. +mock-install-debugging-tools: + mock --root=$(MOCK_CHROOT) --install python3-pygments vim gdb lldb python3-rpm valgrind + curl -sLO https://github.com/cyrus-and/gdb-dashboard/raw/master/.gdbinit + mock --root=$(MOCK_CHROOT) --copyin .gdbinit /builddir/.gdbinit + .PHONY: help # Based on https://gist.github.com/rcmachado/af3db315e31383502660 ## Display this help text. diff --git a/gating.yaml b/gating.yaml index cdcc377..30b98a7 100644 --- a/gating.yaml +++ b/gating.yaml @@ -23,6 +23,7 @@ rules: --- !Policy product_versions: - rhel-9 + - rhel-10 decision_context: osci_compose_gate rules: - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier0-tmt-x86_64-aarch64.functional} diff --git a/llvm.spec b/llvm.spec index ff88cff..b828ddb 100644 --- a/llvm.spec +++ b/llvm.spec @@ -2,7 +2,7 @@ #region version %global maj_ver 20 %global min_ver 1 -%global patch_ver 3 +%global patch_ver 8 #global rc_ver 3 %bcond_with snapshot_build @@ -41,6 +41,21 @@ %bcond_without lldb +%ifarch ppc64le +%if %{defined rhel} && 0%{?rhel} < 10 && %{maj_ver} >= 21 +# RHEL <= 9 use the IBM long double format, which is not supported by libc. +# Since LLVM 21, parts of libc are required in order to build offload. +%bcond_with offload +%else +%bcond_without offload +%endif +%elifarch %{ix86} +# libomptarget is not supported on 32-bit systems. +%bcond_with offload +%else +%bcond_without offload +%endif + %if %{without compat_build} && 0%{?fedora} >= 41 %ifarch %{ix86} %bcond_with mlir @@ -79,6 +94,37 @@ %bcond_with polly %endif +#region pgo +%ifarch %{ix86} +%bcond_with pgo +%else +%if 0%{?fedora} >= 43 || (0%{?rhel} >= 9 && %{maj_ver} >= 21) +%bcond_without pgo +%else +%bcond_with pgo +%endif +%endif + +# We only want to run the performance comparison on snapshot builds. +# centos-streams/RHEL do not have all the requirements. We tried to use pip, +# but we've seen issues on some architectures. We're now restricting this +# to Fedora. +%if %{with pgo} && %{with snapshot_build} && %{defined fedora} +%global run_pgo_perf_comparison 1 +%else +%global run_pgo_perf_comparison %{nil} +%endif + +# Sanity checks for PGO and bootstrapping +#---------------------------------------- +%if %{with pgo} +%ifarch %{ix86} +%{error:Your architecture is not allowed for PGO because it is in this list: %{ix86}} +%endif +%endif +#---------------------------------------- +#endregion pgo + # Disable LTO on x86 and riscv in order to reduce memory consumption. %ifarch %ix86 riscv64 %bcond_with lto_build @@ -86,7 +132,9 @@ %bcond_without lto_build %endif -%if %{without lto_build} +# For PGO Disable LTO for now because of LLVMgold.so not found error +# Use LLVM_ENABLE_LTO:BOOL=ON flags to enable LTO instead +%if 0%{without lto_build} || 0%{with pgo} %global _lto_cflags %nil %endif @@ -112,6 +160,12 @@ %global gts_version 14 %endif +%if %{defined rhel} && 0%{?rhel} <= 8 +%bcond_with libedit +%else +%bcond_without libedit +%endif + # Opt out of https://fedoraproject.org/wiki/Changes/fno-omit-frame-pointer # https://bugzilla.redhat.com/show_bug.cgi?id=2158587 %undefine _include_frame_pointers @@ -123,6 +177,22 @@ %global src_tarball_dir llvm-project-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}.src %endif +%global has_crtobjs 1 +%if %{maj_ver} < 21 +%ifarch s390x +%global has_crtobjs 0 +%endif +%endif + +# LLD uses "fast" as the algortithm for generating build-id +# values while ld.bfd uses "sha1" by default. We need to get lld +# to use the same algorithm or otherwise we end up with errors like thise one: +# +# "build-id found in [...]/usr/lib64/llvm21/bin/llvm-debuginfod-find too small" +# +# NOTE: Originally this is only needed for PGO but it doesn't hurt to have it on all the time. +%global build_ldflags %{?build_ldflags} -Wl,--build-id=sha1 + #region LLVM globals %if %{with compat_build} @@ -140,15 +210,15 @@ %global install_prefix %{_libdir}/llvm%{maj_ver} %global install_bindir %{install_prefix}/bin %global install_includedir %{install_prefix}/include -%global install_libdir %{install_prefix}/lib +%global install_libdir %{install_prefix}/%{_lib} %global install_datadir %{install_prefix}/share %global install_mandir %{install_prefix}/share/man %global install_libexecdir %{install_prefix}/libexec -%global build_libdir llvm/%{_vpath_builddir}/lib -%global unprefixed_libdir lib +%global build_libdir llvm/%{_vpath_builddir}/%{_lib} +%global unprefixed_libdir %{_lib} %if 0%{?rhel} -%global targets_to_build "X86;AMDGPU;PowerPC;NVPTX;SystemZ;AArch64;BPF;WebAssembly" +%global targets_to_build "X86;AMDGPU;PowerPC;NVPTX;SystemZ;AArch64;BPF;WebAssembly;RISCV" %global experimental_targets_to_build "" %else %global targets_to_build "all" @@ -233,6 +303,13 @@ #region polly globals %global pkg_name_polly polly%{pkg_suffix} #endregion polly globals + +#region PGO globals +%if 0%{run_pgo_perf_comparison} +%global llvm_test_suite_dir %{_datadir}/llvm-test-suite +%endif +#endregion PGO globals + #endregion globals #region packages @@ -296,6 +373,7 @@ Source1000: version.spec.inc #region CLANG patches Patch101: 0001-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch Patch102: 0003-PATCH-clang-Don-t-install-static-libraries.patch +Patch2002: 20-131099.patch # Workaround a bug in ORC on ppc64le. # More info is available here: https://reviews.llvm.org/D159115#4641826 @@ -329,10 +407,6 @@ Patch501: 0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch # https://github.com/llvm/llvm-project/issues/124001 Patch1901: 0001-SystemZ-Fix-ICE-with-i128-i64-uaddo-carry-chain.patch -# Backport fix for https://bugzilla.redhat.com/show_bug.cgi?id=2352554. -# https://github.com/llvm/llvm-project/pull/131801 -Patch2004: 131801.patch - %if 0%{?rhel} == 8 %global python3_pkgversion 3.12 %global __python3 /usr/bin/python3.12 @@ -357,6 +431,28 @@ BuildRequires: zlib-devel BuildRequires: libzstd-devel BuildRequires: libffi-devel BuildRequires: ncurses-devel + +%if %{with pgo} +BuildRequires: lld +BuildRequires: compiler-rt +BuildRequires: llvm + +%if 0%{run_pgo_perf_comparison} +BuildRequires: llvm-test-suite +BuildRequires: tcl-devel +BuildRequires: which +# pandas and scipy are needed for running llvm-test-suite/utils/compare.py +# For RHEL we have to install it from pip and for fedora we take the RPM package. +%if 0%{?rhel} +BuildRequires: python3-pip +%else +BuildRequires: python3-pandas +BuildRequires: python3-scipy +%endif +%endif + +%endif + # This intentionally does not use python3_pkgversion. RHEL 8 does not have # python3.12-sphinx, and we are only using it as a binary anyway. BuildRequires: python3-sphinx @@ -381,8 +477,10 @@ BuildRequires: binutils-gold # Enable extra functionality when run the LLVM JIT under valgrind. BuildRequires: valgrind-devel %endif +%if %{with libedit} # LLVM's LineEditor library will use libedit if it is available. BuildRequires: libedit-devel +%endif # We need python3-devel for %%py3_shebang_fix BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-setuptools @@ -463,7 +561,6 @@ tools as well as libraries with equivalent functionality. Summary: LLVM lit test runner for Python 3 BuildArch: noarch -Requires: python%{python3_pkgversion}-setuptools %if 0%{?rhel} == 8 # Became python3.12-clang in LLVM 19 Obsoletes: python3-lit < 18.9 @@ -494,7 +591,9 @@ Requires: %{pkg_name_llvm}-libs%{?_isa} = %{version}-%{release} # 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 %{with libedit} Requires: libedit-devel +%endif Requires: libzstd-devel # The installed cmake files reference binaries from llvm-test, llvm-static, and # llvm-gtest. We tried in the past to split the cmake exports for these binaries @@ -1117,7 +1216,7 @@ sed -i 's/LLDB_ENABLE_PYTHON/TRUE/' lldb/docs/CMakeLists.txt %endif %global projects clang;clang-tools-extra;lld -%global runtimes compiler-rt;openmp;offload +%global runtimes compiler-rt;openmp %if %{with lldb} %global projects %{projects};lldb @@ -1139,6 +1238,10 @@ sed -i 's/LLDB_ENABLE_PYTHON/TRUE/' lldb/docs/CMakeLists.txt %global runtimes %{runtimes};libcxx;libcxxabi;libunwind %endif +%if %{with offload} +%global runtimes %{runtimes};offload +%endif + %global cfg_file_content --gcc-triple=%{_target_cpu}-redhat-linux # We want to use DWARF-5 on all snapshot builds. @@ -1173,6 +1276,17 @@ export ASMFLAGS="%{build_cflags}" cd llvm +# Remember old values to reset to +OLD_PATH="$PATH" +OLD_LD_LIBRARY_PATH="$LD_LIBRARY_PATH" +OLD_CWD="$PWD" + +%global builddir_instrumented $RPM_BUILD_DIR/instrumented-llvm +%if 0%{run_pgo_perf_comparison} +%global builddir_perf_pgo $RPM_BUILD_DIR/performance-of-pgoed-clang +%global builddir_perf_system $RPM_BUILD_DIR/performance-of-system-clang +%endif + #region LLVM lit %if %{with python_lit} pushd utils/lit @@ -1198,7 +1312,8 @@ popd -DBUILD_SHARED_LIBS=OFF \\\ -DLLVM_BUILD_LLVM_DYLIB=ON \\\ -DLLVM_LINK_LLVM_DYLIB=ON \\\ - -DCLANG_LINK_CLANG_DYLIB=ON + -DCLANG_LINK_CLANG_DYLIB=ON \\\ + -DLLVM_ENABLE_FFI:BOOL=ON %global cmake_config_args %{cmake_common_args} @@ -1214,8 +1329,15 @@ popd -DCLANG_INCLUDE_TESTS:BOOL=ON \\\ -DCLANG_PLUGIN_SUPPORT:BOOL=ON \\\ -DCLANG_REPOSITORY_STRING="%{?dist_vendor} %{version}-%{release}" \\\ - -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=../clang-tools-extra \\\ + -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=../clang-tools-extra + +%if %{with compat_build} +%global cmake_config_args %{cmake_config_args} \\\ -DCLANG_RESOURCE_DIR=../../../lib/clang/%{maj_ver} +%else +%global cmake_config_args %{cmake_config_args} \\\ + -DCLANG_RESOURCE_DIR=../lib/clang/%{maj_ver} +%endif #endregion clang options #region compiler-rt options @@ -1294,7 +1416,6 @@ popd -DLLVM_BUILD_TOOLS:BOOL=ON \\\ -DLLVM_BUILD_UTILS:BOOL=ON \\\ -DLLVM_DEFAULT_TARGET_TRIPLE=%{llvm_triple} \\\ - -DLLVM_ENABLE_FFI:BOOL=ON \\\ -DLLVM_ENABLE_LIBCXX:BOOL=OFF \\\ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \\\ -DLLVM_ENABLE_PROJECTS="%{projects}" \\\ @@ -1360,9 +1481,13 @@ popd %global cmake_config_args %{cmake_config_args} \\\ -DCMAKE_INSTALL_PREFIX=%{install_prefix} \\\ -DENABLE_LINKER_BUILD_ID:BOOL=ON \\\ - -DOFFLOAD_INSTALL_LIBDIR=%{unprefixed_libdir} \\\ -DPython3_EXECUTABLE=%{__python3} +%if %{with offload} +%global cmake_config_args %{cmake_config_args} \\\ + -DOFFLOAD_INSTALL_LIBDIR=%{unprefixed_libdir} +%endif + # During the build, we use both the system clang and the just-built clang, and # they need to use the system and just-built shared objects respectively. If # we use LD_LIBRARY_PATH to point to our build directory, the system clang @@ -1381,6 +1506,10 @@ popd %global cmake_config_args %{cmake_config_args} -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" %endif +%if 0%{?__isa_bits} == 64 + %global cmake_config_args %{cmake_config_args} -DLLVM_LIBDIR_SUFFIX=64 +%endif + %if %{with gold} %global cmake_config_args %{cmake_config_args} -DLLVM_BINUTILS_INCDIR=%{_includedir} %endif @@ -1415,7 +1544,126 @@ if grep 'flags.*la57' /proc/cpuinfo; then fi #endregion cmake options -%cmake -G Ninja %cmake_config_args $extra_cmake_args +%if %{with pgo} +#region Instrument LLVM +%global __cmake_builddir %{builddir_instrumented} + +# For -Wno-backend-plugin see https://llvm.org/docs/HowToBuildWithPGO.html +#%%global optflags_for_instrumented %(echo %{optflags} -Wno-backend-plugin) + +%global cmake_config_args_instrumented %{cmake_config_args} \\\ + -DLLVM_ENABLE_PROJECTS:STRING="clang;lld" \\\ + -DLLVM_ENABLE_RUNTIMES="compiler-rt" \\\ + -DLLVM_TARGETS_TO_BUILD=Native \\\ + -DCMAKE_BUILD_TYPE:STRING=Release \\\ + -DCMAKE_INSTALL_PREFIX=%{builddir_instrumented} \\\ + -DCLANG_INCLUDE_DOCS:BOOL=OFF \\\ + -DLLVM_BUILD_DOCS:BOOL=OFF \\\ + -DLLVM_BUILD_UTILS:BOOL=OFF \\\ + -DLLVM_ENABLE_DOXYGEN:BOOL=OFF \\\ + -DLLVM_ENABLE_SPHINX:BOOL=OFF \\\ + -DLLVM_INCLUDE_DOCS:BOOL=OFF \\\ + -DLLVM_INCLUDE_TESTS:BOOL=OFF \\\ + -DLLVM_INSTALL_UTILS:BOOL=OFF \\\ + -DCLANG_BUILD_EXAMPLES:BOOL=OFF \\\ + \\\ + -DLLVM_BUILD_INSTRUMENTED=IR \\\ + -DLLVM_BUILD_RUNTIME=No \\\ + -DLLVM_ENABLE_LTO:BOOL=Thin \\\ + -DLLVM_USE_LINKER=lld + +# CLANG_INCLUDE_TESTS=ON is needed to make the target "generate-profdata" available +%global cmake_config_args_instrumented %{cmake_config_args_instrumented} \\\ + -DCLANG_INCLUDE_TESTS:BOOL=ON + +# LLVM_INCLUDE_UTILS=ON is needed because the tests enabled by CLANG_INCLUDE_TESTS=ON +# require "FileCheck", "not", "count", etc. +%global cmake_config_args_instrumented %{cmake_config_args_instrumented} \\\ + -DLLVM_INCLUDE_UTILS:BOOL=ON + +# LLVM Profile Warning: Unable to track new values: Running out of static counters. +# Consider using option -mllvm -vp-counters-per-site= to allocate more value profile +# counters at compile time. +%global cmake_config_args_instrumented %{cmake_config_args_instrumented} \\\ + -DLLVM_VP_COUNTERS_PER_SITE=8 + +# TODO(kkleine): Should we see warnings like: +# "function control flow change detected (hash mismatch)" +# then read https://issues.chromium.org/issues/40633598 again. +%cmake -G Ninja %{cmake_config_args_instrumented} $extra_cmake_args + +# Build all the tools we need in order to build generate-profdata and llvm-profdata +%cmake_build --target libclang-cpp.so +%cmake_build --target clang +%cmake_build --target lld +%cmake_build --target llvm-profdata +%cmake_build --target llvm-ar +%cmake_build --target llvm-ranlib +%cmake_build --target llvm-cxxfilt +#endregion Instrument LLVM + +#region Perf training +# Without these exports the function count is ~160 and with them it is ~200,000. +export LD_LIBRARY_PATH="%{builddir_instrumented}/%{_lib}:%{builddir_instrumented}/lib:$OLD_LD_LIBRARY_PATH" +export PATH="%{builddir_instrumented}/bin:$OLD_PATH" + +%cmake_build --target generate-profdata + +# Use the newly compiled llvm-profdata to avoid profile version mismatches like: +# "raw profile version mismatch: Profile uses raw profile format version = 10; expected version = 9" +%global llvm_profdata_bin %{builddir_instrumented}/bin/llvm-profdata +%global llvm_cxxfilt_bin %{builddir_instrumented}/bin/llvm-cxxfilt + +# Show top 10 functions in the profile +%llvm_profdata_bin show --topn=10 %{builddir_instrumented}/tools/clang/utils/perf-training/clang.profdata | %llvm_cxxfilt_bin + +cp %{builddir_instrumented}/tools/clang/utils/perf-training/clang.profdata $RPM_BUILD_DIR/result.profdata + +#endregion Perf training +%endif + +#region Final stage + +#region reset paths and globals +function reset_paths { + export PATH="$OLD_PATH" + export LD_LIBRARY_PATH="$OLD_LD_LIBRARY_PATH" +} +reset_paths + +cd $OLD_CWD +%global _vpath_srcdir . +%global __cmake_builddir %{_vpath_builddir} +#endregion reset paths and globals + +%global extra_cmake_opts %{nil} + +%if %{with pgo} + %global extra_cmake_opts %{extra_cmake_opts} -DLLVM_PROFDATA_FILE=$RPM_BUILD_DIR/result.profdata + # There were a couple of errors that I ran into. One basically said: + # + # Error: LLVM Profile Warning: Unable to track new values: Running out of + # static counters. Consider using option -mllvm -vp-counters-per-site= to + # allocate more value profile counters at compile time. + # + # As a solution I’ve added the --vp-counters-per-site option but this resulted + # in a follow-up error: + # + # Error: clang (LLVM option parsing): for the --vp-counters-per-site option: + # may only occur zero or one times! + # + # The solution was to modify vp-counters-per-site option through + # LLVM_VP_COUNTERS_PER_SITE instead of adding it, hence the + # -DLLVM_VP_COUNTERS_PER_SITE=8. + %global extra_cmake_opts %{extra_cmake_opts} -DLLVM_VP_COUNTERS_PER_SITE=8 +%if 0%{with lto_build} + %global extra_cmake_opts %{extra_cmake_opts} -DLLVM_ENABLE_LTO:BOOL=Thin + %global extra_cmake_opts %{extra_cmake_opts} -DLLVM_ENABLE_FATLTO=ON +%endif + %global extra_cmake_opts %{extra_cmake_opts} -DLLVM_USE_LINKER=lld +%endif + +%cmake -G Ninja %{cmake_config_args} %{extra_cmake_opts} $extra_cmake_args # Build libLLVM.so first. This ensures that when libLLVM.so is linking, there # are no other compile jobs running. This will help reduce OOM errors on the @@ -1441,8 +1689,74 @@ fi # /usr/lib64/libomptarget.devicertl.a # /usr/lib64/libomptarget-amdgpu-*.bc # /usr/lib64/libomptarget-nvptx-*.bc - %cmake_build --target runtimes +#endregion Final stage + +#region Performance comparison +%if 0%{run_pgo_perf_comparison} + +function run_perf_test { + local build_dir=$1 + + cd %{llvm_test_suite_dir} + %__cmake -G Ninja \ + -S "%{llvm_test_suite_dir}" \ + -B "${build_dir}" \ + -DCMAKE_GENERATOR=Ninja \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ + -DTEST_SUITE_BENCHMARKING_ONLY=ON \ + -DTEST_SUITE_COLLECT_STATS=ON \ + -DTEST_SUITE_USE_PERF=OFF \ + -DTEST_SUITE_SUBDIRS=CTMark \ + -DTEST_SUITE_RUN_BENCHMARKS=OFF \ + -DTEST_SUITE_COLLECT_CODE_SIZE=OFF \ + -C%{llvm_test_suite_dir}/cmake/caches/O3.cmake + + # Build the test-suite + %__cmake --build "${build_dir}" -j1 --verbose + + # Run the tests with lit: + %{builddir_instrumented}/bin/llvm-lit -v -o ${build_dir}/results.json ${build_dir} || true + cd $OLD_CWD +} + +# Run performance test for system clang +reset_paths +run_perf_test %{builddir_perf_system} + +# Run performance test for PGOed clang +reset_paths +FINAL_BUILD_DIR=`pwd`/%{_vpath_builddir} +export LD_LIBRARY_PATH="${FINAL_BUILD_DIR}/lib:${FINAL_BUILD_DIR}/lib64:${LD_LIBRARY_PATH}" +export PATH="${FINAL_BUILD_DIR}/bin:${OLD_PATH}" +run_perf_test %{builddir_perf_pgo} + +# Compare the performance of system and PGOed clang +%if 0%{?rhel} +python3 -m venv compare-env +source ./compare-env/bin/activate +pip install "pandas>=2.2.3" +pip install "scipy>=1.13.1" +MY_PYTHON_BIN=./compare-env/bin/python3 +%endif + +system_llvm_release=$(/usr/bin/clang --version | grep -Po '[0-9]+\.[0-9]+\.[0-9]' | head -n1) +${MY_PYTHON_BIN} %{llvm_test_suite_dir}/utils/compare.py \ + --metric compile_time \ + --lhs-name ${system_llvm_release} \ + --rhs-name pgo-%{version} \ + %{builddir_perf_system}/results.json vs %{builddir_perf_pgo}/results.json > %{builddir_perf_pgo}/results-system-vs-pgo.txt || true + +echo "Result of Performance comparison between system and PGOed clang" +cat %{builddir_perf_pgo}/results-system-vs-pgo.txt + +%if 0%{?rhel} +# Deactivate virtual python environment created ealier +deactivate +%endif +%endif +#endregion Performance comparison #region compat lib cd .. @@ -1457,7 +1771,7 @@ cd .. -DLLVM_INCLUDE_BENCHMARKS=OFF \ -DLLVM_INCLUDE_TESTS=OFF \ %{cmake_common_args} \ -%if %{maj_ver} <= 20 +%if %{compat_maj_ver} <= 19 -DLLVM_TARGETS_TO_BUILD="$(echo %{targets_to_build});Mips;ARM" \ %endif %{nil} @@ -1565,6 +1879,14 @@ EOF # Add a symlink in bindir to clang-format-diff ln -s ../share/clang/clang-format-diff.py %{buildroot}%{install_bindir}/clang-format-diff +# Install the PGO profile that was used to build this LLVM into the clang package +%if 0%{with pgo} +cp -v $RPM_BUILD_DIR/result.profdata %{buildroot}%{install_datadir}/llvm-pgo.profdata +%if 0%{run_pgo_perf_comparison} +cp -v %{builddir_perf_pgo}/results-system-vs-pgo.txt %{buildroot}%{install_datadir}/results-system-vs-pgo.txt +%endif +%endif + # File in the macros file for other packages to use. We are not doing this # in the compat package, because the version macros would # conflict with # eachother if both clang and the clang compat package were installed together. @@ -1585,7 +1907,7 @@ install -p -m644 clang/bindings/python/clang/* %{buildroot}%{python3_sitelib}/cl %py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/clang # install scanbuild-py to python sitelib. -mv %{buildroot}%{install_libdir}/{libear,libscanbuild} %{buildroot}%{python3_sitelib} +mv %{buildroot}%{install_prefix}/lib/{libear,libscanbuild} %{buildroot}%{python3_sitelib} # Cannot use {libear,libscanbuild} style expansion in py_byte_compile. %py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/libear %py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/libscanbuild @@ -1599,7 +1921,7 @@ done %else # Not sure where to put these python modules for the compat build. -rm -Rf %{buildroot}%{install_libdir}/{libear,libscanbuild} +rm -Rf %{buildroot}%{install_prefix}/lib/{libear,libscanbuild} rm %{buildroot}%{install_bindir}/scan-build-py # Not sure where to put the emacs integration files for the compat build. @@ -1626,8 +1948,12 @@ rm -Rvf %{buildroot}%{install_datadir}/clang-doc # TODO: What are the Fedora guidelines for packaging bash autocomplete files? rm -vf %{buildroot}%{install_datadir}/clang/bash-autocomplete.sh -# Create sub-directories in the clang resource directory that will be -# populated by other packages +%if %{without compat_build} +# Move clang resource directory to default prefix. +mkdir -p %{buildroot}%{_prefix}/lib/clang +mv %{buildroot}%{install_prefix}/lib/clang/%{maj_ver} %{buildroot}%{_prefix}/lib/clang/%{maj_ver} +%endif +# Create any missing sub-directories in the clang resource directory. mkdir -p %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/{bin,include,lib,share}/ # Add versioned resource directory macro @@ -1680,7 +2006,7 @@ rm -rf %{buildroot}/%{install_datadir}/gdb # chmod go+w %{buildroot}/%{_datarootdir}/gdb/python/ompd/ompdModule.so # chmod +w %{buildroot}/%{_datarootdir}/gdb/python/ompd/ompdModule.so -%ifnarch %{ix86} +%if %{with offload} # Remove files that we don't package, yet. rm %{buildroot}%{install_bindir}/llvm-offload-device-info rm %{buildroot}%{install_bindir}/llvm-omp-kernel-replay @@ -1713,7 +2039,7 @@ rmdir %{buildroot}%{install_prefix}/%{_lib}/python%{python3_version} # python: fix binary libraries location liblldb=$(basename $(readlink -e %{buildroot}%{install_libdir}/liblldb.so)) -ln -vsf "../../../llvm%{maj_ver}/lib/${liblldb}" %{buildroot}%{python3_sitearch}/lldb/_lldb.so +ln -vsf "../../../${liblldb}" %{buildroot}%{python3_sitearch}/lldb/_lldb.so %py_byte_compile %{__python3} %{buildroot}%{python3_sitearch}/lldb %endif %endif @@ -1754,40 +2080,9 @@ popd rm -f %{buildroot}%{install_libdir}/libLLVMBOLT*.a #endregion BOLT installation -# Create symlinks from the system install prefix to the llvm install prefix. -# Do this at the end so it includes any files added by preceding steps. -mkdir -p %{buildroot}%{_bindir} -for f in %{buildroot}%{install_bindir}/*; do - filename=`basename $f` - if [[ "$filename" == "clang-%{maj_ver}" ]]; then - continue - fi - # Add symlink for binaries with version suffix. - ln -s ../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename-%{maj_ver} - # For non-compat builds, also add a symlink without version suffix. - %if %{without compat_build} - ln -s ../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename - %endif -done - -# Move man pages to system install prefix. -mkdir -p %{buildroot}%{_mandir}/man1 -for f in %{buildroot}%{install_mandir}/man1/*; do - filename=`basename $f` - filename=${filename%.1} - mv $f %{buildroot}%{_mandir}/man1/$filename-%{maj_ver}.1 - %if %{without compat_build} - ln -s $filename-%{maj_ver}.1 %{buildroot}%{_mandir}/man1/$filename.1 - %endif -done -rmdir %{buildroot}%{install_mandir}/man1 -rmdir %{buildroot}%{install_mandir} - -%if %{without compat_build} -# We don't create directory symlinks, because RPM does not support -# switching between a directory and a symlink, causing upgrade/downgrade issues. -# Instead, recursively copy the directories while creating symlinks. -copy_with_relative_symlinks() { +# Move files from src to dest and replace the old files in src with relative +# symlinks. +move_and_replace_with_symlinks() { local src="$1" local dest="$2" mkdir -p "$dest" @@ -1795,14 +2090,59 @@ copy_with_relative_symlinks() { # Change to source directory to simplify relative paths (cd "$src" && \ find * -type d -exec mkdir -p "$dest/{}" \; && \ - find * \( -type f -o -type l \) -exec ln -s --relative "$src/{}" "$dest/{}" \;) + find * \( -type f -o -type l \) -exec mv "$src/{}" "$dest/{}" \; \ + -exec ln -s --relative "$dest/{}" "$src/{}" \;) } -# Add symlinks for libraries. -copy_with_relative_symlinks %{buildroot}%{install_libdir} %{buildroot}%{_libdir} -copy_with_relative_symlinks %{buildroot}%{install_libexecdir} %{buildroot}%{_libexecdir} -copy_with_relative_symlinks %{buildroot}%{install_includedir} %{buildroot}%{_includedir} -copy_with_relative_symlinks %{buildroot}%{install_datadir} %{buildroot}%{_datadir} +%if %{without compat_build} +# Move files from the llvm prefix to the system prefix and replace them with +# symlinks. We do it this way around because symlinks between multilib packages +# would conflict otherwise. +move_and_replace_with_symlinks %{buildroot}%{install_bindir} %{buildroot}%{_bindir} +move_and_replace_with_symlinks %{buildroot}%{install_libdir} %{buildroot}%{_libdir} +move_and_replace_with_symlinks %{buildroot}%{install_libexecdir} %{buildroot}%{_libexecdir} +move_and_replace_with_symlinks %{buildroot}%{install_includedir} %{buildroot}%{_includedir} +move_and_replace_with_symlinks %{buildroot}%{install_datadir} %{buildroot}%{_datadir} +%endif + +# Create versioned symlinks for binaries. +# Do this at the end so it includes any files added by preceding steps. +mkdir -p %{buildroot}%{_bindir} +for f in %{buildroot}%{install_bindir}/*; do + filename=`basename $f` + if [[ "$filename" =~ ^(lit|ld|clang-%{maj_ver})$ ]]; then + continue + fi + %if %{with compat_build} + ln -s ../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename-%{maj_ver} + %else + # clang-NN is already created by the build system. + if [[ "$filename" == "clang" ]]; then + continue + fi + ln -s $filename %{buildroot}/%{_bindir}/$filename-%{maj_ver} + %endif +done + +mkdir -p %{buildroot}%{_mandir}/man1 +for f in %{buildroot}%{install_mandir}/man1/*; do + filename=`basename $f` + filename=${filename%.1} + %if %{with compat_build} + # Move man pages to system install prefix. + mv $f %{buildroot}%{_mandir}/man1/$filename-%{maj_ver}.1 + %else + # Create suffixed symlink. + ln -s $filename.1 %{buildroot}%{_mandir}/man1/$filename-%{maj_ver}.1 + %endif +done +rm -rf %{buildroot}%{install_mandir} + +# As an exception, always keep llvm-config in the versioned prefix. +# The llvm-config in the default prefix will be managed by alternatives. +%if %{without compat_build} +rm %{buildroot}%{install_bindir}/llvm-config +mv %{buildroot}%{_bindir}/llvm-config %{buildroot}%{install_bindir}/llvm-config %endif # ghost presence for llvm-config, managed by alternatives. @@ -1973,13 +2313,14 @@ export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_curr_parallel_handle.c" export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_display_control_vars.c" export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_thread_handle.c" +%if %{with pgo} +# TODO(kkleine): I unset LIT_XFAIL here because the tests above unexpectedly passed since Aug 16th on fedora-40-x86_64 +unset LIT_XFAIL +%endif + # The following test is flaky and we'll filter it out -test_list_filter_out+=("libomp :: ompt/teams/distribute_dispatch.c") test_list_filter_out+=("libomp :: affinity/kmp-abs-hw-subset.c") -test_list_filter_out+=("libomp :: parallel/bug63197.c") -test_list_filter_out+=("libomp :: tasking/issue-69733.c") -test_list_filter_out+=("libarcher :: races/task-taskgroup-unrelated.c") -test_list_filter_out+=("libarcher :: races/task-taskwait-nested.c") +test_list_filter_out+=("libomp :: ompt/teams/distribute_dispatch.c") # These tests fail more often than not, but not always. test_list_filter_out+=("libomp :: worksharing/for/omp_collapse_many_GELTGT_int.c") @@ -1987,22 +2328,31 @@ test_list_filter_out+=("libomp :: worksharing/for/omp_collapse_many_GTGEGT_int.c test_list_filter_out+=("libomp :: worksharing/for/omp_collapse_many_LTLEGE_int.c") test_list_filter_out+=("libomp :: worksharing/for/omp_collapse_one_int.c") +%if %{maj_ver} < 21 +# The following test is flaky and we'll filter it out +test_list_filter_out+=("libomp :: parallel/bug63197.c") +test_list_filter_out+=("libomp :: tasking/issue-69733.c") +test_list_filter_out+=("libarcher :: races/task-taskgroup-unrelated.c") + # The following tests have been failing intermittently. # Issue upstream: https://github.com/llvm/llvm-project/issues/127796 test_list_filter_out+=("libarcher :: races/task-two.c") test_list_filter_out+=("libarcher :: races/lock-nested-unrelated.c") +%endif %ifarch s390x test_list_filter_out+=("libomp :: flush/omp_flush.c") test_list_filter_out+=("libomp :: worksharing/for/omp_for_schedule_guided.c") %endif +%if %{maj_ver} < 21 %ifarch aarch64 s390x # The following test has been failing intermittently on aarch64 and s390x. # Re-enable it after https://github.com/llvm/llvm-project/issues/117773 # gets fixed. test_list_filter_out+=("libarcher :: races/taskwait-depend.c") %endif +%endif # The following tests seem pass on ppc64le and x86_64 and aarch64 only: %ifnarch ppc64le x86_64 s390x aarch64 @@ -2046,6 +2396,7 @@ export LIT_XFAIL="$LIT_XFAIL;races/task-dependency.c" export LIT_XFAIL="$LIT_XFAIL;races/task-taskgroup-unrelated.c" export LIT_XFAIL="$LIT_XFAIL;races/task-two.c" export LIT_XFAIL="$LIT_XFAIL;races/taskwait-depend.c" +export LIT_XFAIL="$LIT_XFAIL;races/task-taskwait-nested.c" export LIT_XFAIL="$LIT_XFAIL;reduction/parallel-reduction-nowait.c" export LIT_XFAIL="$LIT_XFAIL;reduction/parallel-reduction.c" export LIT_XFAIL="$LIT_XFAIL;task/omp_task_depend_all.c" @@ -2104,9 +2455,22 @@ export LIT_XFAIL="$LIT_XFAIL;offloading/thread_state_2.c" adjust_lit_filter_out test_list_filter_out +%if %{maj_ver} >= 21 +# This allows openmp tests to be re-run 4 times. Once they pass +# after being re-run, they are marked as FLAKYPASS. +# See https://github.com/llvm/llvm-project/pull/141851 for the +# --max-retries-per-test option. +# We don't know if 4 is the right number to use here we just +# need to start with some number. +# Once https://github.com/llvm/llvm-project/pull/142413 landed +# we can see the exact number of attempts the tests needed +# to pass. And then we can adapt this number. +export LIT_OPTS="$LIT_OPTS --max-retries-per-test=4" +%endif + %if 0%{?rhel} # libomp tests are often very slow on s390x brew builders -%ifnarch s390x +%ifnarch s390x riscv64 %cmake_build --target check-openmp %endif %else @@ -2234,7 +2598,13 @@ cp %{_vpath_builddir}/.ninja_log %{buildroot}%{_datadir} %post -n %{pkg_name_llvm}-devel update-alternatives --install %{_bindir}/llvm-config-%{maj_ver} llvm-config-%{maj_ver} %{install_bindir}/llvm-config %{__isa_bits} %if %{without compat_build} -update-alternatives --install %{_bindir}/llvm-config llvm-config %{install_bindir}/llvm-config %{__isa_bits} +# Prioritize newer LLVM versions over older and 64-bit over 32-bit. +update-alternatives --install %{_bindir}/llvm-config llvm-config %{install_bindir}/llvm-config $((%{maj_ver}*100+%{__isa_bits})) + +# Remove old llvm-config-%{__isa_bits} alternative. This will only do something during the +# first upgrade from a version that used it. In all other cases it will error, so suppress the +# expected error message. +update-alternatives --remove llvm-config %{_bindir}/llvm-config-%{__isa_bits} 2>/dev/null ||: # During the upgrade from LLVM 16 (F38) to LLVM 17 (F39), we found out the # main llvm-devel package was leaving entries in the alternatives system. @@ -2252,14 +2622,14 @@ if [ $1 -eq 0 ]; then update-alternatives --remove llvm-config%{exec_suffix} %{install_bindir}/llvm-config fi %if %{without compat_build} -# When upgrading between minor versions (i.e. from x.y.1 to x.y.2), we must -# not remove the alternative. -# However, during a major version upgrade (i.e. from 16.x.y to 17.z.w), the -# alternative must be removed in order to give priority to a newly installed -# compat package. -if [[ $1 -eq 0 - || "x$(%{_bindir}/llvm-config%{exec_suffix} --version | awk -F . '{ print $1 }')" != "x%{maj_ver}" ]]; then - update-alternatives --remove llvm-config-%{maj_ver} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} +# There are a number of different cases here: +# Uninstall: Remove alternatives. +# Patch version upgrade: Keep alternatives. +# Major version upgrade with installation of compat package: Keep alternatives for compat package. +# Major version upgrade without installation of compat package: Remove alternatives. However, we +# can't distinguish it from the previous case, so we conservatively leave it behind. +if [ $1 -eq 0 ]; then + update-alternatives --remove llvm-config-%{maj_ver} %{install_bindir}/llvm-config fi %endif @@ -2428,6 +2798,12 @@ fi yaml2obj }} +%if %{maj_ver} >= 21 +%{expand_bins %{expand: + llvm-ml64 +}} +%endif + %{expand_mans %{expand: bugpoint clang-tblgen @@ -2554,6 +2930,14 @@ fi llvm-isel-fuzzer llvm-opt-fuzzer }} +%if %{maj_ver} >= 21 +%{expand_bins %{expand: + llvm-test-mustache-spec +}} +%{expand_mans %{expand: + llvm-test-mustache-spec +}} +%endif %files -n %{pkg_name_llvm}-googletest %license llvm/LICENSE.TXT @@ -2593,6 +2977,14 @@ fi %endif %{expand_mans clang clang++} +%if 0%{with pgo} +%{expand_datas %{expand: llvm-pgo.profdata }} +%if 0%{run_pgo_perf_comparison} +%{expand_datas %{expand: results-system-vs-pgo.txt }} +%endif +%endif + + %files -n %{pkg_name_clang}-libs %license clang/LICENSE.TXT %{_prefix}/lib/clang/%{maj_ver}/include/* @@ -2695,6 +3087,12 @@ fi clang-format-diff run-clang-tidy }} +%if %{maj_ver} >= 21 +%{expand_bins %{expand: + offload-arch +}} +%endif + %if %{without compat_build} %{_emacs_sitestartdir}/clang-format.el %{_emacs_sitestartdir}/clang-include-fixer.el @@ -2742,12 +3140,12 @@ fi # Files that appear on all targets %{_prefix}/lib/clang/%{maj_ver}/lib/%{compiler_rt_triple}/libclang_rt.* -%ifnarch s390x +%if %{has_crtobjs} %{_prefix}/lib/clang/%{maj_ver}/lib/%{compiler_rt_triple}/clang_rt.crtbegin.o %{_prefix}/lib/clang/%{maj_ver}/lib/%{compiler_rt_triple}/clang_rt.crtend.o %endif -%ifnarch %{ix86} s390x +%ifnarch %{ix86} s390x riscv64 %{_prefix}/lib/clang/%{maj_ver}/lib/%{compiler_rt_triple}/liborc_rt.a %endif @@ -2767,9 +3165,7 @@ fi libompd.so libarcher.so }} -%ifnarch %{ix86} -# libomptarget is not supported on 32-bit systems. -# s390x does not support the offloading plugins. +%if %{with offload} %expand_libs libomptarget.so.%{so_suffix} %expand_libs libLLVMOffload.so.%{so_suffix} %endif @@ -2782,16 +3178,27 @@ fi %{_prefix}/lib/clang/%{maj_ver}/include/ompt.h %{_prefix}/lib/clang/%{maj_ver}/include/ompt-multiplex.h %expand_libs cmake/openmp -%ifnarch %{ix86} -# libomptarget is not supported on 32-bit systems. -# s390x does not support the offloading plugins. +%if %{with offload} +%{expand_libs %{expand: + libomptarget.so + libLLVMOffload.so +}} + +%if %{maj_ver} < 21 %{expand_libs %{expand: libomptarget.devicertl.a libomptarget-amdgpu*.bc libomptarget-nvptx*.bc - libomptarget.so - libLLVMOffload.so }} +%else +%{expand_libs %{expand: + amdgcn-amd-amdhsa/libompdevice.a + amdgcn-amd-amdhsa/libomptarget-amdgpu.bc + nvptx64-nvidia-cuda/libompdevice.a + nvptx64-nvidia-cuda/libomptarget-nvptx.bc +}} +%endif + %expand_includes offload %endif #endregion OPENMP files @@ -3025,7 +3432,63 @@ fi #region changelog %changelog -* Thu May 15 2025 Nikita Popov - 20.1.3-1 +* Wed Jul 09 2025 Nikita Popov - 20.1.8-1 +- Update to LLVM 20.1.8 + +* Fri Jun 20 2025 Kashyap Chamarthy - 20.1.7-2 +- Add riscv64 enablement bits; thanks: Songsong Zhang + (U2FsdGVkX1@gmail.com) and David Abdurachmanov (davidlt@rivosinc.com) + +* Thu Jun 19 2025 Nikita Popov - 20.1.7-1 +- Update to LLVM 20.1.7 + +* Tue Jun 17 2025 Nikita Popov - 20.1.6-10 +- Fix llvm-config alternatives handling (rhbz#2361779) + +* Mon Jun 16 2025 Nikita Popov - 20.1.6-9 +- Use libdir suffix in versioned prefix + +* Tue Jun 10 2025 Nikita Popov - 20.1.6-8 +- Invert symlink direction +- Fix i686 multilib installation (rhbz#2365079) + +* Thu Jun 05 2025 Timm Bäder - 20.1.6-7 +- Backport patch to fix rhbz#2363895 + +* Wed Jun 04 2025 Python Maint - 20.1.6-6 +- Rebuilt for Python 3.14 + +* Wed Jun 04 2025 Python Maint - 20.1.6-5 +- Bootstrap for Python 3.14 + +* Wed Jun 04 2025 Python Maint - 20.1.6-4 +- Rebuilt for Python 3.14 + +* Tue Jun 03 2025 Tulio Magno Quites Machado Filho - 20.1.6-3 +- Remove temporary changes on ppc64le + +* Tue Jun 03 2025 Python Maint - 20.1.6-2 +- Rebuilt for Python 3.14 + +* Fri May 30 2025 Nikita Popov - 20.1.6-1 +- Update to LLVM 20.1.6 + +* Mon May 26 2025 Konrad Kleine - 20.1.5-2 +- Build with PGO + +* Thu May 22 2025 Nikita Popov - 20.1.5-1 +- Update to LLVM 20.1.5 + +* Tue May 06 2025 Tom Stellard - 20.1.4-6 +- Fix build on ppc64le with glibc >= 2.42 + +* Tue May 06 2025 Nikita Popov - 20.1.4-5 +- Update to LLVM 20.1.4 + +* Sat Apr 26 2025 Tom Stellard - 20.1.3-2 +- Fix build with glibc >= 2.42 + +* Thu Apr 17 2025 Nikita Popov - 20.1.3-1 - Update to LLVM 20.1.3 * Thu May 15 2025 Nikita Popov - 20.1.2-3 diff --git a/rpminspect.yaml b/rpminspect.yaml index 18c241f..3f5febc 100644 --- a/rpminspect.yaml +++ b/rpminspect.yaml @@ -1,4 +1,9 @@ --- +inspections: + # We need to disable abidiff due to abidiff+testing-farm issues. Ref link: + # https://docs.testing-farm.io/Testing%20Farm/0.1/errors.html#TFE-1 + abidiff: off + badfuncs: # For compiler-rt, we allow the following forbidden functions: # - gethostbyname diff --git a/sources b/sources index f7d138f..a33516a 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ SHA512 (llvm-project-19.1.7.src.tar.xz) = c7d63286d662707a9cd54758c9e3aaf52794a91900c484c4a6efa62d90bc719d5e7a345e4192feeb0c9fd11c82570d64677c781e5be1d645556b6aa018e47ec8 SHA512 (llvm-project-19.1.7.src.tar.xz.sig) = 195797b06ac80a742e0ccbc03a50dc06dd2e04377d783d5474e3e72c5a75203b60292b047929312a411d22b137a239943fba414a4d136a2be14cbff978eb6bda -SHA512 (llvm-project-20.1.3.src.tar.xz) = 79d6cfd10075ec9d05b9a359c09579e07a2caff9167518519457daee3e37a818100da6712804916880797ecb0b4891b18dc52a03b534e1b9d1d4bb5ba8d5ad1e -SHA512 (llvm-project-20.1.3.src.tar.xz.sig) = 4fd3815cd94113234e66083f955993a95c888cbb89d5baf611b76765511e102af9f1e880cbacc709f0be8785abd5abbfb0ce391793308dfec3c248a9b348e492 +SHA512 (llvm-project-20.1.8.src.tar.xz) = f330e72e6a1da468569049437cc0ba7a41abb816ccece7367189344f7ebfef730f4788ac7af2bef0aa8a49341c15ab1d31e941ffa782f264d11fe0dc05470773 +SHA512 (llvm-project-20.1.8.src.tar.xz.sig) = d74369bdb4d1b82775161ea53c9c5f3a23ce810f4df5ff617123023f9d8ce720e7d6ecc9e17f8ebd39fd9e7a9de79560abdf2ffe73bcb907a43148d43665d619