From f8feb932eb8ed7be7d6b4924d738f503501416b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 18 Jun 2025 14:22:58 +0200 Subject: [PATCH] Update to 20.1.7 Resolves: RHEL-89980 Resolves: RHEL-81016 --- .gitignore | 4 + ...mon-Disable-termio-ioctls-on-PowerPC.patch | 51 ++++ ...-Disable-termio-ioctls-on-PowerPC.patch.20 | 56 +++++ 131801.patch | 46 ---- 20-131099.patch | 28 +++ 446.patch | 235 ++++++++++++++++++ llvm.spec | 233 +++++++++++------ sources | 6 +- 8 files changed, 537 insertions(+), 122 deletions(-) create mode 100644 0001-sanitizer_common-Disable-termio-ioctls-on-PowerPC.patch create mode 100644 0001-sanitizer_common-Disable-termio-ioctls-on-PowerPC.patch.20 delete mode 100644 131801.patch create mode 100644 20-131099.patch create mode 100644 446.patch diff --git a/.gitignore b/.gitignore index 8dda14a..3b33516 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,7 @@ SOURCES/llvm-15.0.7.src.tar.xz /llvm-project-19.1.7.src.tar.xz.sig /llvm-project-20.1.3.src.tar.xz /llvm-project-20.1.3.src.tar.xz.sig +/llvm-project-20.1.6.src.tar.xz +/llvm-project-20.1.6.src.tar.xz.sig +/llvm-project-20.1.7.src.tar.xz +/llvm-project-20.1.7.src.tar.xz.sig diff --git a/0001-sanitizer_common-Disable-termio-ioctls-on-PowerPC.patch b/0001-sanitizer_common-Disable-termio-ioctls-on-PowerPC.patch new file mode 100644 index 0000000..f44d6cb --- /dev/null +++ b/0001-sanitizer_common-Disable-termio-ioctls-on-PowerPC.patch @@ -0,0 +1,51 @@ +From be7b1ef7c8e58b454e20f7f70d0e316528e2c823 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Tue, 29 Apr 2025 21:35:57 +0000 +Subject: [PATCH] [sanitizer_common] Disable termio ioctls on PowerPC + +glibc-2.42 removed the termio.h header, but there are refrences to it +still in the kernel's ioctl.h, so we need disable these ioctls to fix +this build. +--- + .../sanitizer_platform_limits_posix.cpp | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp +index 7a89bf1c7498..7b81951f82ae 100644 +--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp +@@ -182,6 +182,12 @@ typedef struct user_fpregs elf_fpregset_t; + #include + #endif + ++// Work around struct termio usage in ioctl.h on ppc64le. ++#if SANITIZER_GLIBC && !__has_include() && defined(__powerpc64__) ++ #define DISABLE_TERMIO_IOCTLS 1 ++#endif ++ ++ + // Include these after system headers to avoid name clashes and ambiguities. + # include "sanitizer_common.h" + # include "sanitizer_internal_defs.h" +@@ -779,13 +785,15 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + unsigned IOCTL_SOUND_PCM_WRITE_FILTER = SOUND_PCM_WRITE_FILTER; + #endif // SOUND_VERSION + unsigned IOCTL_TCFLSH = TCFLSH; ++#if !defined(DISABLE_TERMIO_IOCTLS) + unsigned IOCTL_TCGETA = TCGETA; +- unsigned IOCTL_TCGETS = TCGETS; +- unsigned IOCTL_TCSBRK = TCSBRK; +- unsigned IOCTL_TCSBRKP = TCSBRKP; + unsigned IOCTL_TCSETA = TCSETA; + unsigned IOCTL_TCSETAF = TCSETAF; + unsigned IOCTL_TCSETAW = TCSETAW; ++#endif ++ unsigned IOCTL_TCGETS = TCGETS; ++ unsigned IOCTL_TCSBRK = TCSBRK; ++ unsigned IOCTL_TCSBRKP = TCSBRKP; + unsigned IOCTL_TCSETS = TCSETS; + unsigned IOCTL_TCSETSF = TCSETSF; + unsigned IOCTL_TCSETSW = TCSETSW; +-- +2.48.1 + diff --git a/0001-sanitizer_common-Disable-termio-ioctls-on-PowerPC.patch.20 b/0001-sanitizer_common-Disable-termio-ioctls-on-PowerPC.patch.20 new file mode 100644 index 0000000..e9facda --- /dev/null +++ b/0001-sanitizer_common-Disable-termio-ioctls-on-PowerPC.patch.20 @@ -0,0 +1,56 @@ +From 1e49835cc5737b2dffff5923e09546b70a54f90d Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Tue, 29 Apr 2025 21:35:57 +0000 +Subject: [PATCH] [sanitizer_common] Disable termio ioctls on PowerPC + +glibc-2.42 removed the termio.h header, but there are refrences to it +still in the kernel's ioctl.h, so we need disable these ioctls to fix +this build. +--- + .../sanitizer_platform_limits_posix.cpp | 19 ++++++++++++++++--- + 1 file changed, 16 insertions(+), 3 deletions(-) + +diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp +index 10b6535499de..303c82783528 100644 +--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp +@@ -173,6 +173,17 @@ typedef struct user_fpregs elf_fpregset_t; + #include + #endif + ++#if SANITIZER_HAIKU ++#include ++#include ++#endif ++ ++// Work around struct termio usage in ioctl.h on ppc64le. ++#if SANITIZER_GLIBC && !__has_include() && defined(__powerpc64__) ++ #define DISABLE_TERMIO_IOCTLS 1 ++#endif ++ ++ + // Include these after system headers to avoid name clashes and ambiguities. + # include "sanitizer_common.h" + # include "sanitizer_internal_defs.h" +@@ -764,13 +775,15 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + unsigned IOCTL_SOUND_PCM_WRITE_FILTER = SOUND_PCM_WRITE_FILTER; + #endif // SOUND_VERSION + unsigned IOCTL_TCFLSH = TCFLSH; ++#if !defined(DISABLE_TERMIO_IOCTLS) + unsigned IOCTL_TCGETA = TCGETA; +- unsigned IOCTL_TCGETS = TCGETS; +- unsigned IOCTL_TCSBRK = TCSBRK; +- unsigned IOCTL_TCSBRKP = TCSBRKP; + unsigned IOCTL_TCSETA = TCSETA; + unsigned IOCTL_TCSETAF = TCSETAF; + unsigned IOCTL_TCSETAW = TCSETAW; ++#endif ++ unsigned IOCTL_TCGETS = TCGETS; ++ unsigned IOCTL_TCSBRK = TCSBRK; ++ unsigned IOCTL_TCSBRKP = TCSBRKP; + unsigned IOCTL_TCSETS = TCSETS; + unsigned IOCTL_TCSETSF = TCSETSF; + unsigned IOCTL_TCSETSW = TCSETSW; +-- +2.48.1 + 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/446.patch b/446.patch new file mode 100644 index 0000000..ce99301 --- /dev/null +++ b/446.patch @@ -0,0 +1,235 @@ +From 595c2a20d256bf8e3b2ac8687c0029b42e64878d Mon Sep 17 00:00:00 2001 +From: Nikita Popov +Date: Jun 13 2025 08:46:26 +0000 +Subject: 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. + +--- + +diff --git a/Makefile b/Makefile +index ced0465..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) +diff --git a/llvm.spec b/llvm.spec +index 9d9e5d7..dcdef08 100644 +--- a/llvm.spec ++++ b/llvm.spec +@@ -316,7 +316,7 @@ + #region main package + Name: %{pkg_name_llvm} + Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}} +-Release: 7%{?dist} ++Release: 8%{?dist} + Summary: The Low Level Virtual Machine + + License: Apache-2.0 WITH LLVM-exception OR NCSA +@@ -1330,8 +1330,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 +@@ -1938,8 +1945,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 +@@ -2025,7 +2036,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 +@@ -2066,62 +2077,69 @@ popd + rm -f %{buildroot}%{install_libdir}/libLLVMBOLT*.a + #endregion BOLT installation + +-# Create symlinks from the system install prefix to the llvm install prefix. ++# 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" ++ ++ # Change to source directory to simplify relative paths ++ (cd "$src" && \ ++ find * -type d -exec mkdir -p "$dest/{}" \; && \ ++ find * \( -type f -o -type l \) -exec mv "$src/{}" "$dest/{}" \; \ ++ -exec ln -s --relative "$dest/{}" "$src/{}" \;) ++} ++ ++%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" == "clang-%{maj_ver}" ]]; then ++ if [[ "$filename" =~ ^(lit|ld|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 ++ %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 + +-# 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 ++ %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 +-rmdir %{buildroot}%{install_mandir}/man1 +-rmdir %{buildroot}%{install_mandir} ++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} +-# 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() { +- local src="$1" +- local dest="$2" +- mkdir -p "$dest" +- +- # 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/{}" \;) +-} +- +-# 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 %{maj_ver} >= 21 && %{with offload} +-# Remove offload libaries since we only want to ship these in the configured +-# install prefix. +-rm -Rf %{buildroot}%{_libdir}/amdgcn-amd-amdhsa +-rm -Rf %{buildroot}%{_libdir}/nvptx64-nvidia-cuda +-%endif ++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. +@@ -3164,10 +3182,12 @@ fi + libomptarget-nvptx*.bc + }} + %else +-%{install_libdir}/amdgcn-amd-amdhsa/libompdevice.a +-%{install_libdir}/amdgcn-amd-amdhsa/libomptarget-amdgpu.bc +-%{install_libdir}/nvptx64-nvidia-cuda/libompdevice.a +-%{install_libdir}/nvptx64-nvidia-cuda/libomptarget-nvptx.bc ++%{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 +@@ -3403,6 +3423,10 @@ fi + + #region changelog + %changelog ++* 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 + + diff --git a/llvm.spec b/llvm.spec index 2be60f6..e2b918c 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 7 #global rc_ver 3 %bcond_with snapshot_build @@ -24,7 +24,7 @@ %bcond_with compat_build # Bundle compat libraries for a previous LLVM version, as part of llvm-libs and # clang-libs. Used on RHEL. -%bcond_without bundle_compat_lib +%bcond_with bundle_compat_lib %bcond_without check %if %{with bundle_compat_lib} @@ -112,6 +112,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 +129,13 @@ %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 + #region LLVM globals %if %{with compat_build} @@ -140,12 +153,12 @@ %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" @@ -239,7 +252,7 @@ #region main package Name: %{pkg_name_llvm} Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}} -Release: 2%{?dist} +Release: 1%{?dist} Summary: The Low Level Virtual Machine License: Apache-2.0 WITH LLVM-exception OR NCSA @@ -296,6 +309,10 @@ 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 +# Can be removed if https://github.com/llvm/llvm-project/pull/131099 lands in v21: +Patch2102: 20-131099.patch +#endregion CLANG patches # Workaround a bug in ORC on ppc64le. # More info is available here: https://reviews.llvm.org/D159115#4641826 @@ -306,6 +323,10 @@ Patch103: 0001-Workaround-a-bug-in-ORC-on-ppc64le.patch Patch104: 0001-Driver-Give-devtoolset-path-precedence-over-Installe.patch #endregion CLANG patches +# Fix for glibc >= 2.42 on ppc64le +Patch2008: 0001-sanitizer_common-Disable-termio-ioctls-on-PowerPC.patch.20 +Patch2108: 0001-sanitizer_common-Disable-termio-ioctls-on-PowerPC.patch + # Fix LLVMConfig.cmake when symlinks are used. # (https://github.com/llvm/llvm-project/pull/124743 landed in LLVM 21) Patch1902: 0001-cmake-Resolve-symlink-when-finding-install-prefix.patch @@ -329,10 +350,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 @@ -381,8 +398,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 @@ -493,7 +512,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 @@ -1116,7 +1137,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 @@ -1138,6 +1159,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. @@ -1189,12 +1214,16 @@ popd # Common cmake arguments used by both the normal build and bundle_compat_lib. # Any ABI-affecting flags should be in here. %global cmake_common_args \\\ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \\\ -DLLVM_ENABLE_EH=ON \\\ -DLLVM_ENABLE_RTTI=ON \\\ -DLLVM_USE_PERF=ON \\\ -DLLVM_TARGETS_TO_BUILD=%{targets_to_build} \\\ -DBUILD_SHARED_LIBS=OFF \\\ - -DLLVM_BUILD_LLVM_DYLIB=ON + -DLLVM_BUILD_LLVM_DYLIB=ON \\\ + -DLLVM_LINK_LLVM_DYLIB=ON \\\ + -DCLANG_LINK_CLANG_DYLIB=ON \\\ + -DLLVM_ENABLE_FFI:BOOL=ON %global cmake_config_args %{cmake_common_args} @@ -1208,11 +1237,17 @@ popd -DCLANG_ENABLE_STATIC_ANALYZER:BOOL=ON \\\ -DCLANG_INCLUDE_DOCS:BOOL=ON \\\ -DCLANG_INCLUDE_TESTS:BOOL=ON \\\ - -DCLANG_LINK_CLANG_DYLIB=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 @@ -1291,8 +1326,6 @@ popd -DLLVM_BUILD_TOOLS:BOOL=ON \\\ -DLLVM_BUILD_UTILS:BOOL=ON \\\ -DLLVM_DEFAULT_TARGET_TRIPLE=%{llvm_triple} \\\ - -DLLVM_DYLIB_COMPONENTS="all" \\\ - -DLLVM_ENABLE_FFI:BOOL=ON \\\ -DLLVM_ENABLE_LIBCXX:BOOL=OFF \\\ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \\\ -DLLVM_ENABLE_PROJECTS="%{projects}" \\\ @@ -1306,7 +1339,6 @@ popd -DLLVM_INCLUDE_UTILS:BOOL=ON \\\ -DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF \\\ -DLLVM_INSTALL_UTILS:BOOL=ON \\\ - -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \\\ -DLLVM_PARALLEL_LINK_JOBS=1 \\\ -DLLVM_TOOLS_INSTALL_DIR:PATH=bin \\\ -DLLVM_UNREACHABLE_OPTIMIZE:BOOL=OFF \\\ @@ -1357,12 +1389,15 @@ popd #region misc options %global cmake_config_args %{cmake_config_args} \\\ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \\\ -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 +1416,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 @@ -1586,7 +1625,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 @@ -1600,7 +1639,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. @@ -1629,6 +1668,12 @@ 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 @@ -1681,7 +1726,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 @@ -1714,7 +1759,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 @@ -1755,40 +1800,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" @@ -1796,14 +1810,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. @@ -1974,6 +2033,11 @@ 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") @@ -2755,7 +2819,7 @@ 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 @@ -2780,9 +2844,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 @@ -2795,16 +2857,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 @@ -3038,6 +3111,22 @@ fi #region changelog %changelog +* Fri May 30 2025 Nikita Popov - 20.1.6-1 +- Update to LLVM 20.1.6 + + +* 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 diff --git a/sources b/sources index 2dd442f..ebb9d27 100644 --- a/sources +++ b/sources @@ -1,4 +1,2 @@ -SHA512 (llvm-project-20.1.3.src.tar.xz) = 79d6cfd10075ec9d05b9a359c09579e07a2caff9167518519457daee3e37a818100da6712804916880797ecb0b4891b18dc52a03b534e1b9d1d4bb5ba8d5ad1e -SHA512 (llvm-project-20.1.3.src.tar.xz.sig) = 4fd3815cd94113234e66083f955993a95c888cbb89d5baf611b76765511e102af9f1e880cbacc709f0be8785abd5abbfb0ce391793308dfec3c248a9b348e492 -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.7.src.tar.xz) = c2dbf6a468a8152409db7ff52902ecf8768a1d0328e386999f4f3672613903e1c10bddbba66b8553a6222952f8edb66266947f1fb21d0b09ae741e6249b6d1fa +SHA512 (llvm-project-20.1.7.src.tar.xz.sig) = eff885059d547f57b98bda1fc9631f716ca6c650cd48203d9ed5443a6afb9a2d4d91d3f5c8618e307c0a44b3040bce61fdc6bce965073adc537655755d9f2112