From 2421001db4b69f3b0c226395b4adaa3094f46c71 Mon Sep 17 00:00:00 2001 From: Jesus Checa Hidalgo Date: Mon, 3 Mar 2025 13:27:28 +0100 Subject: [PATCH 1/2] Maintentance update to testplans. * Remove DevTools metadata from plans as collections are no longer maintained * Update tests/README.md * Sync lld-alternatives testplan --- tests/README.md | 7 +++++-- tests/build-gating.fmf | 10 +--------- tests/lld-alternatives.fmf | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 tests/lld-alternatives.fmf diff --git a/tests/README.md b/tests/README.md index 5aeb3d6..26a7ffb 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,6 +1,9 @@ # Gating testplans for LLVM -The tests for LLVM are in a separate repo: https://src.fedoraproject.org/tests/llvm +The tests for LLVM are in a dedicated, separate repo: https://gitlab.com/redhat/centos-stream/tests/llvm.git + This directory should contain only fmf plans (such as build-gating.fmf) which import the tests from the tests repo. This can be done using the "url" parameter of the -plan's "discover" step. Reference: https://tmt.readthedocs.io/en/stable/spec/plans.html#fmf \ No newline at end of file +plan's "discover" step. + +Reference: https://tmt.readthedocs.io/en/stable/spec/plans.html#fmf diff --git a/tests/build-gating.fmf b/tests/build-gating.fmf index be6b730..1c7152e 100644 --- a/tests/build-gating.fmf +++ b/tests/build-gating.fmf @@ -19,15 +19,6 @@ adjust: and trigger != build enabled: false - - because: "When testing SCL-ized LLVM, the collection must be enabled first" - environment+: - WITH_SCL: "scl enable llvm-toolset-13.0 rust-toolset-1.58" - when: "collection == llvm-toolset-13.0" - - because: "When testing SCL-ized LLVM, the collection must be enabled first" - environment+: - WITH_SCL: "scl enable llvm-toolset-14.0 rust-toolset-1.62" - when: "collection == llvm-toolset-14.0" - # Unfortunatelly, TMT does not support more declarative approach, we need to run commands on our own. - because: "On CentOS, CRB must be enabled to provide rarer packages" prepare+: @@ -52,6 +43,7 @@ discover: how: fmf url: https://gitlab.com/redhat/centos-stream/tests/llvm.git ref: main + filter: "tag:-spoils-installation & tag:-not-in-default" execute: how: tmt provision: diff --git a/tests/lld-alternatives.fmf b/tests/lld-alternatives.fmf new file mode 100644 index 0000000..3b46dff --- /dev/null +++ b/tests/lld-alternatives.fmf @@ -0,0 +1,20 @@ +summary: LLD tests for build/PR gating, testing alternatives and spoiling the installation +adjust: + - because: "Plan to be ran when either executed locally, or executed by CI system to gate a build or PR." + when: >- + trigger is defined + and trigger != commit + and trigger != build + enabled: false + +discover: + - name: lld-tests + how: fmf + url: https://gitlab.com/redhat/centos-stream/tests/llvm.git + ref: main + test: ld-alternative +execute: + how: tmt +provision: + hardware: + memory: ">= 4 GiB" From 442ba971bf9ece124b7c9b2949af86f2c503f777 Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Mon, 14 Apr 2025 13:30:49 +0200 Subject: [PATCH 2/2] Update to 20.1.2 Resolves: RHEL-80988 --- .copr/Makefile | 7 +- .copr/snapshot-info.sh | 76 + .git-blame-ignore-revs | 9 + .gitignore | 7 + .pre-commit-config.yaml | 30 + ...-18-Always-build-shared-libs-for-LLD.patch | 29 - 0001-20-polly-shared-libs.patch | 59 + ...-ICE-with-i128-i64-uaddo-carry-chain.patch | 81 + ...-symlink-when-finding-install-prefix.patch | 39 + ...-option-to-disable-tsan-tests-111548.patch | 62 - ...-Support-CET-in-z_Linux_asm.S-123213.patch | 51 - ...siblings_list-if-physical_package_id.patch | 205 -- ...-vaddr-for-__llvm_write_binary_ids-n.patch | 86 - 131801.patch | 46 + 18-99273.patch | 893 -------- Makefile | 190 ++ llvm.rpmlintrc | 31 + llvm.spec | 1847 +++++++++++------ rpminspect.yaml | 4 + sources | 2 + tests/build-gating.fmf | 7 +- 21 files changed, 1766 insertions(+), 1995 deletions(-) create mode 100644 .copr/snapshot-info.sh create mode 100644 .git-blame-ignore-revs create mode 100644 .pre-commit-config.yaml delete mode 100644 0001-18-Always-build-shared-libs-for-LLD.patch create mode 100644 0001-20-polly-shared-libs.patch create mode 100644 0001-SystemZ-Fix-ICE-with-i128-i64-uaddo-carry-chain.patch create mode 100644 0001-cmake-Resolve-symlink-when-finding-install-prefix.patch delete mode 100644 0001-openmp-Add-option-to-disable-tsan-tests-111548.patch delete mode 100644 0001-openmp-Support-CET-in-z_Linux_asm.S-123213.patch delete mode 100644 0001-openmp-Use-core_siblings_list-if-physical_package_id.patch delete mode 100644 0001-profile-Use-base-vaddr-for-__llvm_write_binary_ids-n.patch create mode 100644 131801.patch delete mode 100644 18-99273.patch create mode 100644 Makefile diff --git a/.copr/Makefile b/.copr/Makefile index 753982b..d470d45 100644 --- a/.copr/Makefile +++ b/.copr/Makefile @@ -4,13 +4,14 @@ COPR_USERNAME=$(shell rpm --eval %copr_username) COPR_PROJECT=$(shell rpm --eval %copr_projectname) +YYYYMMDD=$(shell date +%Y%m%d) .PHONY: srpm srpm: - dnf install -y dnf-plugins-core fedora-packager - dnf copr enable -y --setopt=reposdir=/tmp/yum.repos.d $(COPR_USERNAME)/$(COPR_PROJECT) - dnf install -y --setopt=reposdir=/tmp/yum.repos.d llvm-snapshot-builder + dnf install -y git tar xz curl --setopt=install_weak_deps=False + YYYYMMDD=$(YYYYMMDD) ./.copr/snapshot-info.sh > version.spec.inc rpmbuild \ + --with=snapshot_build \ --define "_srcrpmdir $(outdir)" \ --define "_sourcedir $(shell pwd)" \ --define "_disable_source_fetch 0" \ diff --git a/.copr/snapshot-info.sh b/.copr/snapshot-info.sh new file mode 100644 index 0000000..7f6dcdf --- /dev/null +++ b/.copr/snapshot-info.sh @@ -0,0 +1,76 @@ +#!/usr/bin/bash + +# You need these packages to run this script: git tar xz curl-minimal + +set -e + +# This is important for systems that have a different local but want to produce +# a valid changelog date. +LANG=en_EN + +function loginfo() { + local msg=$1 + >&2 echo "[INFO]" $msg +} + +function logerr() { + local msg=$1 + >&2 echo "[ERROR]" $msg +} + +# Check if we shall gather versioning information from a supplied git tree +if [ "$GIT_TREE" != "" ]; then + loginfo "Gathering snapshot info from here: $GIT_TREE" + if [ "$(git -C $GIT_TREE rev-parse --is-inside-work-tree 2>/dev/null)" != "true" ]; then + logerr "Not a git directory: $GIT_TREE" + exit 1 + fi + llvm_snapshot_git_revision=$(git -C $GIT_TREE rev-parse HEAD) + versionfile=$GIT_TREE/cmake/Modules/LLVMVersion.cmake + llvm_snapshot_version=`grep -ioP 'set\(\s*LLVM_VERSION_(MAJOR|MINOR|PATCH)\s\K[0-9]+' ${versionfile} | paste -sd '.'` +fi + +loginfo "Determine date in YYYYMMDD form" +llvm_snapshot_yyyymmdd=$(date +%Y%m%d) +[[ ! -z "${YYYYMMDD}" ]] && llvm_snapshot_yyyymmdd=$YYYYMMDD + +if [ -z $GIT_TREE ]; then + git_revision_url=https://github.com/fedora-llvm-team/llvm-snapshots/releases/download/snapshot-version-sync/llvm-git-revision-${llvm_snapshot_yyyymmdd}.txt + loginfo "Get the revision for today from $git_revision_url" + llvm_snapshot_git_revision=$(curl -sL $git_revision_url) +fi +llvm_snapshot_git_revision_short=$(echo "${llvm_snapshot_git_revision:0:14}") + + +if [ -z $GIT_TREE ]; then + release_url=https://github.com/fedora-llvm-team/llvm-snapshots/releases/download/snapshot-version-sync/llvm-release-${llvm_snapshot_yyyymmdd}.txt + loginfo "Get the release for today from $release_url" + llvm_snapshot_version=$(curl -sL $release_url) +fi +llvm_snapshot_version_major=$(echo $llvm_snapshot_version | cut -f1 -d.) +llvm_snapshot_version_minor=$(echo $llvm_snapshot_version | cut -f2 -d.) +llvm_snapshot_version_patch=$(echo $llvm_snapshot_version | cut -f3 -d.) +llvm_snapshot_version_suffix=pre${llvm_snapshot_yyyymmdd}.g${llvm_snapshot_git_revision_short} + +tempfile=$(mktemp) +cat > $tempfile <&2 + +# One to redirect it away +cat $tempfile diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..2b6ffb3 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,9 @@ +# Since version 2.23 (released in August 2019), git-blame has a feature +# to ignore or bypass certain commits. +# +# This file contains a list of commits that are not likely what you +# are looking for in a blame, such as mass reformatting or renaming. +# You can set this file as a default ignore file for blame by running +# the following command. +# +# $ git config blame.ignoreRevsFile .git-blame-ignore-revs diff --git a/.gitignore b/.gitignore index d4e7b84..0ee3384 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,14 @@ /*.src.rpm /*.src.tar.xz /*.src.tar.xz.sig +/*.tar.gz /cmake/ /llvm-*.src/ /results_llvm/ /third-party/ +/llvm-git-revision-*.txt +/llvm-release-*.txt +/BUILD +/BUILDROOT +/out +/version.spec.inc diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..ae14bc7 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,30 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-ast + - id: check-case-conflict + - id: check-docstring-first + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-symlinks + - id: trailing-whitespace + - id: end-of-file-fixer + - id: mixed-line-ending + - id: fix-byte-order-marker + - id: detect-private-key + - id: check-toml + - id: check-yaml + args: + - "--allow-multiple-documents" + - "--unsafe" + + # See https://tmt.readthedocs.io/en/latest/guide.html#checking-data-validity + - repo: https://github.com/teemtee/tmt.git + rev: 1.38.0 + hooks: + - id: tmt-lint + +exclude: ".*\\.patch" diff --git a/0001-18-Always-build-shared-libs-for-LLD.patch b/0001-18-Always-build-shared-libs-for-LLD.patch deleted file mode 100644 index 1659800..0000000 --- a/0001-18-Always-build-shared-libs-for-LLD.patch +++ /dev/null @@ -1,29 +0,0 @@ -From b1c60d7fa322a2d208556087df9e7ef94bfbffb8 Mon Sep 17 00:00:00 2001 -From: Nikita Popov -Date: Wed, 8 May 2024 12:30:36 +0900 -Subject: [PATCH] Always build shared libs for LLD - -We don't want to enable BUILD_SHARED_LIBS for the whole build, -but we do want to build lld libraries. ---- - lld/cmake/modules/AddLLD.cmake | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/lld/cmake/modules/AddLLD.cmake b/lld/cmake/modules/AddLLD.cmake -index 2ee066b41535..270c03f096ac 100644 ---- a/lld/cmake/modules/AddLLD.cmake -+++ b/lld/cmake/modules/AddLLD.cmake -@@ -7,9 +7,8 @@ macro(add_lld_library name) - "" - "" - ${ARGN}) -- if(ARG_SHARED) -- set(ARG_ENABLE_SHARED SHARED) -- endif() -+ # Always build shared libs for LLD. -+ set(ARG_ENABLE_SHARED SHARED) - llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS}) - set_target_properties(${name} PROPERTIES FOLDER "lld libraries") - --- -2.44.0 \ No newline at end of file diff --git a/0001-20-polly-shared-libs.patch b/0001-20-polly-shared-libs.patch new file mode 100644 index 0000000..b0c90da --- /dev/null +++ b/0001-20-polly-shared-libs.patch @@ -0,0 +1,59 @@ +From cecb98f56e7d6619d0427fbdbc2f200ce212f0c6 Mon Sep 17 00:00:00 2001 +From: Konrad Kleine +Date: Tue, 28 Jan 2025 08:34:09 +0000 +Subject: [PATCH] [polly] shared libs + +--- + polly/cmake/polly_macros.cmake | 5 ++++- + polly/lib/CMakeLists.txt | 1 + + polly/lib/External/CMakeLists.txt | 1 + + 3 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/polly/cmake/polly_macros.cmake b/polly/cmake/polly_macros.cmake +index 9bd7b0b0ea59..fc2c3a76901f 100644 +--- a/polly/cmake/polly_macros.cmake ++++ b/polly/cmake/polly_macros.cmake +@@ -1,5 +1,5 @@ + macro(add_polly_library name) +- cmake_parse_arguments(ARG "" "" "" ${ARGN}) ++ cmake_parse_arguments(ARG "SHARED" "" "" ${ARGN}) + set(srcs ${ARG_UNPARSED_ARGUMENTS}) + if(MSVC_IDE OR XCODE) + file( GLOB_RECURSE headers *.h *.td *.def) +@@ -17,6 +17,9 @@ macro(add_polly_library name) + else() + set(libkind) + endif() ++ if (ARG_SHARED) ++ set(libkind SHARED) ++ endif() + add_library( ${name} ${libkind} ${srcs} ) + set_target_properties(${name} PROPERTIES FOLDER "Polly/Libraries") + +diff --git a/polly/lib/CMakeLists.txt b/polly/lib/CMakeLists.txt +index d91f4ecd37e6..965f635b7ff6 100644 +--- a/polly/lib/CMakeLists.txt ++++ b/polly/lib/CMakeLists.txt +@@ -41,6 +41,7 @@ set(POLLY_COMPONENTS + # the sources them to be recompiled for each of them. + add_llvm_pass_plugin(Polly + NO_MODULE ++ SHARED + SUBPROJECT Polly + Analysis/DependenceInfo.cpp + Analysis/PolyhedralInfo.cpp +diff --git a/polly/lib/External/CMakeLists.txt b/polly/lib/External/CMakeLists.txt +index 5dd69b7199dc..f065fbd7b942 100644 +--- a/polly/lib/External/CMakeLists.txt ++++ b/polly/lib/External/CMakeLists.txt +@@ -284,6 +284,7 @@ if (POLLY_BUNDLED_ISL) + ) + + add_polly_library(PollyISL ++ SHARED + ${ISL_FILES} + ) + +-- +2.46.0 + diff --git a/0001-SystemZ-Fix-ICE-with-i128-i64-uaddo-carry-chain.patch b/0001-SystemZ-Fix-ICE-with-i128-i64-uaddo-carry-chain.patch new file mode 100644 index 0000000..4ec2d1d --- /dev/null +++ b/0001-SystemZ-Fix-ICE-with-i128-i64-uaddo-carry-chain.patch @@ -0,0 +1,81 @@ +From 6d5697f7cb4e933d2f176c46b7ac05a9cbaeb8b6 Mon Sep 17 00:00:00 2001 +From: Ulrich Weigand +Date: Thu, 23 Jan 2025 19:11:18 +0100 +Subject: [PATCH] [SystemZ] Fix ICE with i128->i64 uaddo carry chain + +We can only optimize a uaddo_carry via specialized instruction +if the carry was produced by another uaddo(_carry) instruction; +there is already a check for that. + +However, i128 uaddo(_carry) use a completely different mechanism; +they indicate carry in a vector register instead of the CC flag. +Thus, we must also check that we don't mix those two - that check +has been missing. + +Fixes: https://github.com/llvm/llvm-project/issues/124001 +--- + .../Target/SystemZ/SystemZISelLowering.cpp | 12 ++++++---- + llvm/test/CodeGen/SystemZ/pr124001.ll | 23 +++++++++++++++++++ + 2 files changed, 31 insertions(+), 4 deletions(-) + create mode 100644 llvm/test/CodeGen/SystemZ/pr124001.ll + +diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp +index 4040ab6d4510..1fb31c26e20d 100644 +--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp ++++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp +@@ -4708,15 +4708,19 @@ SDValue SystemZTargetLowering::lowerXALUO(SDValue Op, + } + + static bool isAddCarryChain(SDValue Carry) { +- while (Carry.getOpcode() == ISD::UADDO_CARRY) ++ while (Carry.getOpcode() == ISD::UADDO_CARRY && ++ Carry->getValueType(0) != MVT::i128) + Carry = Carry.getOperand(2); +- return Carry.getOpcode() == ISD::UADDO; ++ return Carry.getOpcode() == ISD::UADDO && ++ Carry->getValueType(0) != MVT::i128; + } + + static bool isSubBorrowChain(SDValue Carry) { +- while (Carry.getOpcode() == ISD::USUBO_CARRY) ++ while (Carry.getOpcode() == ISD::USUBO_CARRY && ++ Carry->getValueType(0) != MVT::i128) + Carry = Carry.getOperand(2); +- return Carry.getOpcode() == ISD::USUBO; ++ return Carry.getOpcode() == ISD::USUBO && ++ Carry->getValueType(0) != MVT::i128; + } + + // Lower UADDO_CARRY/USUBO_CARRY nodes. +diff --git a/llvm/test/CodeGen/SystemZ/pr124001.ll b/llvm/test/CodeGen/SystemZ/pr124001.ll +new file mode 100644 +index 000000000000..9cf630a55dd6 +--- /dev/null ++++ b/llvm/test/CodeGen/SystemZ/pr124001.ll +@@ -0,0 +1,23 @@ ++; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 ++; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s ++ ++define i64 @test(i128 %in) { ++; CHECK-LABEL: test: ++; CHECK: # %bb.0: ++; CHECK-NEXT: larl %r1, .LCPI0_0 ++; CHECK-NEXT: vl %v0, 0(%r2), 3 ++; CHECK-NEXT: vl %v1, 0(%r1), 3 ++; CHECK-NEXT: vaccq %v0, %v0, %v1 ++; CHECK-NEXT: vlgvg %r1, %v0, 1 ++; CHECK-NEXT: la %r2, 1(%r1) ++; CHECK-NEXT: br %r14 ++ %1 = tail call { i128, i1 } @llvm.uadd.with.overflow.i128(i128 %in, i128 1) ++ %2 = extractvalue { i128, i1 } %1, 1 ++ %3 = zext i1 %2 to i64 ++ %4 = add i64 %3, 1 ++ ret i64 %4 ++} ++ ++declare { i128, i1 } @llvm.uadd.with.overflow.i128(i128, i128) #0 ++ ++attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } +-- +2.48.1 + diff --git a/0001-cmake-Resolve-symlink-when-finding-install-prefix.patch b/0001-cmake-Resolve-symlink-when-finding-install-prefix.patch new file mode 100644 index 0000000..2b62da0 --- /dev/null +++ b/0001-cmake-Resolve-symlink-when-finding-install-prefix.patch @@ -0,0 +1,39 @@ +From 06774eb8a7dc0bc36b59e53310c7f5b5d89f6c29 Mon Sep 17 00:00:00 2001 +From: Nikita Popov +Date: Tue, 28 Jan 2025 12:31:49 +0100 +Subject: [PATCH] [cmake] Resolve symlink when finding install prefix + +When determining the install prefix in LLVMConfig.cmake etc resolve +symlinks in CMAKE_CURRENT_LIST_FILE first. The motivation for this +is to support symlinks like `/usr/lib64/cmake/llvm` to +`/usr/lib64/llvm19/lib/cmake/llvm`. This only works correctly if +the paths are relative to the resolved symlink. + +It's worth noting that this *mostly* already works out of the box, +because cmake automatically does the symlink resolution when the +library is found via CMAKE_PREFIX_PATH. It just doesn't happen +when it's found via the default prefix path. +--- + cmake/Modules/FindPrefixFromConfig.cmake | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/cmake/Modules/FindPrefixFromConfig.cmake b/cmake/Modules/FindPrefixFromConfig.cmake +index 22211e4b72f2..3daff607ff84 100644 +--- a/cmake/Modules/FindPrefixFromConfig.cmake ++++ b/cmake/Modules/FindPrefixFromConfig.cmake +@@ -39,10 +39,10 @@ function(find_prefix_from_config out_var prefix_var path_to_leave) + # install prefix, and avoid hard-coding any absolute paths. + set(config_code + "# Compute the installation prefix from this LLVMConfig.cmake file location." +- "get_filename_component(${prefix_var} \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)") ++ "get_filename_component(${prefix_var} \"\${CMAKE_CURRENT_LIST_FILE}\" REALPATH)") + # Construct the proper number of get_filename_component(... PATH) + # calls to compute the installation prefix. +- string(REGEX REPLACE "/" ";" _count "${path_to_leave}") ++ string(REGEX REPLACE "/" ";" _count "${path_to_leave}/plus_one") + foreach(p ${_count}) + list(APPEND config_code + "get_filename_component(${prefix_var} \"\${${prefix_var}}\" PATH)") +-- +2.48.1 + diff --git a/0001-openmp-Add-option-to-disable-tsan-tests-111548.patch b/0001-openmp-Add-option-to-disable-tsan-tests-111548.patch deleted file mode 100644 index 0e30347..0000000 --- a/0001-openmp-Add-option-to-disable-tsan-tests-111548.patch +++ /dev/null @@ -1,62 +0,0 @@ -From b2edeb58b8cb3268acee425cd52b406eb60a8095 Mon Sep 17 00:00:00 2001 -From: Nikita Popov -Date: Wed, 9 Oct 2024 11:29:30 +0200 -Subject: [PATCH] [openmp] Add option to disable tsan tests (#111548) - -This adds a OPENMP_TEST_ENABLE_TSAN option that allows to override -whether tests using tsan will be enabled. The option defaults to the -existing auto-detection. - -The background here is -https://github.com/llvm/llvm-project/issues/111492, where we have some -systems where tsan doesn't work, but we do still want to build it and -run tests that don't use tsan. ---- - openmp/cmake/OpenMPTesting.cmake | 3 +++ - openmp/tools/archer/tests/CMakeLists.txt | 2 +- - openmp/tools/archer/tests/lit.site.cfg.in | 2 +- - 3 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/openmp/cmake/OpenMPTesting.cmake b/openmp/cmake/OpenMPTesting.cmake -index c67ad8b1cbd9..14cc5c67d84c 100644 ---- a/openmp/cmake/OpenMPTesting.cmake -+++ b/openmp/cmake/OpenMPTesting.cmake -@@ -163,6 +163,9 @@ else() - set(OPENMP_TEST_COMPILER_HAS_OMIT_FRAME_POINTER_FLAGS 1) - endif() - -+set(OPENMP_TEST_ENABLE_TSAN "${OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS}" CACHE BOOL -+ "Whether to enable tests using tsan") -+ - # Function to set compiler features for use in lit. - function(update_test_compiler_features) - set(FEATURES "[") -diff --git a/openmp/tools/archer/tests/CMakeLists.txt b/openmp/tools/archer/tests/CMakeLists.txt -index 5de91148fa4b..412c7d63725e 100644 ---- a/openmp/tools/archer/tests/CMakeLists.txt -+++ b/openmp/tools/archer/tests/CMakeLists.txt -@@ -28,7 +28,7 @@ macro(pythonize_bool var) - endmacro() - - pythonize_bool(LIBARCHER_HAVE_LIBATOMIC) --pythonize_bool(OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS) -+pythonize_bool(OPENMP_TEST_ENABLE_TSAN) - - set(ARCHER_TSAN_TEST_DEPENDENCE "") - if(TARGET tsan) -diff --git a/openmp/tools/archer/tests/lit.site.cfg.in b/openmp/tools/archer/tests/lit.site.cfg.in -index 55edfde9738e..ddcb7b8bc3a5 100644 ---- a/openmp/tools/archer/tests/lit.site.cfg.in -+++ b/openmp/tools/archer/tests/lit.site.cfg.in -@@ -12,7 +12,7 @@ config.omp_library_dir = "@LIBOMP_LIBRARY_DIR@" - config.omp_header_dir = "@LIBOMP_INCLUDE_DIR@" - config.operating_system = "@CMAKE_SYSTEM_NAME@" - config.has_libatomic = @LIBARCHER_HAVE_LIBATOMIC@ --config.has_tsan = @OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS@ -+config.has_tsan = @OPENMP_TEST_ENABLE_TSAN@ - - config.test_archer_flags = "@LIBARCHER_TEST_FLAGS@" - config.libarcher_obj_root = "@CMAKE_CURRENT_BINARY_DIR@" --- -2.46.0 - diff --git a/0001-openmp-Support-CET-in-z_Linux_asm.S-123213.patch b/0001-openmp-Support-CET-in-z_Linux_asm.S-123213.patch deleted file mode 100644 index 3fd4cd1..0000000 --- a/0001-openmp-Support-CET-in-z_Linux_asm.S-123213.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 90a05f32166c4a45224a5eedbec9c5c7e21d2dbf Mon Sep 17 00:00:00 2001 -From: Nikita Popov -Date: Fri, 17 Jan 2025 09:26:49 +0100 -Subject: [PATCH] [openmp] Support CET in z_Linux_asm.S (#123213) - -When libomp is built with -cf-protection, add endbr instructions to the -start of functions for Intel CET support. ---- - openmp/runtime/src/z_Linux_asm.S | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/openmp/runtime/src/z_Linux_asm.S b/openmp/runtime/src/z_Linux_asm.S -index cc5344cdd124..0bf9f07a13f1 100644 ---- a/openmp/runtime/src/z_Linux_asm.S -+++ b/openmp/runtime/src/z_Linux_asm.S -@@ -19,6 +19,16 @@ - - #if KMP_ARCH_X86 || KMP_ARCH_X86_64 - -+# if defined(__ELF__) && defined(__CET__) && defined(__has_include) -+# if __has_include() -+# include -+# endif -+# endif -+ -+# if !defined(_CET_ENDBR) -+# define _CET_ENDBR -+# endif -+ - # if KMP_MIC - // the 'delay r16/r32/r64' should be used instead of the 'pause'. - // The delay operation has the effect of removing the current thread from -@@ -66,6 +76,7 @@ - ALIGN 4 - .globl KMP_PREFIX_UNDERSCORE($0) - KMP_PREFIX_UNDERSCORE($0): -+ _CET_ENDBR - .endmacro - # else // KMP_OS_DARWIN - # define KMP_PREFIX_UNDERSCORE(x) x //no extra underscore for Linux* OS symbols -@@ -92,6 +103,7 @@ KMP_PREFIX_UNDERSCORE($0): - .globl KMP_PREFIX_UNDERSCORE(\proc) - KMP_PREFIX_UNDERSCORE(\proc): - .cfi_startproc -+ _CET_ENDBR - .endm - .macro KMP_CFI_DEF_OFFSET sz - .cfi_def_cfa_offset \sz --- -2.47.1 - diff --git a/0001-openmp-Use-core_siblings_list-if-physical_package_id.patch b/0001-openmp-Use-core_siblings_list-if-physical_package_id.patch deleted file mode 100644 index bacb81f..0000000 --- a/0001-openmp-Use-core_siblings_list-if-physical_package_id.patch +++ /dev/null @@ -1,205 +0,0 @@ -From 5fb4d7f6079a76b2907ccc8c53c7c509c30a3dca Mon Sep 17 00:00:00 2001 -From: Nikita Popov -Date: Thu, 10 Oct 2024 12:47:33 +0000 -Subject: [PATCH] [openmp] Use core_siblings_list if physical_package_id not - available - -On powerpc, physical_package_id may not be available. Currently, -this causes openmp to fall back to flat topology and various -affinity tests fail. - -Fix this by parsing core_siblings_list to deterimine which cpus -belong to the same socket. This matches what the testing code -does. The code to parse the CPU list format thankfully already -exists. - -Fixes https://github.com/llvm/llvm-project/issues/111809. ---- - openmp/runtime/src/kmp_affinity.cpp | 100 +++++++++++++------ - openmp/runtime/test/affinity/kmp-hw-subset.c | 2 +- - 2 files changed, 72 insertions(+), 30 deletions(-) - -diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp -index cf5cad04eb57..c3d5ecf1345e 100644 ---- a/openmp/runtime/src/kmp_affinity.cpp -+++ b/openmp/runtime/src/kmp_affinity.cpp -@@ -1589,15 +1589,13 @@ kmp_str_buf_t *__kmp_affinity_str_buf_mask(kmp_str_buf_t *buf, - return buf; - } - --// Return (possibly empty) affinity mask representing the offline CPUs --// Caller must free the mask --kmp_affin_mask_t *__kmp_affinity_get_offline_cpus() { -- kmp_affin_mask_t *offline; -- KMP_CPU_ALLOC(offline); -- KMP_CPU_ZERO(offline); -+static kmp_affin_mask_t *__kmp_parse_cpu_list(const char *path) { -+ kmp_affin_mask_t *mask; -+ KMP_CPU_ALLOC(mask); -+ KMP_CPU_ZERO(mask); - #if KMP_OS_LINUX - int n, begin_cpu, end_cpu; -- kmp_safe_raii_file_t offline_file; -+ kmp_safe_raii_file_t file; - auto skip_ws = [](FILE *f) { - int c; - do { -@@ -1606,29 +1604,29 @@ kmp_affin_mask_t *__kmp_affinity_get_offline_cpus() { - if (c != EOF) - ungetc(c, f); - }; -- // File contains CSV of integer ranges representing the offline CPUs -+ // File contains CSV of integer ranges representing the CPUs - // e.g., 1,2,4-7,9,11-15 -- int status = offline_file.try_open("/sys/devices/system/cpu/offline", "r"); -+ int status = file.try_open(path, "r"); - if (status != 0) -- return offline; -- while (!feof(offline_file)) { -- skip_ws(offline_file); -- n = fscanf(offline_file, "%d", &begin_cpu); -+ return mask; -+ while (!feof(file)) { -+ skip_ws(file); -+ n = fscanf(file, "%d", &begin_cpu); - if (n != 1) - break; -- skip_ws(offline_file); -- int c = fgetc(offline_file); -+ skip_ws(file); -+ int c = fgetc(file); - if (c == EOF || c == ',') { - // Just single CPU - end_cpu = begin_cpu; - } else if (c == '-') { - // Range of CPUs -- skip_ws(offline_file); -- n = fscanf(offline_file, "%d", &end_cpu); -+ skip_ws(file); -+ n = fscanf(file, "%d", &end_cpu); - if (n != 1) - break; -- skip_ws(offline_file); -- c = fgetc(offline_file); // skip ',' -+ skip_ws(file); -+ c = fgetc(file); // skip ',' - } else { - // Syntax problem - break; -@@ -1638,13 +1636,19 @@ kmp_affin_mask_t *__kmp_affinity_get_offline_cpus() { - end_cpu >= __kmp_xproc || begin_cpu > end_cpu) { - continue; - } -- // Insert [begin_cpu, end_cpu] into offline mask -+ // Insert [begin_cpu, end_cpu] into mask - for (int cpu = begin_cpu; cpu <= end_cpu; ++cpu) { -- KMP_CPU_SET(cpu, offline); -+ KMP_CPU_SET(cpu, mask); - } - } - #endif -- return offline; -+ return mask; -+} -+ -+// Return (possibly empty) affinity mask representing the offline CPUs -+// Caller must free the mask -+kmp_affin_mask_t *__kmp_affinity_get_offline_cpus() { -+ return __kmp_parse_cpu_list("/sys/devices/system/cpu/offline"); - } - - // Return the number of available procs -@@ -3175,6 +3179,37 @@ static inline const char *__kmp_cpuinfo_get_envvar() { - return envvar; - } - -+static bool __kmp_package_id_from_core_siblings_list(unsigned **threadInfo, -+ unsigned num_avail, -+ unsigned idx) { -+ if (!KMP_AFFINITY_CAPABLE()) -+ return false; -+ -+ char path[256]; -+ KMP_SNPRINTF(path, sizeof(path), -+ "/sys/devices/system/cpu/cpu%u/topology/core_siblings_list", -+ threadInfo[idx][osIdIndex]); -+ kmp_affin_mask_t *siblings = __kmp_parse_cpu_list(path); -+ for (unsigned i = 0; i < num_avail; ++i) { -+ unsigned cpu_id = threadInfo[i][osIdIndex]; -+ KMP_ASSERT(cpu_id < __kmp_affin_mask_size * CHAR_BIT); -+ if (!KMP_CPU_ISSET(cpu_id, siblings)) -+ continue; -+ if (threadInfo[i][pkgIdIndex] == UINT_MAX) { -+ // Arbitrarily pick the first index we encounter, it only matters that -+ // the value is the same for all siblings. -+ threadInfo[i][pkgIdIndex] = idx; -+ } else if (threadInfo[i][pkgIdIndex] != idx) { -+ // Contradictory sibling lists. -+ KMP_CPU_FREE(siblings); -+ return false; -+ } -+ } -+ KMP_ASSERT(threadInfo[idx][pkgIdIndex] != UINT_MAX); -+ KMP_CPU_FREE(siblings); -+ return true; -+} -+ - // Parse /proc/cpuinfo (or an alternate file in the same format) to obtain the - // affinity map. On AIX, the map is obtained through system SRAD (Scheduler - // Resource Allocation Domain). -@@ -3550,18 +3585,13 @@ static bool __kmp_affinity_create_cpuinfo_map(int *line, - return false; - } - -- // Check for missing fields. The osId field must be there, and we -- // currently require that the physical id field is specified, also. -+ // Check for missing fields. The osId field must be there. The physical -+ // id field will be checked later. - if (threadInfo[num_avail][osIdIndex] == UINT_MAX) { - CLEANUP_THREAD_INFO; - *msg_id = kmp_i18n_str_MissingProcField; - return false; - } -- if (threadInfo[0][pkgIdIndex] == UINT_MAX) { -- CLEANUP_THREAD_INFO; -- *msg_id = kmp_i18n_str_MissingPhysicalIDField; -- return false; -- } - - // Skip this proc if it is not included in the machine model. - if (KMP_AFFINITY_CAPABLE() && -@@ -3591,6 +3621,18 @@ static bool __kmp_affinity_create_cpuinfo_map(int *line, - } - *line = 0; - -+ // At least on powerpc, Linux may return -1 for physical_package_id. Try -+ // to reconstruct topology from core_siblings_list in that case. -+ for (i = 0; i < num_avail; ++i) { -+ if (threadInfo[i][pkgIdIndex] == UINT_MAX) { -+ if (!__kmp_package_id_from_core_siblings_list(threadInfo, num_avail, i)) { -+ CLEANUP_THREAD_INFO; -+ *msg_id = kmp_i18n_str_MissingPhysicalIDField; -+ return false; -+ } -+ } -+ } -+ - #if KMP_MIC && REDUCE_TEAM_SIZE - unsigned teamSize = 0; - #endif // KMP_MIC && REDUCE_TEAM_SIZE -diff --git a/openmp/runtime/test/affinity/kmp-hw-subset.c b/openmp/runtime/test/affinity/kmp-hw-subset.c -index 606fcdfbada9..0b49969bd3b1 100644 ---- a/openmp/runtime/test/affinity/kmp-hw-subset.c -+++ b/openmp/runtime/test/affinity/kmp-hw-subset.c -@@ -25,7 +25,7 @@ static int compare_hw_subset_places(const place_list_t *openmp_places, - expected_per_place = nthreads_per_core; - } else { - expected_total = nsockets; -- expected_per_place = ncores_per_socket; -+ expected_per_place = ncores_per_socket * nthreads_per_core; - } - if (openmp_places->num_places != expected_total) { - fprintf(stderr, "error: KMP_HW_SUBSET did not half each resource layer!\n"); --- -2.47.0 - diff --git a/0001-profile-Use-base-vaddr-for-__llvm_write_binary_ids-n.patch b/0001-profile-Use-base-vaddr-for-__llvm_write_binary_ids-n.patch deleted file mode 100644 index 7f0a7cf..0000000 --- a/0001-profile-Use-base-vaddr-for-__llvm_write_binary_ids-n.patch +++ /dev/null @@ -1,86 +0,0 @@ -From ccc2b792e57d632bc887b226a4e7f0a8189eab8b Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Mon, 4 Nov 2024 16:37:49 -0800 -Subject: [PATCH] [profile] Use base+vaddr for `__llvm_write_binary_ids` note - pointers - -This function is always examining its own ELF headers in memory, but it -was trying to use conditions between examining files or memory, and it -wasn't accounting for LOAD offsets at runtime. This is especially bad if -a loaded segment has additional padding that's not in the file offsets. - -Now we do a first scan of the program headers to figure out the runtime -base address based on `PT_PHDR` and/or `PT_DYNAMIC` (else assume zero), -similar to libc's `do_start`. Then each `PT_NOTE` pointer is simply the -base plus the segments's `pt_vaddr`, which includes LOAD offsets. - -Fixes #114605 ---- - .../lib/profile/InstrProfilingPlatformLinux.c | 40 ++++++++----------- - 1 file changed, 16 insertions(+), 24 deletions(-) - -diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c -index e2c06d51e0c6..c365129a0768 100644 ---- a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c -+++ b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c -@@ -194,41 +194,33 @@ static int WriteBinaryIds(ProfDataWriter *Writer, const ElfW(Nhdr) * Note, - */ - COMPILER_RT_VISIBILITY int __llvm_write_binary_ids(ProfDataWriter *Writer) { - extern const ElfW(Ehdr) __ehdr_start __attribute__((visibility("hidden"))); -+ extern ElfW(Dyn) _DYNAMIC[] __attribute__((weak, visibility("hidden"))); -+ - const ElfW(Ehdr) *ElfHeader = &__ehdr_start; - const ElfW(Phdr) *ProgramHeader = - (const ElfW(Phdr) *)((uintptr_t)ElfHeader + ElfHeader->e_phoff); - -+ /* Compute the added base address in case of position-independent code. */ -+ uintptr_t Base = 0; -+ for (uint32_t I = 0; I < ElfHeader->e_phnum; I++) { -+ if (ProgramHeader[I].p_type == PT_PHDR) -+ Base = (uintptr_t)ProgramHeader - ProgramHeader[I].p_vaddr; -+ if (ProgramHeader[I].p_type == PT_DYNAMIC && _DYNAMIC) -+ Base = (uintptr_t)_DYNAMIC - ProgramHeader[I].p_vaddr; -+ } -+ - int TotalBinaryIdsSize = 0; -- uint32_t I; - /* Iterate through entries in the program header. */ -- for (I = 0; I < ElfHeader->e_phnum; I++) { -+ for (uint32_t I = 0; I < ElfHeader->e_phnum; I++) { - /* Look for the notes segment in program header entries. */ - if (ProgramHeader[I].p_type != PT_NOTE) - continue; - - /* There can be multiple notes segment, and examine each of them. */ -- const ElfW(Nhdr) * Note; -- const ElfW(Nhdr) * NotesEnd; -- /* -- * When examining notes in file, use p_offset, which is the offset within -- * the elf file, to find the start of notes. -- */ -- if (ProgramHeader[I].p_memsz == 0 || -- ProgramHeader[I].p_memsz == ProgramHeader[I].p_filesz) { -- Note = (const ElfW(Nhdr) *)((uintptr_t)ElfHeader + -- ProgramHeader[I].p_offset); -- NotesEnd = (const ElfW(Nhdr) *)((const char *)(Note) + -- ProgramHeader[I].p_filesz); -- } else { -- /* -- * When examining notes in memory, use p_vaddr, which is the address of -- * section after loaded to memory, to find the start of notes. -- */ -- Note = -- (const ElfW(Nhdr) *)((uintptr_t)ElfHeader + ProgramHeader[I].p_vaddr); -- NotesEnd = -- (const ElfW(Nhdr) *)((const char *)(Note) + ProgramHeader[I].p_memsz); -- } -+ const ElfW(Nhdr) *Note = -+ (const ElfW(Nhdr) *)(Base + ProgramHeader[I].p_vaddr); -+ const ElfW(Nhdr) *NotesEnd = -+ (const ElfW(Nhdr) *)((const char *)(Note) + ProgramHeader[I].p_memsz); - - int BinaryIdsSize = WriteBinaryIds(Writer, Note, NotesEnd); - if (TotalBinaryIdsSize == -1) --- -2.47.0 - diff --git a/131801.patch b/131801.patch new file mode 100644 index 0000000..853fba8 --- /dev/null +++ b/131801.patch @@ -0,0 +1,46 @@ +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/18-99273.patch b/18-99273.patch deleted file mode 100644 index bacb46b..0000000 --- a/18-99273.patch +++ /dev/null @@ -1,893 +0,0 @@ -From 91052169960477fbc39169c10f9fae3bec732510 Mon Sep 17 00:00:00 2001 -From: Carl Ritson -Date: Wed, 17 Jul 2024 15:07:42 +0900 -Subject: [PATCH 1/3] [AMDGPU] Implement workaround for GFX11.5 export priority - -On GFX11.5 shaders having completed exports need to execute/wait -at a lower priority than shaders still executing exports. -Add code to maintain normal priority of 2 for shaders that export -and drop to priority 0 after exports. ---- - llvm/lib/Target/AMDGPU/AMDGPU.td | 15 +- - .../lib/Target/AMDGPU/GCNHazardRecognizer.cpp | 112 ++++++ - llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h | 1 + - llvm/lib/Target/AMDGPU/GCNSubtarget.h | 3 + - .../AMDGPU/required-export-priority.ll | 344 ++++++++++++++++++ - .../AMDGPU/required-export-priority.mir | 293 +++++++++++++++ - 6 files changed, 765 insertions(+), 3 deletions(-) - create mode 100644 llvm/test/CodeGen/AMDGPU/required-export-priority.ll - create mode 100644 llvm/test/CodeGen/AMDGPU/required-export-priority.mir - -diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td -index dfc8eaea66f7b..14fcf6a210a78 100644 ---- a/llvm/lib/Target/AMDGPU/AMDGPU.td -+++ b/llvm/lib/Target/AMDGPU/AMDGPU.td -@@ -947,6 +947,12 @@ def FeatureHasRestrictedSOffset : SubtargetFeature<"restricted-soffset", - "Has restricted SOffset (immediate not supported)." - >; - -+def FeatureRequiredExportPriority : SubtargetFeature<"required-export-priority", -+ "HasRequiredExportPriority", -+ "true", -+ "Export priority must be explicitly manipulated on GFX11.5" -+>; -+ - //===------------------------------------------------------------===// - // Subtarget Features (options and debugging) - //===------------------------------------------------------------===// -@@ -1597,14 +1603,16 @@ def FeatureISAVersion11_5_0 : FeatureSet< - !listconcat(FeatureISAVersion11_Common.Features, - [FeatureSALUFloatInsts, - FeatureDPPSrc1SGPR, -- FeatureVGPRSingleUseHintInsts])>; -+ FeatureVGPRSingleUseHintInsts, -+ FeatureRequiredExportPriority])>; - - def FeatureISAVersion11_5_1 : FeatureSet< - !listconcat(FeatureISAVersion11_Common.Features, - [FeatureSALUFloatInsts, - FeatureDPPSrc1SGPR, - FeatureVGPRSingleUseHintInsts, -- FeatureGFX11FullVGPRs])>; -+ FeatureGFX11FullVGPRs, -+ FeatureRequiredExportPriority])>; - - def FeatureISAVersion12 : FeatureSet< - [FeatureGFX12, -diff --git a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp -index a402fc6d7e611..a8b171aa82840 100644 ---- a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp -+++ b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp -@@ -14,6 +14,7 @@ - #include "GCNSubtarget.h" - #include "MCTargetDesc/AMDGPUMCTargetDesc.h" - #include "SIMachineFunctionInfo.h" -+#include "llvm/CodeGen/MachineFrameInfo.h" - #include "llvm/CodeGen/MachineFunction.h" - #include "llvm/CodeGen/ScheduleDAG.h" - #include "llvm/TargetParser/TargetParser.h" -@@ -1104,6 +1105,7 @@ void GCNHazardRecognizer::fixHazards(MachineInstr *MI) { - fixWMMAHazards(MI); - fixShift64HighRegBug(MI); - fixVALUMaskWriteHazard(MI); -+ fixRequiredExportPriority(MI); - } - - bool GCNHazardRecognizer::fixVcmpxPermlaneHazards(MachineInstr *MI) { -@@ -2895,3 +2897,113 @@ bool GCNHazardRecognizer::fixVALUMaskWriteHazard(MachineInstr *MI) { - - return true; - } -+ -+static bool ensureEntrySetPrio(MachineFunction *MF, int Priority, -+ const SIInstrInfo &TII) { -+ MachineBasicBlock &EntryMBB = MF->front(); -+ if (EntryMBB.begin() != EntryMBB.end()) { -+ auto &EntryMI = *EntryMBB.begin(); -+ if (EntryMI.getOpcode() == AMDGPU::S_SETPRIO && -+ EntryMI.getOperand(0).getImm() >= Priority) -+ return false; -+ } -+ -+ BuildMI(EntryMBB, EntryMBB.begin(), DebugLoc(), TII.get(AMDGPU::S_SETPRIO)) -+ .addImm(Priority); -+ return true; -+} -+ -+bool GCNHazardRecognizer::fixRequiredExportPriority(MachineInstr *MI) { -+ if (!ST.hasRequiredExportPriority()) -+ return false; -+ -+ // Assume the following shader types will never have exports, -+ // and avoid adding or adjusting S_SETPRIO. -+ MachineBasicBlock *MBB = MI->getParent(); -+ MachineFunction *MF = MBB->getParent(); -+ auto CC = MF->getFunction().getCallingConv(); -+ switch (CC) { -+ case CallingConv::AMDGPU_CS: -+ case CallingConv::AMDGPU_CS_Chain: -+ case CallingConv::AMDGPU_CS_ChainPreserve: -+ case CallingConv::AMDGPU_KERNEL: -+ return false; -+ default: -+ break; -+ } -+ -+ const int MaxPriority = 3; -+ const int NormalPriority = 2; -+ const int PostExportPriority = 0; -+ -+ auto It = MI->getIterator(); -+ switch (MI->getOpcode()) { -+ case AMDGPU::S_ENDPGM: -+ case AMDGPU::S_ENDPGM_SAVED: -+ case AMDGPU::S_ENDPGM_ORDERED_PS_DONE: -+ case AMDGPU::SI_RETURN_TO_EPILOG: -+ // Ensure shader with calls raises priority at entry. -+ // This ensures correct priority if exports exist in callee. -+ if (MF->getFrameInfo().hasCalls()) -+ return ensureEntrySetPrio(MF, NormalPriority, TII); -+ return false; -+ case AMDGPU::S_SETPRIO: { -+ // Raise minimum priority unless in workaround. -+ auto &PrioOp = MI->getOperand(0); -+ int Prio = PrioOp.getImm(); -+ bool InWA = (Prio == PostExportPriority) && -+ (It != MBB->begin() && TII.isEXP(*std::prev(It))); -+ if (InWA || Prio >= NormalPriority) -+ return false; -+ PrioOp.setImm(std::min(Prio + NormalPriority, MaxPriority)); -+ return true; -+ } -+ default: -+ if (!TII.isEXP(*MI)) -+ return false; -+ break; -+ } -+ -+ // Check entry priority at each export (as there will only be a few). -+ // Note: amdgpu_gfx can only be a callee, so defer to caller setprio. -+ bool Changed = false; -+ if (CC != CallingConv::AMDGPU_Gfx) -+ Changed = ensureEntrySetPrio(MF, NormalPriority, TII); -+ -+ auto NextMI = std::next(It); -+ bool EndOfShader = false; -+ if (NextMI != MBB->end()) { -+ // Only need WA at end of sequence of exports. -+ if (TII.isEXP(*NextMI)) -+ return Changed; -+ // Assume appropriate S_SETPRIO after export means WA already applied. -+ if (NextMI->getOpcode() == AMDGPU::S_SETPRIO && -+ NextMI->getOperand(0).getImm() == PostExportPriority) -+ return Changed; -+ EndOfShader = NextMI->getOpcode() == AMDGPU::S_ENDPGM; -+ } -+ -+ const DebugLoc &DL = MI->getDebugLoc(); -+ -+ // Lower priority. -+ BuildMI(*MBB, NextMI, DL, TII.get(AMDGPU::S_SETPRIO)) -+ .addImm(PostExportPriority); -+ -+ if (!EndOfShader) { -+ // Wait for exports to complete. -+ BuildMI(*MBB, NextMI, DL, TII.get(AMDGPU::S_WAITCNT_EXPCNT)) -+ .addReg(AMDGPU::SGPR_NULL) -+ .addImm(0); -+ } -+ -+ BuildMI(*MBB, NextMI, DL, TII.get(AMDGPU::S_NOP)).addImm(0); -+ BuildMI(*MBB, NextMI, DL, TII.get(AMDGPU::S_NOP)).addImm(0); -+ -+ if (!EndOfShader) { -+ // Return to normal (higher) priority. -+ BuildMI(*MBB, NextMI, DL, TII.get(AMDGPU::S_SETPRIO)) -+ .addImm(NormalPriority); -+ } -+ -+ return true; -+} -diff --git a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h -index 3ccca527c626b..f2a64ab48e180 100644 ---- a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h -+++ b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h -@@ -107,6 +107,7 @@ class GCNHazardRecognizer final : public ScheduleHazardRecognizer { - bool fixWMMAHazards(MachineInstr *MI); - bool fixShift64HighRegBug(MachineInstr *MI); - bool fixVALUMaskWriteHazard(MachineInstr *MI); -+ bool fixRequiredExportPriority(MachineInstr *MI); - - int checkMAIHazards(MachineInstr *MI); - int checkMAIHazards908(MachineInstr *MI); -diff --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.h b/llvm/lib/Target/AMDGPU/GCNSubtarget.h -index e5817594a4521..def89c785b855 100644 ---- a/llvm/lib/Target/AMDGPU/GCNSubtarget.h -+++ b/llvm/lib/Target/AMDGPU/GCNSubtarget.h -@@ -238,6 +238,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo, - bool HasVOPDInsts = false; - bool HasVALUTransUseHazard = false; - bool HasForceStoreSC0SC1 = false; -+ bool HasRequiredExportPriority = false; - - // Dummy feature to use for assembler in tablegen. - bool FeatureDisable = false; -@@ -1282,6 +1283,8 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo, - - bool hasRestrictedSOffset() const { return HasRestrictedSOffset; } - -+ bool hasRequiredExportPriority() const { return HasRequiredExportPriority; } -+ - /// \returns true if the target uses LOADcnt/SAMPLEcnt/BVHcnt, DScnt/KMcnt - /// and STOREcnt rather than VMcnt, LGKMcnt and VScnt respectively. - bool hasExtendedWaitCounts() const { return getGeneration() >= GFX12; } -diff --git a/llvm/test/CodeGen/AMDGPU/required-export-priority.ll b/llvm/test/CodeGen/AMDGPU/required-export-priority.ll -new file mode 100644 -index 0000000000000..377902f3f0d1a ---- /dev/null -+++ b/llvm/test/CodeGen/AMDGPU/required-export-priority.ll -@@ -0,0 +1,344 @@ -+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 -+; RUN: llc -mtriple=amdgcn -mcpu=gfx1150 -amdgpu-enable-vopd=0 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s -+ -+define amdgpu_ps void @test_export_zeroes_f32() #0 { -+; GCN-LABEL: test_export_zeroes_f32: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: v_mov_b32_e32 v0, 0 -+; GCN-NEXT: exp mrt0 off, off, off, off -+; GCN-NEXT: exp mrt0 off, off, off, off done -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_endpgm -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 0, float 0.0, float 0.0, float 0.0, float 0.0, i1 false, i1 false) -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 0, float 0.0, float 0.0, float 0.0, float 0.0, i1 true, i1 false) -+ ret void -+} -+ -+define amdgpu_ps void @test_export_en_src0_f32() #0 { -+; GCN-LABEL: test_export_en_src0_f32: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: v_mov_b32_e32 v0, 4.0 -+; GCN-NEXT: v_mov_b32_e32 v1, 0.5 -+; GCN-NEXT: v_mov_b32_e32 v2, 2.0 -+; GCN-NEXT: v_mov_b32_e32 v3, 1.0 -+; GCN-NEXT: exp mrt0 v3, off, off, off done -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_endpgm -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 1, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false) -+ ret void -+} -+ -+define amdgpu_gs void @test_export_gs() #0 { -+; GCN-LABEL: test_export_gs: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: v_mov_b32_e32 v0, 4.0 -+; GCN-NEXT: v_mov_b32_e32 v1, 0.5 -+; GCN-NEXT: v_mov_b32_e32 v2, 2.0 -+; GCN-NEXT: v_mov_b32_e32 v3, 1.0 -+; GCN-NEXT: exp mrt0 off, v2, off, off done -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_endpgm -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false) -+ ret void -+} -+ -+define amdgpu_hs void @test_export_hs() #0 { -+; GCN-LABEL: test_export_hs: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: v_mov_b32_e32 v0, 4.0 -+; GCN-NEXT: v_mov_b32_e32 v1, 0.5 -+; GCN-NEXT: v_mov_b32_e32 v2, 2.0 -+; GCN-NEXT: v_mov_b32_e32 v3, 1.0 -+; GCN-NEXT: exp mrt0 off, v2, off, off done -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_endpgm -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false) -+ ret void -+} -+ -+define amdgpu_gfx void @test_export_gfx(float %v) #0 { -+; GCN-LABEL: test_export_gfx: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -+; GCN-NEXT: v_mov_b32_e32 v1, 4.0 -+; GCN-NEXT: v_mov_b32_e32 v2, 0.5 -+; GCN-NEXT: v_mov_b32_e32 v3, 2.0 -+; GCN-NEXT: exp mrt0 off, v3, off, off done -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_waitcnt_expcnt null, 0x0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_waitcnt expcnt(0) -+; GCN-NEXT: s_setpc_b64 s[30:31] -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float %v, float 2.0, float 0.5, float 4.0, i1 true, i1 false) -+ ret void -+} -+ -+define amdgpu_cs void @test_export_cs() #0 { -+; GCN-LABEL: test_export_cs: -+; GCN: ; %bb.0: -+; GCN-NEXT: v_mov_b32_e32 v0, 4.0 -+; GCN-NEXT: v_mov_b32_e32 v1, 0.5 -+; GCN-NEXT: v_mov_b32_e32 v2, 2.0 -+; GCN-NEXT: v_mov_b32_e32 v3, 1.0 -+; GCN-NEXT: exp mrt0 off, v2, off, off done -+; GCN-NEXT: s_endpgm -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false) -+ ret void -+} -+ -+define amdgpu_kernel void @test_export_kernel() #0 { -+; GCN-LABEL: test_export_kernel: -+; GCN: ; %bb.0: -+; GCN-NEXT: v_mov_b32_e32 v0, 4.0 -+; GCN-NEXT: v_mov_b32_e32 v1, 0.5 -+; GCN-NEXT: v_mov_b32_e32 v2, 2.0 -+; GCN-NEXT: v_mov_b32_e32 v3, 1.0 -+; GCN-NEXT: exp mrt0 off, v2, off, off done -+; GCN-NEXT: s_endpgm -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false) -+ ret void -+} -+ -+define amdgpu_gfx void @test_no_export_gfx(float %v) #0 { -+; GCN-LABEL: test_no_export_gfx: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -+; GCN-NEXT: s_setpc_b64 s[30:31] -+ ret void -+} -+ -+define amdgpu_ps void @test_no_export_ps(float %v) #0 { -+; GCN-LABEL: test_no_export_ps: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_endpgm -+ ret void -+} -+ -+define amdgpu_ps void @test_if_export_f32(i32 %flag, float %x, float %y, float %z, float %w) #0 { -+; GCN-LABEL: test_if_export_f32: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_mov_b32 s0, exec_lo -+; GCN-NEXT: v_cmpx_ne_u32_e32 0, v0 -+; GCN-NEXT: s_cbranch_execz .LBB9_2 -+; GCN-NEXT: ; %bb.1: ; %exp -+; GCN-NEXT: exp mrt0 v1, v2, v3, v4 -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_waitcnt_expcnt null, 0x0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: .LBB9_2: ; %end -+; GCN-NEXT: s_endpgm -+ %cc = icmp eq i32 %flag, 0 -+ br i1 %cc, label %end, label %exp -+ -+exp: -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %x, float %y, float %z, float %w, i1 false, i1 false) -+ br label %end -+ -+end: -+ ret void -+} -+ -+define amdgpu_ps void @test_if_export_vm_f32(i32 %flag, float %x, float %y, float %z, float %w) #0 { -+; GCN-LABEL: test_if_export_vm_f32: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_mov_b32 s0, exec_lo -+; GCN-NEXT: v_cmpx_ne_u32_e32 0, v0 -+; GCN-NEXT: s_cbranch_execz .LBB10_2 -+; GCN-NEXT: ; %bb.1: ; %exp -+; GCN-NEXT: exp mrt0 v1, v2, v3, v4 -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_waitcnt_expcnt null, 0x0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: .LBB10_2: ; %end -+; GCN-NEXT: s_endpgm -+ %cc = icmp eq i32 %flag, 0 -+ br i1 %cc, label %end, label %exp -+ -+exp: -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %x, float %y, float %z, float %w, i1 false, i1 true) -+ br label %end -+ -+end: -+ ret void -+} -+ -+define amdgpu_ps void @test_if_export_done_f32(i32 %flag, float %x, float %y, float %z, float %w) #0 { -+; GCN-LABEL: test_if_export_done_f32: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_mov_b32 s0, exec_lo -+; GCN-NEXT: v_cmpx_ne_u32_e32 0, v0 -+; GCN-NEXT: s_cbranch_execz .LBB11_2 -+; GCN-NEXT: ; %bb.1: ; %exp -+; GCN-NEXT: exp mrt0 v1, v2, v3, v4 done -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_waitcnt_expcnt null, 0x0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: .LBB11_2: ; %end -+; GCN-NEXT: s_endpgm -+ %cc = icmp eq i32 %flag, 0 -+ br i1 %cc, label %end, label %exp -+ -+exp: -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %x, float %y, float %z, float %w, i1 true, i1 false) -+ br label %end -+ -+end: -+ ret void -+} -+ -+define amdgpu_ps void @test_if_export_vm_done_f32(i32 %flag, float %x, float %y, float %z, float %w) #0 { -+; GCN-LABEL: test_if_export_vm_done_f32: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_mov_b32 s0, exec_lo -+; GCN-NEXT: v_cmpx_ne_u32_e32 0, v0 -+; GCN-NEXT: s_cbranch_execz .LBB12_2 -+; GCN-NEXT: ; %bb.1: ; %exp -+; GCN-NEXT: exp mrt0 v1, v2, v3, v4 done -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_waitcnt_expcnt null, 0x0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: .LBB12_2: ; %end -+; GCN-NEXT: s_endpgm -+ %cc = icmp eq i32 %flag, 0 -+ br i1 %cc, label %end, label %exp -+ -+exp: -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %x, float %y, float %z, float %w, i1 true, i1 true) -+ br label %end -+ -+end: -+ ret void -+} -+ -+define amdgpu_ps void @test_export_pos_before_param_across_load(i32 %idx) #0 { -+; GCN-LABEL: test_export_pos_before_param_across_load: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: buffer_load_b32 v0, v0, s[0:3], 0 offen -+; GCN-NEXT: v_mov_b32_e32 v1, 0 -+; GCN-NEXT: v_mov_b32_e32 v2, 1.0 -+; GCN-NEXT: v_mov_b32_e32 v3, 0.5 -+; GCN-NEXT: s_waitcnt vmcnt(0) -+; GCN-NEXT: exp pos0 v1, v1, v1, v0 done -+; GCN-NEXT: exp invalid_target_32 v2, v2, v2, v2 -+; GCN-NEXT: exp invalid_target_33 v2, v2, v2, v3 -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_endpgm -+ call void @llvm.amdgcn.exp.f32(i32 32, i32 15, float 1.0, float 1.0, float 1.0, float 1.0, i1 false, i1 false) -+ call void @llvm.amdgcn.exp.f32(i32 33, i32 15, float 1.0, float 1.0, float 1.0, float 0.5, i1 false, i1 false) -+ %load = call float @llvm.amdgcn.raw.ptr.buffer.load.f32(ptr addrspace(8) undef, i32 %idx, i32 0, i32 0) -+ call void @llvm.amdgcn.exp.f32(i32 12, i32 15, float 0.0, float 0.0, float 0.0, float %load, i1 true, i1 false) -+ ret void -+} -+ -+define amdgpu_ps void @test_export_across_store_load(i32 %idx, float %v) #0 { -+; GCN-LABEL: test_export_across_store_load: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: v_mov_b32_e32 v2, 24 -+; GCN-NEXT: v_cmp_eq_u32_e32 vcc_lo, 1, v0 -+; GCN-NEXT: s_delay_alu instid0(VALU_DEP_2) -+; GCN-NEXT: v_cndmask_b32_e64 v0, v2, 8, vcc_lo -+; GCN-NEXT: v_mov_b32_e32 v2, 0 -+; GCN-NEXT: scratch_store_b32 v0, v1, off -+; GCN-NEXT: scratch_load_b32 v0, off, off -+; GCN-NEXT: v_mov_b32_e32 v1, 1.0 -+; GCN-NEXT: exp pos0 v2, v2, v2, v1 done -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_waitcnt_expcnt null, 0x0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_waitcnt vmcnt(0) -+; GCN-NEXT: exp invalid_target_32 v0, v2, v1, v2 -+; GCN-NEXT: exp invalid_target_33 v0, v2, v1, v2 -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_endpgm -+ %data0 = alloca <4 x float>, align 8, addrspace(5) -+ %data1 = alloca <4 x float>, align 8, addrspace(5) -+ %cmp = icmp eq i32 %idx, 1 -+ %data = select i1 %cmp, ptr addrspace(5) %data0, ptr addrspace(5) %data1 -+ store float %v, ptr addrspace(5) %data, align 8 -+ call void @llvm.amdgcn.exp.f32(i32 12, i32 15, float 0.0, float 0.0, float 0.0, float 1.0, i1 true, i1 false) -+ %load0 = load float, ptr addrspace(5) %data0, align 8 -+ call void @llvm.amdgcn.exp.f32(i32 32, i32 15, float %load0, float 0.0, float 1.0, float 0.0, i1 false, i1 false) -+ call void @llvm.amdgcn.exp.f32(i32 33, i32 15, float %load0, float 0.0, float 1.0, float 0.0, i1 false, i1 false) -+ ret void -+} -+ -+define amdgpu_ps void @test_export_in_callee(float %v) #0 { -+; GCN-LABEL: test_export_in_callee: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_getpc_b64 s[0:1] -+; GCN-NEXT: s_add_u32 s0, s0, test_export_gfx@gotpcrel32@lo+4 -+; GCN-NEXT: s_addc_u32 s1, s1, test_export_gfx@gotpcrel32@hi+12 -+; GCN-NEXT: v_add_f32_e32 v0, 1.0, v0 -+; GCN-NEXT: s_load_b64 s[0:1], s[0:1], 0x0 -+; GCN-NEXT: s_mov_b32 s32, 0 -+; GCN-NEXT: s_waitcnt lgkmcnt(0) -+; GCN-NEXT: s_swappc_b64 s[30:31], s[0:1] -+; GCN-NEXT: s_endpgm -+ %x = fadd float %v, 1.0 -+ call void @test_export_gfx(float %x) -+ ret void -+} -+ -+define amdgpu_ps void @test_export_in_callee_prio(float %v) #0 { -+; GCN-LABEL: test_export_in_callee_prio: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_mov_b32 s32, 0 -+; GCN-NEXT: v_add_f32_e32 v0, 1.0, v0 -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_getpc_b64 s[0:1] -+; GCN-NEXT: s_add_u32 s0, s0, test_export_gfx@gotpcrel32@lo+4 -+; GCN-NEXT: s_addc_u32 s1, s1, test_export_gfx@gotpcrel32@hi+12 -+; GCN-NEXT: s_load_b64 s[0:1], s[0:1], 0x0 -+; GCN-NEXT: s_waitcnt lgkmcnt(0) -+; GCN-NEXT: s_swappc_b64 s[30:31], s[0:1] -+; GCN-NEXT: s_endpgm -+ %x = fadd float %v, 1.0 -+ call void @llvm.amdgcn.s.setprio(i16 0) -+ call void @test_export_gfx(float %x) -+ ret void -+} -+ -+declare void @llvm.amdgcn.exp.f32(i32, i32, float, float, float, float, i1, i1) #1 -+declare void @llvm.amdgcn.exp.i32(i32, i32, i32, i32, i32, i32, i1, i1) #1 -+declare float @llvm.amdgcn.raw.ptr.buffer.load.f32(ptr addrspace(8), i32, i32, i32) #2 -+declare void @llvm.amdgcn.s.setprio(i16) -+ -+attributes #0 = { nounwind } -+attributes #1 = { nounwind inaccessiblememonly } -+attributes #2 = { nounwind readnone } -diff --git a/llvm/test/CodeGen/AMDGPU/required-export-priority.mir b/llvm/test/CodeGen/AMDGPU/required-export-priority.mir -new file mode 100644 -index 0000000000000..eee04468036e5 ---- /dev/null -+++ b/llvm/test/CodeGen/AMDGPU/required-export-priority.mir -@@ -0,0 +1,293 @@ -+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 -+# RUN: llc -mtriple=amdgcn -mcpu=gfx1150 -mattr=-wavefrontsize32,+wavefrontsize64 -run-pass=post-RA-hazard-rec -verify-machineinstrs %s -o - | FileCheck -check-prefixes=GFX1150 %s -+ -+--- | -+ define amdgpu_ps void @end_of_shader() { -+ ret void -+ } -+ define amdgpu_ps void @end_of_shader_return_to_epilogue() { -+ ret void -+ } -+ define amdgpu_ps void @end_of_block() { -+ ret void -+ } -+ define amdgpu_ps void @start_of_block() { -+ ret void -+ } -+ define amdgpu_ps void @block_of_exports() { -+ ret void -+ } -+ define amdgpu_ps void @sparse_exports() { -+ ret void -+ } -+ define amdgpu_ps void @existing_setprio_1() { -+ ret void -+ } -+ define amdgpu_ps void @existing_setprio_2() { -+ ret void -+ } -+... -+ -+--- -+name: end_of_shader -+tracksRegLiveness: true -+liveins: -+ - { reg: '$vgpr0' } -+body: | -+ bb.0: -+ liveins: $vgpr0 -+ ; GFX1150-LABEL: name: end_of_shader -+ ; GFX1150: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_ENDPGM 0 -+ EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ S_ENDPGM 0 -+... -+ -+--- -+name: end_of_shader_return_to_epilogue -+tracksRegLiveness: true -+liveins: -+ - { reg: '$vgpr0' } -+body: | -+ bb.0: -+ liveins: $vgpr0 -+ ; GFX1150-LABEL: name: end_of_shader_return_to_epilogue -+ ; GFX1150: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_WAITCNT_EXPCNT $sgpr_null, 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: SI_RETURN_TO_EPILOG $vgpr0 -+ EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ SI_RETURN_TO_EPILOG $vgpr0 -+... -+ -+--- -+name: end_of_block -+tracksRegLiveness: true -+liveins: -+ - { reg: '$vgpr0' } -+body: | -+ ; GFX1150-LABEL: name: end_of_block -+ ; GFX1150: bb.0: -+ ; GFX1150-NEXT: successors: %bb.1(0x80000000) -+ ; GFX1150-NEXT: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_WAITCNT_EXPCNT $sgpr_null, 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: bb.1: -+ ; GFX1150-NEXT: S_ENDPGM 0 -+ bb.0: -+ liveins: $vgpr0 -+ EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ -+ bb.1: -+ S_ENDPGM 0 -+... -+ -+--- -+name: start_of_block -+tracksRegLiveness: true -+liveins: -+ - { reg: '$vgpr0' } -+body: | -+ ; GFX1150-LABEL: name: start_of_block -+ ; GFX1150: bb.0: -+ ; GFX1150-NEXT: successors: %bb.1(0x80000000) -+ ; GFX1150-NEXT: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: bb.1: -+ ; GFX1150-NEXT: successors: %bb.2(0x80000000) -+ ; GFX1150-NEXT: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_WAITCNT_EXPCNT $sgpr_null, 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: bb.2: -+ ; GFX1150-NEXT: S_ENDPGM 0 -+ bb.0: -+ liveins: $vgpr0 -+ -+ bb.1: -+ liveins: $vgpr0 -+ EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ -+ bb.2: -+ S_ENDPGM 0 -+... -+ -+--- -+name: block_of_exports -+tracksRegLiveness: true -+liveins: -+ - { reg: '$vgpr0' } -+body: | -+ bb.0: -+ liveins: $vgpr0 -+ ; GFX1150-LABEL: name: block_of_exports -+ ; GFX1150: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: EXP 2, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: EXP 1, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_ENDPGM 0 -+ EXP 2, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ EXP 1, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ S_ENDPGM 0 -+... -+ -+--- -+name: sparse_exports -+tracksRegLiveness: true -+liveins: -+ - { reg: '$vgpr0' } -+body: | -+ bb.0: -+ liveins: $vgpr0 -+ ; GFX1150-LABEL: name: sparse_exports -+ ; GFX1150: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: EXP 2, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_WAITCNT_EXPCNT $sgpr_null, 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: $vgpr0 = V_AND_B32_e32 1, $vgpr0, implicit $exec -+ ; GFX1150-NEXT: EXP 1, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_WAITCNT_EXPCNT $sgpr_null, 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: $vgpr0 = V_OR_B32_e32 2, $vgpr0, implicit $exec -+ ; GFX1150-NEXT: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_ENDPGM 0 -+ EXP 2, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ $vgpr0 = V_AND_B32_e32 1, $vgpr0, implicit $exec -+ EXP 1, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ $vgpr0 = V_OR_B32_e32 2, $vgpr0, implicit $exec -+ EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ S_ENDPGM 0 -+... -+ -+--- -+name: existing_setprio_1 -+tracksRegLiveness: true -+liveins: -+ - { reg: '$vgpr0' } -+body: | -+ ; GFX1150-LABEL: name: existing_setprio_1 -+ ; GFX1150: bb.0: -+ ; GFX1150-NEXT: successors: %bb.1(0x80000000) -+ ; GFX1150-NEXT: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: $vgpr0 = V_AND_B32_e32 1, $vgpr0, implicit $exec -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: bb.1: -+ ; GFX1150-NEXT: successors: %bb.2(0x80000000) -+ ; GFX1150-NEXT: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 3 -+ ; GFX1150-NEXT: $vgpr0 = V_OR_B32_e32 2, $vgpr0, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: bb.2: -+ ; GFX1150-NEXT: successors: %bb.3(0x80000000) -+ ; GFX1150-NEXT: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 3 -+ ; GFX1150-NEXT: $vgpr0 = V_OR_B32_e32 3, $vgpr0, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: bb.3: -+ ; GFX1150-NEXT: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: EXP 1, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_ENDPGM 0 -+ bb.0: -+ liveins: $vgpr0 -+ $vgpr0 = V_AND_B32_e32 1, $vgpr0, implicit $exec -+ -+ bb.1: -+ liveins: $vgpr0 -+ S_SETPRIO 3 -+ $vgpr0 = V_OR_B32_e32 2, $vgpr0, implicit $exec -+ S_SETPRIO 0 -+ -+ bb.2: -+ liveins: $vgpr0 -+ S_SETPRIO 1 -+ $vgpr0 = V_OR_B32_e32 3, $vgpr0, implicit $exec -+ S_SETPRIO 0 -+ -+ bb.3: -+ liveins: $vgpr0 -+ EXP 1, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ S_ENDPGM 0 -+... -+ -+--- -+name: existing_setprio_2 -+tracksRegLiveness: true -+liveins: -+ - { reg: '$vgpr0' } -+body: | -+ bb.0: -+ liveins: $vgpr0 -+ ; GFX1150-LABEL: name: existing_setprio_2 -+ ; GFX1150: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 3 -+ ; GFX1150-NEXT: EXP 1, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_WAITCNT_EXPCNT $sgpr_null, 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: S_SETPRIO 3 -+ ; GFX1150-NEXT: S_ENDPGM 0 -+ S_SETPRIO 3 -+ EXP 1, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ S_SETPRIO 3 -+ S_ENDPGM 0 -+... - -From 8ea44e65f2c19facff751aeb2ac960f907fb210f Mon Sep 17 00:00:00 2001 -From: Carl Ritson -Date: Wed, 17 Jul 2024 16:18:02 +0900 -Subject: [PATCH 2/3] Remove -verify-machineinstrs from test. - ---- - llvm/test/CodeGen/AMDGPU/required-export-priority.ll | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/llvm/test/CodeGen/AMDGPU/required-export-priority.ll b/llvm/test/CodeGen/AMDGPU/required-export-priority.ll -index 377902f3f0d1a..ebc209bd4d451 100644 ---- a/llvm/test/CodeGen/AMDGPU/required-export-priority.ll -+++ b/llvm/test/CodeGen/AMDGPU/required-export-priority.ll -@@ -1,5 +1,5 @@ - ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 --; RUN: llc -mtriple=amdgcn -mcpu=gfx1150 -amdgpu-enable-vopd=0 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s -+; RUN: llc -mtriple=amdgcn -mcpu=gfx1150 -amdgpu-enable-vopd=0 < %s | FileCheck -check-prefix=GCN %s - - define amdgpu_ps void @test_export_zeroes_f32() #0 { - ; GCN-LABEL: test_export_zeroes_f32: diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5fd496b --- /dev/null +++ b/Makefile @@ -0,0 +1,190 @@ +.DEFAULT_GOAL=help + +# See ~/.config/mock/.cfg or /etc/mock/.cfg +# Tweak this to centos-stream-9-x86_64 to build for CentOS +MOCK_CHROOT?=centos-stream-10-x86_64 +MOCK_OPTS?= +MOCK_OPTS_RELEASE?=--no-clean --no-cleanup-after --without lto_build --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) +SPEC=llvm.spec +# When nothing is given, this will be determined based on release or snapshot +# builds. +SRPM_PATH?= +# Provide a path to your local llvm-project clone to build a snapshot of that +# tree. +GIT_TREE?= + +######### Get sources + +.PHONY: get-sources-snapshot +## Downloads all sources we need for a snapshot build. +get-sources-snapshot: + YYYYMMDD=$(YYYYMMDD) GIT_TREE=$(GIT_TREE) ./.copr/snapshot-info.sh > $(SOURCEDIR)/version.spec.inc +ifeq ($(GIT_TREE),) + spectool -g --define "_sourcedir $(SOURCEDIR)" --define "_with_snapshot_build 1" $(SPEC) +else + $(info Creating tarball from git tree: $(GIT_TREE)) + $(eval llvm_snapshot_git_revision:=$(shell git -C $(GIT_TREE) rev-parse HEAD)) + git -C $(GIT_TREE) archive --format=tar.gz -o $(PWD)/$(llvm_snapshot_git_revision).tar.gz --prefix=llvm-project-$(llvm_snapshot_git_revision)/ HEAD +endif + + +.PHONY: get-sources-release +## Downloads all sources we need for a release build. +get-sources-release: + spectool -g --define "_sourcedir $(SOURCEDIR)" $(SPEC) + +######### Build SRPM + +.PHONY: srpm-release +## Builds an SRPM that can be used for a release build. +srpm-release: get-sources-release + rpmbuild \ + --define "_rpmdir $(SOURCEDIR)" \ + --define "_sourcedir $(SOURCEDIR)" \ + --define "_specdir $(SOURCEDIR)" \ + --define "_srcrpmdir $(SOURCEDIR)" \ + --define "_builddir $(SOURCEDIR)" \ + -bs $(SPEC) + +.PHONY: srpm-snapshot +## Builds an SRPM that can be used for a snapshot build. +srpm-snapshot: get-sources-snapshot + rpmbuild \ + --with=snapshot_build \ + --define "_rpmdir $(SOURCEDIR)" \ + --define "_sourcedir $(SOURCEDIR)" \ + --define "_specdir $(SOURCEDIR)" \ + --define "_srcrpmdir $(SOURCEDIR)" \ + --define "_builddir $(SOURCEDIR)" \ + -bs $(SPEC) + +######### Scrub mock chroot and cache + +.PHONY: scrub-chroot +## Completely remove the fedora chroot and cache. +scrub-chroot: + mock -r $(MOCK_CHROOT) --scrub all + +######### Do a mock build + +.PHONY: mockbuild-release +## Start a mock build of the release SRPM. +mockbuild-release: srpm-release get-srpm-release + mock -r $(MOCK_CHROOT) $(MOCK_OPTS_RELEASE) $(srpm_path) + +.PHONY: mockbuild-snapshot +## Start a mock build of the snapshot SRPM. +mockbuild-snapshot: srpm-snapshot get-srpm-snapshot + mock -r $(MOCK_CHROOT) $(MOCK_OPTS_SNAPSHOT) $(srpm_path) + +######### Edit-last-failing-script + +.PHONY: get-last-run-script +## Get the file that was last modified in /var/tmp/ within the chroot. +get-last-run-script: + $(eval last_run_script:=/var/tmp/$(shell ls -t1 /var/lib/mock/$(MOCK_CHROOT)/root/var/tmp | head -n1)) + $(info last_run_script=$(last_run_script)) + @echo > /dev/null + +.PHONY: edit-last-failing-script +## Opens the last failing or running script from mock in your editor +## of choice for you to edit it and later re-run it in mock with: +## "make mockbuild-rerun-last-script". +edit-last-failing-script: get-last-run-script + $$EDITOR /var/lib/mock/$(MOCK_CHROOT)/root$(last_run_script) + +######### Re-run the last failing script from mock + +.PHONY: mockbuild-rerun-last-script +## Re-runs the last failing or running script of your release/snapshot mock mockbuild. +mockbuild-rerun-last-script: get-last-run-script + mock --root=$(MOCK_CHROOT) --shell 'sh -e $(last_run_script)' + +.PHONY: help +# Based on https://gist.github.com/rcmachado/af3db315e31383502660 +## Display this help text. +help:/ + $(info Available targets) + $(info -----------------) + @awk '/^[a-zA-Z\-0-9]+:/ { \ + helpMessage = match(lastLine, /^## (.*)/); \ + helpCommand = substr($$1, 0, index($$1, ":")-1); \ + if (helpMessage) { \ + helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ + gsub(/##/, "\n ", helpMessage); \ + } else { \ + helpMessage = "(No documentation)"; \ + } \ + printf "%-37s - %s\n", helpCommand, helpMessage; \ + lastLine = "" \ + } \ + { hasComment = match(lastLine, /^## (.*)/); \ + if(hasComment) { \ + lastLine=lastLine$$0; \ + } \ + else { \ + lastLine = $$0 \ + } \ + }' $(MAKEFILE_LIST) + +######### Deprecated targets + +# Map deprecated targets to new targets +.PHONY: snapshot-srpm release-srpm +snapshot-srpm release-srpm: + $(eval mapped_target:=$(subst snapshot-srpm,srpm-snapshot,$(MAKECMDGOALS))) + $(eval mapped_target:=$(subst release-srpm,srpm-release,$(mapped_target))) + $(info WARNING: "$(MAKECMDGOALS)" is deprecated. Instead running "$(mapped_target)") + $(MAKE) $(mapped_target) + +######### Version/Release helper targets to build name of SRPM + +.PHONY: get-llvm-version-release +## Determines the LLVM version given in the llvm.spec file. +get-llvm-version-release: + $(eval llvm_version_release:=$(shell grep -ioP "%global\s+(maj|min|patch)_ver[^0-9]\K[0-9]+" $(SPEC) | paste -sd'.')) + $(info LLVM Release Version: $(llvm_version_release)) + @echo > /dev/null + +.PHONY: get-llvm-version-snapshot +## Determines the LLVM version given in the version.spec.inc file. +get-llvm-version-snapshot: + $(eval llvm_version_snapshot:=$(shell grep -ioP "%global\s+(maj|min|patch)_ver[^0-9]\K[0-9]+" version.spec.inc | paste -sd'.')) + $(info LLVM Snapshot Version: $(llvm_version_snapshot)) + @echo > /dev/null + +.PHONY: get-spec-file-release +## Parses the spec file for the Release: tag +get-spec-file-release: + $(eval spec_file_release:=$(shell grep -ioP '^Release:\s*\K[0-9]+' $(SPEC))) + $(info LLVM Spec file Release: $(spec_file_release)) + @echo > /dev/null + +.PHONY: get-srpm-release +## Determines the name of the SRPM used for release builds +## Can be overriden by giving "make ... SRPM_PATH=foo.src.rpm". +get-srpm-release: get-llvm-version-release get-spec-file-release +ifeq ($(SRPM_PATH),) + $(eval srpm_path:=llvm-$(llvm_version_release)-$(spec_file_release).*.src.rpm) +else + $(eval srpm_path:=$(SRPM_PATH)) +endif + $(info LLVM SRPM Release: $(srpm_path)) + @echo > /dev/null + +.PHONY: get-srpm-snapshot +## Determines the name of the SRPM used for snapshot builds +## Can be overriden by giving "make ... SRPM_PATH=foo.src.rpm". +get-srpm-snapshot: get-llvm-version-snapshot get-spec-file-release +ifeq ($(SRPM_PATH),) + $(eval yyyymmdd:=$(shell grep -ioP "%global\s+llvm_snapshot_yyyymmdd\s+\K[0-9]+" version.spec.inc)) + $(eval git_short:=$(shell grep -ioP "%global\s+llvm_snapshot_git_revision_short\s+\K[a-zA-Z0-9]+" version.spec.inc)) + $(eval srpm_path:=llvm-$(llvm_version_snapshot)~pre$(yyyymmdd).g$(git_short)-$(spec_file_release).*.src.rpm) +else + $(eval srpm_path:=$(SRPM_PATH)) +endif + $(info LLVM SRPM Snapshot: $(srpm_path)) + @echo > /dev/null diff --git a/llvm.rpmlintrc b/llvm.rpmlintrc index 7ae23e2..de8f68f 100644 --- a/llvm.rpmlintrc +++ b/llvm.rpmlintrc @@ -1,3 +1,5 @@ +## LLVM ############################################################# + # This library has no dependencies. addFilter("llvm-libs.x86_64: E: shared-lib-without-dependency-information /usr/lib64/libRemarks.so.[0-9]+") addFilter("llvm-googletest.x86_64: W: devel-file-in-non-devel-package") @@ -16,3 +18,32 @@ addFilter("llvm-googletest.x86_64: W: no-documentation") addFilter("llvm-libs.x86_64: W: no-documentation") addFilter("llvm-static.x86_64: W: no-documentation") addFilter("llvm-test.x86_64: W: no-documentation") + +## COMPILER-RT ###################################################### + +# This is a devel package +addFilter("W: devel-file-in-non-devel-package") + +# These symlinks are dangling on x64_64 +addFilter("compiler-rt.x86_64: W: dangling-relative-symlink /usr/lib64/clang/[0-9]+.[0-9]+.[0-9]+/") + +addFilter("E: hardcoded-library-path in ../../lib/clang/") + + +## LIBOMP ########################################################### + + + +## CLANG ############################################################ + +clang needs libstdc++-devel installed in order to compile c++ programs. + +addFilter("E: devel-dependency libstdc\+\+-devel") + +addFilter("E: explicit-lib-dependency libstdc\+\+-devel") + +# clang installs libear to /usr/lib on all arches, so we have to use + +# a hard-coded /usr/lib path in order to move it to the python3 sitelib. + +addFilter("E: hardcoded-library-path in %{_prefix}/lib/{libear") diff --git a/llvm.spec b/llvm.spec index a1e8aa4..fb39d2c 100644 --- a/llvm.spec +++ b/llvm.spec @@ -1,9 +1,9 @@ #region globals #region version -%global maj_ver 19 +%global maj_ver 20 %global min_ver 1 -%global patch_ver 7 -#global rc_ver 4 +%global patch_ver 2 +#global rc_ver 3 %bcond_with snapshot_build %if %{with snapshot_build} @@ -24,21 +24,59 @@ %bcond_with compat_build # Bundle compat libraries for a previous LLVM version, as part of llvm-libs and # clang-libs. Used on RHEL. -%bcond_with bundle_compat_lib +%bcond_without bundle_compat_lib %bcond_without check %if %{with bundle_compat_lib} -%global compat_maj_ver 18 -%global compat_ver %{compat_maj_ver}.1.8 +%global compat_maj_ver 19 +%global compat_ver %{compat_maj_ver}.1.7 %endif -# Compat builds do not include python-lit and lldb +# Compat builds do not include python-lit %if %{with compat_build} %bcond_with python_lit -%bcond_with lldb %else %bcond_without python_lit +%endif + %bcond_without lldb + +%if %{without compat_build} && 0%{?fedora} >= 41 +%ifarch %{ix86} +%bcond_with mlir +%else +%bcond_without mlir +%endif +%else +%bcond_with mlir +%endif + +# The libcxx build condition also enables libcxxabi and libunwind. +# Fedora 41 is the first version that enabled FatLTO for clang-built files. +# Without FatLTO, we can't enable ThinLTO and link using GNU LD. +%if %{without compat_build} && 0%{?fedora} >= 41 +%bcond_without libcxx +%else +%bcond_with libcxx +%endif + +# I've called the build condition "build_bolt" to indicate that this does not +# necessarily "use" BOLT in order to build LLVM. +%if %{without compat_build} && 0%{?fedora} >= 41 +# BOLT only supports aarch64 and x86_64 +%ifarch aarch64 x86_64 +%bcond_without build_bolt +%else +%bcond_with build_bolt +%endif +%else +%bcond_with build_bolt +%endif + +%if %{without compat_build} && 0%{?fedora} >= 41 +%bcond_without polly +%else +%bcond_with polly %endif # Disable LTO on x86 and riscv in order to reduce memory consumption. @@ -56,6 +94,19 @@ # See https://docs.fedoraproject.org/en-US/packaging-guidelines/#_compiler_macros %global toolchain clang +# Make sure that we are not building with a newer compiler than the targeted +# version. For example, if we build LLVM 19 with Clang 20, then we'd build +# LLVM libraries with Clang 20, and then the runtimes build would use the +# just-built Clang 19. Runtimes that link against LLVM libraries would then +# try to make Clang 19 perform LTO involving LLVM 20 bitcode. +%if %{with compat_build} +%global host_clang_maj_ver %{maj_ver} +%endif + +%if %{defined host_clang_maj_ver} +%global __cc /usr/bin/clang-%{host_clang_maj_ver} +%global __cxx /usr/bin/clang++-%{host_clang_maj_ver} +%endif %if %{defined rhel} && 0%{?rhel} < 10 %global gts_version 14 @@ -78,33 +129,23 @@ %global pkg_name_llvm llvm%{maj_ver} %global pkg_suffix %{maj_ver} %global exec_suffix -%{maj_ver} -%global install_prefix %{_libdir}/%{pkg_name_llvm} +%else +%global pkg_name_llvm llvm +%global pkg_suffix %{nil} +%global exec_suffix %{nil} +%endif + +# Apart from compiler-rt and libcxx, everything is installed into a +# version-specific prefix. Non-compat packages add symlinks to this prefix. +%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_datadir %{install_prefix}/share +%global install_mandir %{install_prefix}/share/man %global install_libexecdir %{install_prefix}/libexec -%global install_docdir %{install_datadir}/doc -%global unprefixed_libdir lib %global build_libdir llvm/%{_vpath_builddir}/lib - -%global pkg_includedir %{_includedir}/%{pkg_name_llvm} -%global pkg_datadir %{install_prefix}/share -%else -%global pkg_name_llvm llvm -%global install_prefix /usr -%global install_bindir %{_bindir} -%global install_datadir %{_datadir} -%global install_libdir %{_libdir} -%global install_includedir %{_includedir} -%global install_libexecdir %{_libexecdir} -%global install_docdir %{_docdir} -%global unprefixed_libdir %{_lib} -%global build_libdir llvm/%{_vpath_builddir}/%{_lib} -%global pkg_datadir %{_datadir} -%global pkg_suffix %{nil} -%global exec_suffix %{nil} -%endif +%global unprefixed_libdir lib %if 0%{?rhel} %global targets_to_build "X86;AMDGPU;PowerPC;NVPTX;SystemZ;AArch64;ARM;Mips;BPF;WebAssembly" @@ -151,8 +192,7 @@ # export ASMFLAGS=$CFLAGS #endregion COMPILER-RT globals -#region LLD globals - +#region openmp globals %global pkg_name_libomp libomp%{pkg_suffix} %global so_suffix %{maj_ver}.%{min_ver} @@ -166,23 +206,40 @@ %else %global libomp_arch %{_arch} %endif - -#endregion LLD globals +#endregion openmp globals #region LLD globals %global pkg_name_lld lld%{pkg_suffix} #endregion LLD globals #region LLDB globals -%global pkg_name_lldb lldb +%global pkg_name_lldb lldb%{pkg_suffix} #endregion LLDB globals + +#region MLIR globals +%global pkg_name_mlir mlir%{pkg_suffix} +#endregion MLIR globals + +#region libcxx globals +%global pkg_name_libcxx libcxx +%global pkg_name_libcxxabi libcxxabi +%global pkg_name_llvm_libunwind llvm-libunwind +#endregion libcxx globals + +#region BOLT globals +%global pkg_name_bolt llvm-bolt%{pkg_suffix} +#endregion BOLT globals + +#region polly globals +%global pkg_name_polly polly%{pkg_suffix} +#endregion polly globals #endregion globals #region packages #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 @@ -236,16 +293,9 @@ Source1000: version.spec.inc # situations. Remember that a compat library is always at least one major version # behind the latest packaged LLVM version. -#region OpenMP patches -Patch1900: 0001-openmp-Add-option-to-disable-tsan-tests-111548.patch -Patch1901: 0001-openmp-Use-core_siblings_list-if-physical_package_id.patch -Patch1910: 0001-openmp-Support-CET-in-z_Linux_asm.S-123213.patch -#endregion OpenMP patches - #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 -#endregion CLANG patches # Workaround a bug in ORC on ppc64le. # More info is available here: https://reviews.llvm.org/D159115#4641826 @@ -254,27 +304,34 @@ Patch103: 0001-Workaround-a-bug-in-ORC-on-ppc64le.patch # With the introduction of --gcc-include-dir in the clang config file, # this might no longer be needed. Patch104: 0001-Driver-Give-devtoolset-path-precedence-over-Installe.patch +#endregion CLANG patches + +# 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 +Patch2003: 0001-cmake-Resolve-symlink-when-finding-install-prefix.patch #region LLD patches -Patch1800: 0001-18-Always-build-shared-libs-for-LLD.patch -Patch1902: 0001-19-Always-build-shared-libs-for-LLD.patch -Patch2000: 0001-19-Always-build-shared-libs-for-LLD.patch +Patch106: 0001-19-Always-build-shared-libs-for-LLD.patch #endregion LLD patches +#region polly patches +Patch2001: 0001-20-polly-shared-libs.patch +Patch2101: 0001-20-polly-shared-libs.patch +#endregion polly patches + #region RHEL patches # RHEL 8 only Patch501: 0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch #endregion RHEL patches -# Backport with modifications from -# https://github.com/llvm/llvm-project/pull/99273 -# Fixes RHEL-49517. -Patch1801: 18-99273.patch +# Fix an isel error triggered by Rust 1.85 on s390x +# https://github.com/llvm/llvm-project/issues/124001 +Patch1901: 0001-SystemZ-Fix-ICE-with-i128-i64-uaddo-carry-chain.patch -# Fix profiling after a binutils NOTE change. -# https://github.com/llvm/llvm-project/pull/114907 -Patch1802: 0001-profile-Use-base-vaddr-for-__llvm_write_binary_ids-n.patch -Patch1903: 0001-profile-Use-base-vaddr-for-__llvm_write_binary_ids-n.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 @@ -284,10 +341,15 @@ Patch1903: 0001-profile-Use-base-vaddr-for-__llvm_write_binary_ids-n.patch %if %{defined gts_version} # Required for 64-bit atomics on i686. BuildRequires: gcc-toolset-%{gts_version}-libatomic-devel +BuildRequires: gcc-toolset-%{gts_version}-gcc-c++ %endif BuildRequires: gcc BuildRequires: gcc-c++ +%if %{defined host_clang_maj_ver} +BuildRequires: clang(major) = %{host_clang_maj_ver} +%else BuildRequires: clang +%endif BuildRequires: cmake BuildRequires: chrpath BuildRequires: ninja-build @@ -364,6 +426,13 @@ BuildRequires: perl(Term::ANSIColor) BuildRequires: perl(Text::ParseWords) BuildRequires: perl(Sys::Hostname) +%if %{with mlir} +BuildRequires: python%{python3_pkgversion}-numpy +BuildRequires: python%{python3_pkgversion}-pybind11 +BuildRequires: python%{python3_pkgversion}-pyyaml +BuildRequires: python%{python3_pkgversion}-nanobind-devel +%endif + BuildRequires: graphviz # This is required because we need "ps" when running LLDB tests @@ -394,7 +463,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 @@ -410,6 +478,14 @@ lit is a tool used by the LLVM project for executing its test suites. #region LLVM packages +%package -n %{pkg_name_llvm}-filesystem +Summary: Filesystem package that owns the versioned llvm prefix +# Was renamed immediately after introduction. +Obsoletes: %{pkg_name_llvm}-resource-filesystem < 20 + +%description -n %{pkg_name_llvm}-filesystem +This packages owns the versioned llvm prefix directory: $libdir/llvm$version + %package -n %{pkg_name_llvm}-devel Summary: Libraries and header files for LLVM Requires: %{pkg_name_llvm}%{?_isa} = %{version}-%{release} @@ -429,8 +505,8 @@ Requires: %{pkg_name_llvm}-test%{?_isa} = %{version}-%{release} Requires: %{pkg_name_llvm}-googletest%{?_isa} = %{version}-%{release} -Requires(post): %{_sbindir}/alternatives -Requires(postun): %{_sbindir}/alternatives +Requires(post): alternatives +Requires(postun): alternatives Provides: llvm-devel(major) = %{maj_ver} @@ -448,12 +524,14 @@ Documentation for the LLVM compiler infrastructure. %package -n %{pkg_name_llvm}-libs Summary: LLVM shared libraries +Requires: %{pkg_name_llvm}-filesystem%{?_isa} = %{version}-%{release} %description -n %{pkg_name_llvm}-libs Shared libraries for the LLVM compiler infrastructure. %package -n %{pkg_name_llvm}-static Summary: LLVM static libraries +Requires: %{pkg_name_llvm}-filesystem%{?_isa} = %{version}-%{release} Conflicts: %{pkg_name_llvm}-devel < 8 Provides: llvm-static(major) = %{maj_ver} @@ -463,6 +541,7 @@ Static libraries for the LLVM compiler infrastructure. %package -n %{pkg_name_llvm}-cmake-utils Summary: CMake utilities shared across LLVM subprojects +Requires: %{pkg_name_llvm}-filesystem%{?_isa} = %{version}-%{release} %description -n %{pkg_name_llvm}-cmake-utils CMake utilities shared across LLVM subprojects. @@ -479,6 +558,7 @@ Provides: llvm-test(major) = %{maj_ver} LLVM regression tests. %package -n %{pkg_name_llvm}-googletest +Requires: %{pkg_name_llvm}-filesystem%{?_isa} = %{version}-%{release} Summary: LLVM's modified googletest sources %description -n %{pkg_name_llvm}-googletest @@ -549,6 +629,8 @@ Requires: %{pkg_name_clang}-libs = %{version}-%{release} Requires: %{pkg_name_clang}%{?_isa} = %{version}-%{release} # The clang CMake files reference tools from clang-tools-extra. Requires: %{pkg_name_clang}-tools-extra%{?_isa} = %{version}-%{release} +# The clang cmake package depends on the LLVM cmake package. +Requires: %{pkg_name_llvm}-devel%{?_isa} = %{version}-%{release} Provides: clang-devel(major) = %{maj_ver} # For the clangd language server contained in this subpackage, # add a Provides so users can just run "dnf install clangd." @@ -571,7 +653,6 @@ This package owns the clang resouce directory: $libdir/clang/$version/ %package -n %{pkg_name_clang}-analyzer Summary: A source code analysis framework License: Apache-2.0 WITH LLVM-exception OR NCSA OR MIT -BuildArch: noarch Requires: %{pkg_name_clang} = %{version}-%{release} %description -n %{pkg_name_clang}-analyzer @@ -617,7 +698,7 @@ Requires: python%{python3_pkgversion} Obsoletes: python3-clang < 18.9 %endif %description -n python%{python3_pkgversion}-clang -%{summary}. +Python3 bindings for clang. %endif @@ -631,7 +712,7 @@ Summary: LLVM "compiler-rt" runtime libraries License: Apache-2.0 WITH LLVM-exception OR NCSA OR MIT -Requires: clang-resource-filesystem%{?_isa} = %{version}-%{release} +Requires: %{pkg_name_clang}-resource-filesystem%{?_isa} = %{version}-%{release} Provides: compiler-rt(major) = %{maj_ver} %description -n %{pkg_name_compiler_rt} @@ -663,7 +744,7 @@ Summary: OpenMP header files URL: http://openmp.llvm.org Requires: %{pkg_name_libomp}%{?_isa} = %{version}-%{release} -Requires: clang-resource-filesystem%{?_isa} = %{version}-%{release} +Requires: %{pkg_name_clang}-resource-filesystem%{?_isa} = %{version}-%{release} Provides: libomp-devel(major) = %{maj_ver} @@ -678,8 +759,8 @@ URL: http://openmp.llvm.org %package -n %{pkg_name_lld} Summary: The LLVM Linker -Requires(post): %{_sbindir}/update-alternatives -Requires(preun): %{_sbindir}/update-alternatives +Requires(post): alternatives +Requires(preun): alternatives Requires: %{pkg_name_lld}-libs = %{version}-%{release} Provides: lld(major) = %{maj_ver} @@ -732,7 +813,9 @@ License: Apache-2.0 WITH LLVM-exception OR NCSA URL: http://lldb.llvm.org/ Requires: %{pkg_name_clang}-libs%{?_isa} = %{version}-%{release} +%if %{without compat_build} Requires: python%{python3_pkgversion}-lldb +%endif %description -n %{pkg_name_lldb} LLDB is a next generation, high-performance debugger. It is built as a set @@ -747,6 +830,7 @@ Requires: %{pkg_name_lldb}%{?_isa} = %{version}-%{release} %description -n %{pkg_name_lldb}-devel The package contains header files for the LLDB debugger. +%if %{without compat_build} %package -n python%{python3_pkgversion}-lldb %{?python_provide:%python_provide python%{python3_pkgversion}-lldb} Summary: Python module for LLDB @@ -761,7 +845,171 @@ Obsoletes: python3-lldb < 18.9 %description -n python%{python3_pkgversion}-lldb The package contains the LLDB Python module. %endif +%endif #endregion LLDB packages + +#region MLIR packages +%if %{with mlir} +%package -n %{pkg_name_mlir} +Summary: Multi-Level Intermediate Representation Overview +License: Apache-2.0 WITH LLVM-exception +URL: http://mlir.llvm.org +Requires: %{pkg_name_llvm}-libs = %{version}-%{release} + +%description -n %{pkg_name_mlir} +The MLIR project is a novel approach to building reusable and extensible +compiler infrastructure. MLIR aims to address software fragmentation, +improve compilation for heterogeneous hardware, significantly reduce +the cost of building domain specific compilers, and aid in connecting +existing compilers together. + +%package -n %{pkg_name_mlir}-static +Summary: MLIR static files +Requires: %{pkg_name_mlir}%{?_isa} = %{version}-%{release} + +%description -n %{pkg_name_mlir}-static +MLIR static files. + +%package -n %{pkg_name_mlir}-devel +Summary: MLIR development files +Requires: %{pkg_name_mlir}%{?_isa} = %{version}-%{release} +Requires: %{pkg_name_mlir}-static%{?_isa} = %{version}-%{release} + +%description -n %{pkg_name_mlir}-devel +MLIR development files. + +%package -n python%{python3_pkgversion}-mlir +%{?python_provide:%python_provide python%{python3_pkgversion}-mlir} +Summary: MLIR python bindings + +Requires: python%{python3_pkgversion} +Requires: python%{python3_pkgversion}-numpy + +%description -n python%{python3_pkgversion}-mlir +MLIR python bindings. +%endif +#endregion MLIR packages + +#region libcxx packages +%if %{with libcxx} +%package -n %{pkg_name_libcxx} +Summary: C++ standard library targeting C++11 +License: Apache-2.0 WITH LLVM-exception OR MIT OR NCSA +URL: http://libcxx.llvm.org/ + +Requires: %{pkg_name_libcxxabi}%{?_isa} = %{version}-%{release} + +%description -n %{pkg_name_libcxx} +libc++ is a new implementation of the C++ standard library, targeting C++11 and above. + + +%package -n %{pkg_name_libcxx}-devel +Summary: Headers and libraries for %{pkg_name_libcxx} devel +Requires: %{pkg_name_libcxx}%{?_isa} = %{version}-%{release} +Requires: %{pkg_name_libcxxabi}-devel + +%description -n %{pkg_name_libcxx}-devel +Headers and libraries for %{pkg_name_libcxx} devel. + +%package -n %{pkg_name_libcxx}-static +Summary: Static libraries for %{pkg_name_libcxx} + +%description -n %{pkg_name_libcxx}-static +Static libraries for %{pkg_name_libcxx}. + +%package -n %{pkg_name_libcxxabi} +Summary: Low level support for a standard C++ library + +%description -n %{pkg_name_libcxxabi} +libcxxabi provides low level support for a standard C++ library. + +%package -n %{pkg_name_libcxx}abi-devel +Summary: Headers and libraries for %{pkg_name_libcxxabi} devel +Requires: %{pkg_name_libcxxabi}%{?_isa} = %{version}-%{release} + +%description -n %{pkg_name_libcxxabi}-devel +Headers and libraries for %{pkg_name_libcxxabi} devel. + +%package -n %{pkg_name_libcxxabi}-static +Summary: Static libraries for %{pkg_name_libcxxabi} + +%description -n %{pkg_name_libcxxabi}-static +Static libraries for %{pkg_name_libcxxabi}. + +%package -n %{pkg_name_llvm_libunwind} +Summary: LLVM libunwind + +%description -n %{pkg_name_llvm_libunwind} + +LLVM libunwind is an implementation of the interface defined by the HP libunwind +project. It was contributed Apple as a way to enable clang++ to port to +platforms that do not have a system unwinder. It is intended to be a small and +fast implementation of the ABI, leaving off some features of HP's libunwind +that never materialized (e.g. remote unwinding). + +%package -n %{pkg_name_llvm_libunwind}-devel +Summary: LLVM libunwind development files +Provides: %{pkg_name_llvm_libunwind}(major) = %{maj_ver} +Requires: %{pkg_name_llvm_libunwind}%{?_isa} = %{version}-%{release} + +%description -n %{pkg_name_llvm_libunwind}-devel +Unversioned shared library for LLVM libunwind + +%package -n %{pkg_name_llvm_libunwind}-static +Summary: Static library for LLVM libunwind + +%description -n %{pkg_name_llvm_libunwind}-static +Static library for LLVM libunwind. + +%endif +#endregion libcxx packages + +#region BOLT packages +%if %{with build_bolt} +%package -n %{pkg_name_bolt} +Summary: A post-link optimizer developed to speed up large applications +License: Apache-2.0 WITH LLVM-exception +URL: https://github.com/llvm/llvm-project/tree/main/bolt +Requires: %{pkg_name_llvm}-filesystem%{?_isa} = %{version}-%{release} + +# As hinted by bolt documentation +Recommends: gperftools-devel + +%description -n %{pkg_name_bolt} + +BOLT is a post-link optimizer developed to speed up large applications. +It achieves the improvements by optimizing application's code layout based on +execution profile gathered by sampling profiler, such as Linux `perf` tool. +%endif +#endregion BOLT packages + +#region polly packages +%if %{with polly} +%package -n %{pkg_name_polly} +Summary: LLVM Framework for High-Level Loop and Data-Locality Optimizations +License: Apache-2.0 WITH LLVM-exception +URL: http://polly.llvm.org +Requires: %{pkg_name_llvm}-libs = %{version}-%{release} + +# We no longer ship polly-doc. +Obsoletes: %{pkg_name_polly}-doc < 20 + +%description -n %{pkg_name_polly} + +Polly is a high-level loop and data-locality optimizer and optimization +infrastructure for LLVM. It uses an abstract mathematical representation based +on integer polyhedron to analyze and optimize the memory access pattern of a +program. + +%package -n %{pkg_name_polly}-devel +Summary: Polly header files +Requires: %{pkg_name_polly} = %{version}-%{release} + +%description -n %{pkg_name_polly}-devel +Polly header files. +%endif +#endregion polly packages + #endregion packages #region prep @@ -835,6 +1083,19 @@ The package contains the LLDB Python module. #endregion COMPILER-RT preparation +#region lldb preparation +# Compat builds don't build python bindings, but should still build man pages. +%if %{with compat_build} +sed -i 's/LLDB_ENABLE_PYTHON/TRUE/' lldb/docs/CMakeLists.txt +%endif +#endregion + +#region libcxx preparation +%if %{with libcxx} +%py3_shebang_fix libcxx/utils/ +%endif +#endregion libcxx preparation + #endregion prep #region build @@ -855,10 +1116,48 @@ The package contains the LLDB Python module. %endif %global projects clang;clang-tools-extra;lld +%global runtimes compiler-rt;openmp;offload + %if %{with lldb} %global projects %{projects};lldb %endif +%if %{with mlir} +%global projects %{projects};mlir +%endif + +%if %{with build_bolt} +%global projects %{projects};bolt +%endif + +%if %{with polly} +%global projects %{projects};polly +%endif + +%if %{with libcxx} +%global runtimes %{runtimes};libcxx;libcxxabi;libunwind +%endif + +%global cfg_file_content --gcc-triple=%{_target_cpu}-redhat-linux + +# We want to use DWARF-5 on all snapshot builds. +%if %{without snapshot_build} && %{defined rhel} && 0%{?rhel} < 10 +%global cfg_file_content %{cfg_file_content} -gdwarf-4 -g0 +%endif + +%if %{defined gts_version} +%global cfg_file_content %{cfg_file_content} --gcc-install-dir=/opt/rh/gcc-toolset-%{gts_version}/root/%{_exec_prefix}/lib/gcc/%{_target_cpu}-redhat-linux/%{gts_version} +%endif + +# Already use the new clang config file for the current build. This ensures +# consistency between the runtimes and non-runtimes builds and makes sure that +# the new configuration will work without going through a rebuild cycle. +# Don't do this on RHEL 8, which does not build using clang. +%if %{defined gts_version} && 0%{?rhel} != 8 +echo "%{cfg_file_content}" > /tmp/clang.cfg +%global optflags %{optflags} --config /tmp/clang.cfg +%endif + # Copy CFLAGS into ASMFLAGS, so -fcf-protection is used when compiling assembly files. export ASMFLAGS="%{build_cflags}" @@ -912,12 +1211,8 @@ popd -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 -%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 + -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=../clang-tools-extra \\\ + -DCLANG_RESOURCE_DIR=../../../lib/clang/%{maj_ver} #endregion clang options #region compiler-rt options @@ -937,7 +1232,7 @@ popd # Configure sphinx: # Build man-pages but no HTML docs using sphinx %global cmake_config_args %{cmake_config_args} \\\ - -DSPHINX_EXECUTABLE=%{_bindir}/sphinx-build-3 \\\ + -DSPHINX_EXECUTABLE=/usr/bin/sphinx-build-3 \\\ -DSPHINX_OUTPUT_HTML:BOOL=OFF \\\ -DSPHINX_OUTPUT_MAN:BOOL=ON \\\ -DSPHINX_WARNINGS_AS_ERRORS=OFF @@ -945,9 +1240,9 @@ popd #region lldb options %if %{with lldb} - %global cmake_config_args %{cmake_config_args} -DLLDB_DISABLE_CURSES:BOOL=OFF - %global cmake_config_args %{cmake_config_args} -DLLDB_DISABLE_LIBEDIT:BOOL=OFF - %global cmake_config_args %{cmake_config_args} -DLLDB_DISABLE_PYTHON:BOOL=OFF +%if %{with compat_build} + %global cmake_config_args %{cmake_config_args} -DLLDB_ENABLE_PYTHON=OFF +%endif %ifarch ppc64le %global cmake_config_args %{cmake_config_args} -DLLDB_TEST_USER_ARGS=--skip-category=watchpoint %endif @@ -959,6 +1254,34 @@ popd %endif #endregion lldb options +#region libcxx options +%if %{with libcxx} +%global cmake_config_args %{cmake_config_args} \\\ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \\\ + -DLIBCXX_INCLUDE_BENCHMARKS=OFF \\\ + -DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON \\\ + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=ON \\\ + -DLIBCXXABI_USE_LLVM_UNWINDER=OFF \\\ + -DLIBUNWIND_INSTALL_INCLUDE_DIR=%{_includedir}/llvm-libunwind + +# If we don't set the .._INSTALL_LIBRARY_DIR variables, +# the *.so files will be placed in a subdirectory that includes the triple +%global cmake_config_args %{cmake_config_args} \\\ + -DLIBCXX_INSTALL_LIBRARY_DIR=%{_libdir} \\\ + -DLIBCXXABI_INSTALL_LIBRARY_DIR=%{_libdir} \\\ + -DLIBUNWIND_INSTALL_LIBRARY_DIR=%{_libdir} + +# If we don't adjust this, we will install into this unwanted location: +# /usr/include/i686-redhat-linux-gnu/c++/v1/__config_site +%global cmake_config_args %{cmake_config_args} \\\ + -DLIBCXX_INSTALL_INCLUDE_TARGET_DIR=%{_includedir}/c++/v1 \\\ + -DLIBCXX_INSTALL_INCLUDE_DIR=%{_includedir}/c++/v1 \\\ + -DLIBCXX_INSTALL_MODULES_DIR=%{_datadir}/libc++/v1 \\\ + -DLIBCXXABI_INSTALL_INCLUDE_DIR=%{_includedir}/c++/v1 + +%endif +#endregion libcxx options + #region llvm options %global cmake_config_args %{cmake_config_args} \\\ -DLLVM_APPEND_VC_REV:BOOL=OFF \\\ @@ -967,19 +1290,18 @@ popd -DLLVM_BUILD_RUNTIME:BOOL=ON \\\ -DLLVM_BUILD_TOOLS:BOOL=ON \\\ -DLLVM_BUILD_UTILS:BOOL=ON \\\ - -DLLVM_COMMON_CMAKE_UTILS=%{install_datadir}/llvm/cmake \\\ -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}" \\\ - -DLLVM_ENABLE_RUNTIMES="compiler-rt;openmp;offload" \\\ + -DLLVM_ENABLE_RUNTIMES="%{runtimes}" \\\ -DLLVM_ENABLE_ZLIB:BOOL=FORCE_ON \\\ -DLLVM_ENABLE_ZSTD:BOOL=FORCE_ON \\\ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=%{experimental_targets_to_build} \\\ -DLLVM_INCLUDE_BENCHMARKS=OFF \\\ - -DLLVM_INCLUDE_EXAMPLES:BOOL=ON \\\ + -DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \\\ -DLLVM_INCLUDE_TOOLS:BOOL=ON \\\ -DLLVM_INCLUDE_UTILS:BOOL=ON \\\ -DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF \\\ @@ -991,12 +1313,32 @@ popd -DLLVM_UTILS_INSTALL_DIR:PATH=bin #endregion llvm options +#region mlir options +%if %{with mlir} +%global cmake_config_args %{cmake_config_args} \\\ + -DMLIR_INCLUDE_DOCS:BOOL=ON \\\ + -DMLIR_INCLUDE_TESTS:BOOL=ON \\\ + -DMLIR_INCLUDE_INTEGRATION_TESTS:BOOL=OFF \\\ + -DMLIR_INSTALL_AGGREGATE_OBJECTS=OFF \\\ + -DMLIR_BUILD_MLIR_C_DYLIB=ON \\\ + -DMLIR_ENABLE_BINDINGS_PYTHON:BOOL=ON +%endif +#endregion mlir options + #region openmp options %global cmake_config_args %{cmake_config_args} \\\ -DOPENMP_INSTALL_LIBDIR=%{unprefixed_libdir} \\\ -DLIBOMP_INSTALL_ALIASES=OFF #endregion openmp options +#region polly options +%if %{with polly} +%global cmake_config_args %{cmake_config_args} \\\ + -DLLVM_POLLY_LINK_INTO_TOOLS=OFF +%endif +#endregion polly options + + #region test options %global cmake_config_args %{cmake_config_args} \\\ -DLLVM_BUILD_TESTS:BOOL=ON \\\ @@ -1039,14 +1381,6 @@ popd %global cmake_config_args %{cmake_config_args} -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" %endif -%if %{without compat_build} -%if 0%{?__isa_bits} == 64 - %global cmake_config_args %{cmake_config_args} -DLLVM_LIBDIR_SUFFIX=64 -%else - %global cmake_config_args %{cmake_config_args} -DLLVM_LIBDIR_SUFFIX= -%endif -%endif - %if %{with gold} %global cmake_config_args %{cmake_config_args} -DLLVM_BINUTILS_INCDIR=%{_includedir} %endif @@ -1064,8 +1398,13 @@ popd %endif %if 0%{?rhel} == 8 +%ifnarch s390x + # This option uses the NUMBER_OF_LOGICAL_CORES query in CMake which doesn't + # work on s390x. + # https://gitlab.kitware.com/cmake/cmake/-/issues/26619 %global cmake_config_args %{cmake_config_args} -DLLVM_RAM_PER_COMPILE_JOB=2048 %endif +%endif #endregion misc options extra_cmake_args='' @@ -1087,6 +1426,13 @@ fi # This is to fix occasional OOM errors on the ppc64le COPR builders. %cmake_build --target libclang-cpp.so +# Same for the three large MLIR dylibs. +%if %{with mlir} +%cmake_build --target libMLIR.so +%cmake_build --target libMLIR-C.so +%cmake_build --target libMLIRPythonCAPI.so +%endif + %cmake_build # If we don't build the runtimes target here, we'll have to wait for the %%check @@ -1159,9 +1505,6 @@ install %{build_libdir}/libLLVMTestingAnnotations.a %{buildroot}%{install_libdir %if %{without compat_build} -# Fix some man pages -ln -s llvm-config.1 %{buildroot}%{_mandir}/man1/llvm-config%{exec_suffix}-%{__isa_bits}.1 - %if %{with gold} # Add symlink to lto plugin in the binutils plugin directory. %{__mkdir_p} %{buildroot}%{_libdir}/bfd-plugins/ @@ -1176,17 +1519,10 @@ cat >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/%{pkg_name_llvm}-%{_arch}.conf << %{install_libdir} EOF -# Add version suffix to man pages and move them to mandir. -mkdir -p %{buildroot}/%{_mandir}/man1 -for f in %{build_install_prefix}/share/man/man1/*; do - filename=`basename $f | cut -f 1 -d '.'` - mv $f %{buildroot}%{_mandir}/man1/$filename%{exec_suffix}.1 -done - %endif -mkdir -p %{buildroot}%{pkg_datadir}/llvm/cmake -cp -Rv cmake/* %{buildroot}%{pkg_datadir}/llvm/cmake +mkdir -p %{buildroot}%{install_datadir}/llvm-cmake +cp -Rv cmake/* %{buildroot}%{install_datadir}/llvm-cmake # Install a placeholder to redirect users of the formerly shipped # HTML documentation to the upstream HTML documentation. @@ -1221,8 +1557,8 @@ EOF #region CLANG installation -# Add a symlink in /usr/bin to clang-format-diff -ln -s %{install_datadir}/clang/clang-format-diff.py %{buildroot}%{install_bindir}/clang-format-diff +# Add a symlink in bindir to clang-format-diff +ln -s ../share/clang/clang-format-diff.py %{buildroot}%{install_bindir}/clang-format-diff # 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 @@ -1244,7 +1580,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}%{_prefix}/lib/{libear,libscanbuild} %{buildroot}%{python3_sitelib} +mv %{buildroot}%{install_libdir}/{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 @@ -1252,37 +1588,22 @@ mv %{buildroot}%{_prefix}/lib/{libear,libscanbuild} %{buildroot}%{python3_siteli # Move emacs integration files to the correct directory mkdir -p %{buildroot}%{_emacs_sitestartdir} for f in clang-format.el clang-include-fixer.el; do -mv %{buildroot}{%{_datadir}/clang,%{_emacs_sitestartdir}}/$f +mv %{buildroot}{%{install_datadir}/clang,%{_emacs_sitestartdir}}/$f done -%if %{maj_ver} < 20 -mv %{buildroot}{%{_datadir}/clang,%{_emacs_sitestartdir}}/clang-rename.el -%endif - -# Add clang++-{version} symlink -ln -s clang++ %{buildroot}%{_bindir}/clang++-%{maj_ver} %else -# Fix permission -chmod u-x %{buildroot}%{_mandir}/man1/scan-build%{exec_suffix}.1* - # Not sure where to put these python modules for the compat build. rm -Rf %{buildroot}%{install_libdir}/{libear,libscanbuild} +rm %{buildroot}%{install_bindir}/scan-build-py # Not sure where to put the emacs integration files for the compat build. rm -Rf %{buildroot}%{install_datadir}/clang/*.el -# Add clang++-{version} symlink -ln -s clang++ %{buildroot}%{install_bindir}/clang++-%{maj_ver} - %endif -# Create Manpage symlinks -ln -s clang%{exec_suffix}.1.gz %{buildroot}%{_mandir}/man1/clang++%{exec_suffix}.1.gz -%if %{without compat_build} -ln -s clang.1.gz %{buildroot}%{_mandir}/man1/clang-%{maj_ver}.1.gz -ln -s clang.1.gz %{buildroot}%{_mandir}/man1/clang++-%{maj_ver}.1.gz -%endif +# Create manpage symlink for clang++ +ln -s clang-%{maj_ver}.1 %{buildroot}%{install_mandir}/man1/clang++.1 # Fix permissions of scan-view scripts chmod a+x %{buildroot}%{install_datadir}/scan-view/{Reporter.py,startfile.py} @@ -1295,8 +1616,7 @@ rm -vf %{buildroot}%{install_datadir}/clang/clang-format-bbedit.applescript rm -vf %{buildroot}%{install_datadir}/clang/clang-format-sublime.py* # Remove unpackaged files -rm -Rvf %{buildroot}%{install_datadir}/clang-doc/clang-doc-default-stylesheet.css -rm -Rvf %{buildroot}%{install_datadir}/clang-doc/index.js +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 @@ -1309,19 +1629,6 @@ mkdir -p %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/{bin,include,lib,share}/ mkdir -p %{buildroot}%{_rpmmacrodir}/ echo "%%clang%{maj_ver}_resource_dir %%{_prefix}/lib/clang/%{maj_ver}" >> %{buildroot}%{_rpmmacrodir}/macros.%{pkg_name_clang} -# Install config file for clang -%if %{maj_ver} >=18 -%global cfg_file_content --gcc-triple=%{_target_cpu}-redhat-linux - -# We want to use DWARF-5 on all snapshot builds. -%if %{without snapshot_build} && %{defined rhel} && 0%{?rhel} < 10 -%global cfg_file_content %{cfg_file_content} -gdwarf-4 -g0 -%endif - -%if %{defined gts_version} -%global cfg_file_content %{cfg_file_content} --gcc-install-dir=/opt/rh/gcc-toolset-%{gts_version}/root/%{_exec_prefix}/lib/gcc/%{_target_cpu}-redhat-linux/%{gts_version} -%endif - mkdir -p %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/ echo " %{cfg_file_content}" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-clang.cfg echo " %{cfg_file_content}" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-clang++.cfg @@ -1330,7 +1637,6 @@ echo " %{cfg_file_content}" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/%{_t echo " %{cfg_file_content}" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/i386-redhat-linux-gnu-clang.cfg echo " %{cfg_file_content}" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/i386-redhat-linux-gnu-clang++.cfg %endif -%endif #endregion CLANG installation @@ -1371,11 +1677,7 @@ rm -rf %{buildroot}/%{install_datadir}/gdb %ifnarch %{ix86} # Remove files that we don't package, yet. -%if %{maj_ver} >= 20 rm %{buildroot}%{install_bindir}/llvm-offload-device-info -%else -rm %{buildroot}%{install_bindir}/llvm-omp-device-info -%endif rm %{buildroot}%{install_bindir}/llvm-omp-kernel-replay %endif @@ -1387,60 +1689,122 @@ rm %{buildroot}%{install_bindir}/llvm-omp-kernel-replay # Required when using update-alternatives: # https://docs.fedoraproject.org/en-US/packaging-guidelines/Alternatives/ touch %{buildroot}%{_bindir}/ld - -install -D -m 644 -t %{buildroot}%{_mandir}/man1/ lld/docs/ld.lld.1 %endif +install -D -m 644 -t %{buildroot}%{install_mandir}/man1/ lld/docs/ld.lld.1 + #endregion LLD installation #region LLDB installation %if %{with lldb} %multilib_fix_c_header --file %{install_includedir}/lldb/Host/Config.h +%if %{without compat_build} +# Move python package out of llvm prefix. +mkdir -p %{buildroot}%{python3_sitearch} +mv %{buildroot}%{install_prefix}/%{_lib}/python%{python3_version}/site-packages/lldb %{buildroot}/%{python3_sitearch} +rmdir %{buildroot}%{install_prefix}/%{_lib}/python%{python3_version}/site-packages +rmdir %{buildroot}%{install_prefix}/%{_lib}/python%{python3_version} + # python: fix binary libraries location -liblldb=$(basename $(readlink -e %{buildroot}%{_libdir}/liblldb.so)) -ln -vsf "../../../${liblldb}" %{buildroot}%{python3_sitearch}/lldb/_lldb.so +liblldb=$(basename $(readlink -e %{buildroot}%{install_libdir}/liblldb.so)) +ln -vsf "../../../llvm%{maj_ver}/lib/${liblldb}" %{buildroot}%{python3_sitearch}/lldb/_lldb.so %py_byte_compile %{__python3} %{buildroot}%{python3_sitearch}/lldb %endif +%endif #endregion LLDB installation -%if %{with compat_build} -# Add version suffix to binaries. Do this at the end so it includes any -# additional binaries that may be been added by other steps. -for f in %{buildroot}/%{install_bindir}/*; do +#region mlir installation +%if %{with mlir} +mkdir -p %{buildroot}/%{python3_sitearch} +mv %{buildroot}%{install_prefix}/python_packages/mlir_core/mlir %{buildroot}/%{python3_sitearch} +# These directories should be empty now. +rmdir %{buildroot}%{install_prefix}/python_packages/mlir_core %{buildroot}%{install_prefix}/python_packages +# Unneeded files. +rm -rf %{buildroot}%{install_prefix}/src/python +%endif +#endregion mlir installation + +#region libcxx installation +%if %{with libcxx} +# We can't install the unversionned path on default location because that would conflict with +# https://src.fedoraproject.org/rpms/libunwind +# +# The versionned path has a different soname (libunwind.so.1 compared to +# libunwind.so.8) so they can live together in %%{_libdir} +# +# ABI wise, even though llvm-libunwind's library is named libunwind, it doesn't +# have the exact same ABI as gcc's libunwind (it actually provides a subset). +rm %{buildroot}%{_libdir}/libunwind.so +mkdir -p %{buildroot}/%{_libdir}/llvm-unwind/ + +pushd %{buildroot}/%{_libdir}/llvm-unwind +ln -s ../libunwind.so.1.0 libunwind.so +popd +%endif +#endregion libcxx installation + +#region BOLT installation +# We don't ship libLLVMBOLT*.a +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 echo $filename | grep -e '%{maj_ver}'; then + if [[ "$filename" == "clang-%{maj_ver}" ]]; then continue fi - ln -s ../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename%{exec_suffix} + # 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 -%endif -# llvm-config special casing. llvm-config is managed by update-alternatives. -# the original file must remain available for compatibility with the CMake -# infrastructure. Without compat, cmake points to the symlink, with compat it -# points to the original file. +# 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() { + local src="$1" + local dest="$2" + mkdir -p "$dest" -mv %{buildroot}/%{install_bindir}/llvm-config %{buildroot}/%{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} -# We still maintain a versionned symlink for consistency across llvm versions. -# This is specific to the non-compat build and matches the exec prefix for -# compat builds. An isa-agnostic versionned symlink is also maintained in the (un)install -# steps. -(cd %{buildroot}/%{install_bindir} ; ln -s llvm-config%{exec_suffix}-%{__isa_bits} llvm-config-%{maj_ver}-%{__isa_bits} ) -# ghost presence -touch %{buildroot}%{_bindir}/llvm-config-%{maj_ver} - -%else - -rm %{buildroot}%{_bindir}/llvm-config%{exec_suffix} -(cd %{buildroot}/%{install_bindir} ; ln -s llvm-config llvm-config%{exec_suffix}-%{__isa_bits} ) + # 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} %endif -# ghost presence -touch %{buildroot}%{_bindir}/llvm-config%{exec_suffix} +# ghost presence for llvm-config, managed by alternatives. +touch %{buildroot}%{_bindir}/llvm-config-%{maj_ver} +%if %{without compat_build} +touch %{buildroot}%{_bindir}/llvm-config +%endif %if %{with bundle_compat_lib} install -m 0755 ../llvm-compat-libs/lib/libLLVM.so.%{compat_maj_ver}* %{buildroot}%{_libdir} @@ -1464,17 +1828,14 @@ rm llvm/test/tools/gold/PowerPC/mtriple.ll # TODO(kkleine): Add this to XFAIL instead? rm llvm/test/tools/dsymutil/X86/swift-interface.test -%if %{with check} - cd llvm +%if %{with check} + #region Helper functions # Call this function before setting up a next component to test. function reset_test_opts() { - # Some libraries will not be found if we don't set this - export LD_LIBRARY_PATH="%{buildroot}/%{install_libdir}:%{buildroot}/%{_libdir}"; - # See https://llvm.org/docs/CommandGuide/lit.html#general-options export LIT_OPTS="-vv --time-tests" @@ -1495,6 +1856,9 @@ function reset_test_opts() # Set for filtering out unit tests. # See http://google.github.io/googletest/advanced.html#running-a-subset-of-the-tests unset GTEST_FILTER + + # Some test (e.g. mlir) require this to be set. + unset PYTHONPATH } # Convert array of test names into a regex. @@ -1521,6 +1885,21 @@ function test_list_to_regex() # Add enclosing parenthesis echo "($arr)" } + +# Similar to test_list_to_regex() except that this function exports +# the LIT_FILTER_OUT if there are tests in the given list. +# If there are no tests, the LIT_FILTER_OUT is unset in order to +# avoid issues with the llvm test system. +function adjust_lit_filter_out() +{ + local -n arr=$1 + local res=$(test_list_to_regex test_list_filter_out) + if [[ "$res" != "()" ]]; then + export LIT_FILTER_OUT=$res + else + unset LIT_FILTER_OUT + fi +} #endregion Helper functions #region Test LLVM lit @@ -1595,6 +1974,7 @@ 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") # These tests fail more often than not, but not always. test_list_filter_out+=("libomp :: worksharing/for/omp_collapse_many_GELTGT_int.c") @@ -1602,13 +1982,18 @@ 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") +# 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") + %ifarch s390x test_list_filter_out+=("libomp :: flush/omp_flush.c") test_list_filter_out+=("libomp :: worksharing/for/omp_for_schedule_guided.c") %endif %ifarch aarch64 s390x -# The following test has been failling intermittently on aarch64 and 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") @@ -1654,7 +2039,6 @@ export LIT_XFAIL="$LIT_XFAIL;races/lock-unrelated.c" export LIT_XFAIL="$LIT_XFAIL;races/parallel-simple.c" 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-taskwait-nested.c" export LIT_XFAIL="$LIT_XFAIL;races/task-two.c" export LIT_XFAIL="$LIT_XFAIL;races/taskwait-depend.c" export LIT_XFAIL="$LIT_XFAIL;reduction/parallel-reduction-nowait.c" @@ -1713,7 +2097,7 @@ export LIT_XFAIL="$LIT_XFAIL;offloading/thread_state_1.c" export LIT_XFAIL="$LIT_XFAIL;offloading/thread_state_2.c" %endif -export LIT_FILTER_OUT=$(test_list_to_regex test_list_filter_out) +adjust_lit_filter_out test_list_filter_out %if 0%{?rhel} # libomp tests are often very slow on s390x brew builders @@ -1746,17 +2130,91 @@ export LIT_FILTER_OUT=$(test_list_to_regex test_list_filter_out) %endif %endif +#region test libcxx +# TODO(kkleine): Fedora rawhide didn't contain check runs. Evaluate if we want them here. +#endregion test libcxx + #region Test LLD reset_test_opts %cmake_build --target check-lld #endregion Test LLD +#region Test MLIR +%if %{with mlir} +reset_test_opts + +%ifarch s390x +# s390x does not support half-float +test_list_filter_out+=("MLIR :: python/ir/array_attributes.py") +test_list_filter_out+=("MLIR :: python/execution_engine.py") +%endif + +%ifarch ppc64le +# Medium code model can result in relocation failures, see: +# https://github.com/llvm/llvm-project/issues/129499 + +# Additionally, support for converting to/from fp16 was added on +# Power9 processors (aka. Power ISA 3.0). Even if the above issue +# is fixed, avoid running execution_engine.py on servers that do +# not support this ISA level, using the following condition: +# if ! LD_SHOW_AUXV=1 /bin/true | grep -q arch_3_00; then +test_list_filter_out+=("MLIR :: python/execution_engine.py") +test_list_filter_out+=("MLIR :: python/multithreaded_tests.py") +%endif + +adjust_lit_filter_out test_list_filter_out + +export PYTHONPATH=%{buildroot}/%{python3_sitearch} +%cmake_build --target check-mlir +%endif +#endregion Test MLIR + +#region BOLT tests +%if %{with build_bolt} +reset_test_opts + +# Beginning with LLVM 20 this test has the "non-root-user" requirement +# and then the test should pass. But now it is flaky, hence we can only +# filter it out. +test_list_filter_out+=("BOLT :: unreadable-profile.test") + +%ifarch aarch64 +# Failing test cases on aarch64 +# TODO(kkleine): The following used to fail on aarch64 but passed today. +#export LIT_XFAIL="$LIT_XFAIL;cache+-deprecated.test" +#export LIT_XFAIL="$LIT_XFAIL;bolt-icf.test" +#export LIT_XFAIL="$LIT_XFAIL;R_ABS.pic.lld.cpp" + +# The following tests require LSE in order to run. +# More info at: https://github.com/llvm/llvm-project/issues/86485 +if ! grep -q atomics /proc/cpuinfo; then + test_list_filter_out+=("BOLT :: runtime/AArch64/basic-instrumentation.test") + test_list_filter_out+=("BOLT :: runtime/AArch64/hook-fini.test") + test_list_filter_out+=("BOLT :: runtime/AArch64/instrumentation-ind-call.c") + test_list_filter_out+=("BOLT :: runtime/exceptions-instrumentation.test") + test_list_filter_out+=("BOLT :: runtime/instrumentation-indirect-2.c") + test_list_filter_out+=("BOLT :: runtime/pie-exceptions-split.test") +fi +%endif + +%cmake_build --target check-bolt +%endif +#endregion BOLT tests + +#region polly tests +%if %{with polly} +reset_test_opts +%cmake_build --target check-polly +%endif +#endregion polly tests + + %endif %if %{with snapshot_build} # Do this here instead of in install so the check targets are also included. -cp %{_vpath_builddir}/.ninja_log %{buildroot}%{pkg_datadir} +cp %{_vpath_builddir}/.ninja_log %{buildroot}%{_datadir} %endif #endregion check @@ -1769,9 +2227,9 @@ cp %{_vpath_builddir}/.ninja_log %{buildroot}%{pkg_datadir} %endif %post -n %{pkg_name_llvm}-devel -%{_sbindir}/update-alternatives --install %{_bindir}/llvm-config%{exec_suffix} llvm-config%{exec_suffix} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} %{__isa_bits} +update-alternatives --install %{_bindir}/llvm-config-%{maj_ver} llvm-config-%{maj_ver} %{install_bindir}/llvm-config %{__isa_bits} %if %{without compat_build} -%{_sbindir}/update-alternatives --install %{_bindir}/llvm-config-%{maj_ver} llvm-config-%{maj_ver} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} %{__isa_bits} +update-alternatives --install %{_bindir}/llvm-config llvm-config %{install_bindir}/llvm-config %{__isa_bits} # 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. @@ -1779,14 +2237,14 @@ cp %{_vpath_builddir}/.ninja_log %{buildroot}%{pkg_datadir} for v in 14 15 16; do if [[ -e %{_bindir}/llvm-config-$v && "x$(%{_bindir}/llvm-config-$v --version | awk -F . '{ print $1 }')" != "x$v" ]]; then - %{_sbindir}/update-alternatives --remove llvm-config-$v %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} + update-alternatives --remove llvm-config-$v %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} fi done %endif %postun -n %{pkg_name_llvm}-devel if [ $1 -eq 0 ]; then - %{_sbindir}/update-alternatives --remove llvm-config%{exec_suffix} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} + 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 @@ -1796,22 +2254,62 @@ fi # compat package. if [[ $1 -eq 0 || "x$(%{_bindir}/llvm-config%{exec_suffix} --version | awk -F . '{ print $1 }')" != "x%{maj_ver}" ]]; then - %{_sbindir}/update-alternatives --remove llvm-config-%{maj_ver} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} + update-alternatives --remove llvm-config-%{maj_ver} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} fi %endif %if %{without compat_build} %post -n %{pkg_name_lld} -%{_sbindir}/update-alternatives --install %{_bindir}/ld ld %{_bindir}/ld.lld 1 +update-alternatives --install %{_bindir}/ld ld %{_bindir}/ld.lld 1 %postun -n %{pkg_name_lld} if [ $1 -eq 0 ] ; then - %{_sbindir}/update-alternatives --remove ld %{_bindir}/ld.lld + update-alternatives --remove ld %{_bindir}/ld.lld fi %endif #endregion misc #region files +%define expand_bins() %{lua: + local bindir = rpm.expand("%{_bindir}") + local install_bindir = rpm.expand("%{install_bindir}") + local maj_ver = rpm.expand("%{maj_ver}") + for arg in rpm.expand("%*"):gmatch("%S+") do + print(install_bindir .. "/" .. arg .. "\\n") + print(bindir .. "/" .. arg .. "-" .. maj_ver .. "\\n") + if rpm.expand("%{without compat_build}") == "1" then + print(bindir .. "/" .. arg .. "\\n") + end + end +} + +%define expand_mans() %{lua: + local mandir = rpm.expand("%{_mandir}") + local maj_ver = rpm.expand("%{maj_ver}") + for arg in rpm.expand("%*"):gmatch("%S+") do + print(mandir .. "/man1/" .. arg .. "-" .. maj_ver .. ".1.gz\\n") + if rpm.expand("%{without compat_build}") == "1" then + print(mandir .. "/man1/" .. arg .. ".1.gz\\n") + end + end +} + +%define expand_generic(d:i:) %{lua: + local dir = rpm.expand("%{-d*}") + local install_dir = rpm.expand("%{-i*}") + for arg in rpm.expand("%*"):gmatch("%S+") do + print(install_dir .. "/" .. arg .. "\\n") + if rpm.expand("%{without compat_build}") == "1" then + print(dir .. "/" .. arg .. "\\n") + end + end +} + +%define expand_libs() %{expand_generic -d %{_libdir} -i %{install_libdir} %*} +%define expand_libexecs() %{expand_generic -d %{_libexecdir} -i %{install_libexecdir} %*} +%define expand_includes() %{expand_generic -d %{_includedir} -i %{install_includedir} %*} +%define expand_datas() %{expand_generic -d %{_datadir} -i %{install_datadir} %*} + #region LLVM lit files %if %{with python_lit} %files -n python%{python3_pkgversion}-lit @@ -1825,276 +2323,189 @@ fi #region LLVM files +%files -n %{pkg_name_llvm}-filesystem +%dir %{install_prefix} +%dir %{install_bindir} +%dir %{install_includedir} +%dir %{install_libdir} +%dir %{install_libdir}/cmake +%dir %{install_libexecdir} +%dir %{install_datadir} + %files -n %{pkg_name_llvm} %license llvm/LICENSE.TXT -%exclude %{_mandir}/man1/llvm-config* -%{_mandir}/man1/bugpoint%{exec_suffix}.1.gz -%{_mandir}/man1/clang-tblgen%{exec_suffix}.1.gz -%{_mandir}/man1/dsymutil%{exec_suffix}.1.gz -%{_mandir}/man1/FileCheck%{exec_suffix}.1.gz -%{_mandir}/man1/lit%{exec_suffix}.1.gz -%{_mandir}/man1/llc%{exec_suffix}.1.gz -%{_mandir}/man1/lldb-tblgen%{exec_suffix}.1.gz -%{_mandir}/man1/lli%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-addr2line%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-ar%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-as%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-bcanalyzer%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-cov%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-cxxfilt%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-cxxmap%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-debuginfo-analyzer%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-diff%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-dis%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-dwarfdump%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-dwarfutil%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-exegesis%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-extract%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-ifs%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-install-name-tool%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-lib%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-libtool-darwin%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-link%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-lipo%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-locstats%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-mc%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-mca%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-nm%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-objcopy%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-objdump%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-opt-report%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-otool%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-pdbutil%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-profdata%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-profgen%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-ranlib%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-readelf%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-readobj%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-reduce%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-remarkutil%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-size%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-stress%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-strings%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-strip%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-symbolizer%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-tblgen%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-tli-checker%{exec_suffix}.1.gz -%{_mandir}/man1/mlir-tblgen%{exec_suffix}.1.gz -%{_mandir}/man1/opt%{exec_suffix}.1.gz -%{_mandir}/man1/tblgen%{exec_suffix}.1.gz -%if %{maj_ver} >= 20 -%{_mandir}/man1/llvm-cgdata%{exec_suffix}.1.gz +%{expand_bins %{expand: + bugpoint + dsymutil + FileCheck + llc + lli + llvm-addr2line + llvm-ar + llvm-as + llvm-bcanalyzer + llvm-bitcode-strip + llvm-c-test + llvm-cat + llvm-cfi-verify + llvm-cgdata + llvm-cov + llvm-ctxprof-util + llvm-cvtres + llvm-cxxdump + llvm-cxxfilt + llvm-cxxmap + llvm-debuginfo-analyzer + llvm-debuginfod + llvm-debuginfod-find + llvm-diff + llvm-dis + llvm-dlltool + llvm-dwarfdump + llvm-dwarfutil + llvm-dwp + llvm-exegesis + llvm-extract + llvm-gsymutil + llvm-ifs + llvm-install-name-tool + llvm-jitlink + llvm-jitlink-executor + llvm-lib + llvm-libtool-darwin + llvm-link + llvm-lipo + llvm-lto + llvm-lto2 + llvm-mc + llvm-mca + llvm-ml + llvm-modextract + llvm-mt + llvm-nm + llvm-objcopy + llvm-objdump + llvm-opt-report + llvm-otool + llvm-pdbutil + llvm-PerfectShuffle + llvm-profdata + llvm-profgen + llvm-ranlib + llvm-rc + llvm-readelf + llvm-readobj + llvm-readtapi + llvm-reduce + llvm-remarkutil + llvm-rtdyld + llvm-sim + llvm-size + llvm-split + llvm-stress + llvm-strings + llvm-strip + llvm-symbolizer + llvm-tblgen + llvm-tli-checker + llvm-undname + llvm-windres + llvm-xray + reduce-chunk-list + obj2yaml + opt + sancov + sanstats + split-file + UnicodeNameMappingGenerator + verify-uselistorder + yaml2obj +}} + +%if %{maj_ver} >= 21 +%{expand_bins %{expand: + llvm-ml64 +}} %endif -%{install_bindir}/bugpoint -%{install_bindir}/dsymutil -%{install_bindir}/FileCheck -%{install_bindir}/llc -%{install_bindir}/lli -%{install_bindir}/llvm-addr2line -%{install_bindir}/llvm-ar -%{install_bindir}/llvm-as -%{install_bindir}/llvm-bcanalyzer -%{install_bindir}/llvm-bitcode-strip -%{install_bindir}/llvm-c-test -%{install_bindir}/llvm-cat -%{install_bindir}/llvm-cfi-verify -%{install_bindir}/llvm-cov -%{install_bindir}/llvm-cvtres -%{install_bindir}/llvm-cxxdump -%{install_bindir}/llvm-cxxfilt -%{install_bindir}/llvm-cxxmap -%{install_bindir}/llvm-debuginfo-analyzer -%{install_bindir}/llvm-debuginfod -%{install_bindir}/llvm-debuginfod-find -%{install_bindir}/llvm-diff -%{install_bindir}/llvm-dis -%{install_bindir}/llvm-dlltool -%{install_bindir}/llvm-dwarfdump -%{install_bindir}/llvm-dwarfutil -%{install_bindir}/llvm-dwp -%{install_bindir}/llvm-exegesis -%{install_bindir}/llvm-extract -%{install_bindir}/llvm-gsymutil -%{install_bindir}/llvm-ifs -%{install_bindir}/llvm-install-name-tool -%{install_bindir}/llvm-jitlink -%{install_bindir}/llvm-jitlink-executor -%{install_bindir}/llvm-lib -%{install_bindir}/llvm-libtool-darwin -%{install_bindir}/llvm-link -%{install_bindir}/llvm-lipo -%{install_bindir}/llvm-lto -%{install_bindir}/llvm-lto2 -%{install_bindir}/llvm-mc -%{install_bindir}/llvm-mca -%{install_bindir}/llvm-ml -%{install_bindir}/llvm-modextract -%{install_bindir}/llvm-mt -%{install_bindir}/llvm-nm -%{install_bindir}/llvm-objcopy -%{install_bindir}/llvm-objdump -%{install_bindir}/llvm-opt-report -%{install_bindir}/llvm-otool -%{install_bindir}/llvm-pdbutil -%{install_bindir}/llvm-PerfectShuffle -%{install_bindir}/llvm-profdata -%{install_bindir}/llvm-profgen -%{install_bindir}/llvm-ranlib -%{install_bindir}/llvm-rc -%{install_bindir}/llvm-readelf -%{install_bindir}/llvm-readobj -%{install_bindir}/llvm-readtapi -%{install_bindir}/llvm-reduce -%{install_bindir}/llvm-remarkutil -%{install_bindir}/llvm-rtdyld -%{install_bindir}/llvm-sim -%{install_bindir}/llvm-size -%{install_bindir}/llvm-split -%{install_bindir}/llvm-stress -%{install_bindir}/llvm-strings -%{install_bindir}/llvm-strip -%{install_bindir}/llvm-symbolizer -%{install_bindir}/llvm-tblgen -%{install_bindir}/llvm-tli-checker -%{install_bindir}/llvm-undname -%{install_bindir}/llvm-windres -%{install_bindir}/llvm-xray -%{install_bindir}/reduce-chunk-list -%{install_bindir}/obj2yaml -%{install_bindir}/opt -%{install_bindir}/sancov -%{install_bindir}/sanstats -%{install_bindir}/split-file -%{install_bindir}/UnicodeNameMappingGenerator -%{install_bindir}/verify-uselistorder -%{install_bindir}/yaml2obj -%if %{maj_ver} >= 20 -%{install_bindir}/llvm-cgdata -%{install_bindir}/llvm-ctxprof-util -%endif +%{expand_mans %{expand: + bugpoint + clang-tblgen + dsymutil + FileCheck + lit + llc + lldb-tblgen + lli + llvm-addr2line + llvm-ar + llvm-as + llvm-bcanalyzer + llvm-cgdata + llvm-cov + llvm-cxxfilt + llvm-cxxmap + llvm-debuginfo-analyzer + llvm-diff + llvm-dis + llvm-dwarfdump + llvm-dwarfutil + llvm-exegesis + llvm-extract + llvm-ifs + llvm-install-name-tool + llvm-lib + llvm-libtool-darwin + llvm-link + llvm-lipo + llvm-locstats + llvm-mc + llvm-mca + llvm-nm + llvm-objcopy + llvm-objdump + llvm-opt-report + llvm-otool + llvm-pdbutil + llvm-profdata + llvm-profgen + llvm-ranlib + llvm-readelf + llvm-readobj + llvm-reduce + llvm-remarkutil + llvm-size + llvm-stress + llvm-strings + llvm-strip + llvm-symbolizer + llvm-tblgen + llvm-tli-checker + mlir-tblgen + opt + tblgen +}} - -%if %{with compat_build} -# This is for all the binaries with the version suffix. -%{_bindir}/bugpoint%{exec_suffix} -%{_bindir}/dsymutil%{exec_suffix} -%{_bindir}/FileCheck%{exec_suffix} -%{_bindir}/llc%{exec_suffix} -%{_bindir}/lli%{exec_suffix} -%{_bindir}/llvm-addr2line%{exec_suffix} -%{_bindir}/llvm-ar%{exec_suffix} -%{_bindir}/llvm-as%{exec_suffix} -%{_bindir}/llvm-bcanalyzer%{exec_suffix} -%{_bindir}/llvm-bitcode-strip%{exec_suffix} -%{_bindir}/llvm-c-test%{exec_suffix} -%{_bindir}/llvm-cat%{exec_suffix} -%{_bindir}/llvm-cfi-verify%{exec_suffix} -%{_bindir}/llvm-cov%{exec_suffix} -%{_bindir}/llvm-cvtres%{exec_suffix} -%{_bindir}/llvm-cxxdump%{exec_suffix} -%{_bindir}/llvm-cxxfilt%{exec_suffix} -%{_bindir}/llvm-cxxmap%{exec_suffix} -%{_bindir}/llvm-debuginfo-analyzer%{exec_suffix} -%{_bindir}/llvm-debuginfod%{exec_suffix} -%{_bindir}/llvm-debuginfod-find%{exec_suffix} -%{_bindir}/llvm-diff%{exec_suffix} -%{_bindir}/llvm-dis%{exec_suffix} -%{_bindir}/llvm-dlltool%{exec_suffix} -%{_bindir}/llvm-dwarfdump%{exec_suffix} -%{_bindir}/llvm-dwarfutil%{exec_suffix} -%{_bindir}/llvm-dwp%{exec_suffix} -%{_bindir}/llvm-exegesis%{exec_suffix} -%{_bindir}/llvm-extract%{exec_suffix} -%{_bindir}/llvm-gsymutil%{exec_suffix} -%{_bindir}/llvm-ifs%{exec_suffix} -%{_bindir}/llvm-install-name-tool%{exec_suffix} -%{_bindir}/llvm-jitlink%{exec_suffix} -%{_bindir}/llvm-jitlink-executor%{exec_suffix} -%{_bindir}/llvm-lib%{exec_suffix} -%{_bindir}/llvm-libtool-darwin%{exec_suffix} -%{_bindir}/llvm-link%{exec_suffix} -%{_bindir}/llvm-lipo%{exec_suffix} -%{_bindir}/llvm-lto%{exec_suffix} -%{_bindir}/llvm-lto2%{exec_suffix} -%{_bindir}/llvm-mc%{exec_suffix} -%{_bindir}/llvm-mca%{exec_suffix} -%{_bindir}/llvm-ml%{exec_suffix} -%{_bindir}/llvm-modextract%{exec_suffix} -%{_bindir}/llvm-mt%{exec_suffix} -%{_bindir}/llvm-nm%{exec_suffix} -%{_bindir}/llvm-objcopy%{exec_suffix} -%{_bindir}/llvm-objdump%{exec_suffix} -%{_bindir}/llvm-opt-report%{exec_suffix} -%{_bindir}/llvm-otool%{exec_suffix} -%{_bindir}/llvm-pdbutil%{exec_suffix} -%{_bindir}/llvm-PerfectShuffle%{exec_suffix} -%{_bindir}/llvm-profdata%{exec_suffix} -%{_bindir}/llvm-profgen%{exec_suffix} -%{_bindir}/llvm-ranlib%{exec_suffix} -%{_bindir}/llvm-rc%{exec_suffix} -%{_bindir}/llvm-readelf%{exec_suffix} -%{_bindir}/llvm-readobj%{exec_suffix} -%{_bindir}/llvm-readtapi%{exec_suffix} -%{_bindir}/llvm-reduce%{exec_suffix} -%{_bindir}/llvm-remarkutil%{exec_suffix} -%{_bindir}/llvm-rtdyld%{exec_suffix} -%{_bindir}/llvm-sim%{exec_suffix} -%{_bindir}/llvm-size%{exec_suffix} -%{_bindir}/llvm-split%{exec_suffix} -%{_bindir}/llvm-stress%{exec_suffix} -%{_bindir}/llvm-strings%{exec_suffix} -%{_bindir}/llvm-strip%{exec_suffix} -%{_bindir}/llvm-symbolizer%{exec_suffix} -%{_bindir}/llvm-tblgen%{exec_suffix} -%{_bindir}/llvm-tli-checker%{exec_suffix} -%{_bindir}/llvm-undname%{exec_suffix} -%{_bindir}/llvm-windres%{exec_suffix} -%{_bindir}/llvm-xray%{exec_suffix} -%{_bindir}/reduce-chunk-list%{exec_suffix} -%{_bindir}/obj2yaml%{exec_suffix} -%{_bindir}/opt%{exec_suffix} -%{_bindir}/sancov%{exec_suffix} -%{_bindir}/sanstats%{exec_suffix} -%{_bindir}/split-file%{exec_suffix} -%{_bindir}/UnicodeNameMappingGenerator%{exec_suffix} -%{_bindir}/verify-uselistorder%{exec_suffix} -%{_bindir}/yaml2obj%{exec_suffix} -%if %{maj_ver} >= 20 -%{_bindir}/llvm-cgdata%{exec_suffix} -%{_bindir}/llvm-ctxprof-util%{exec_suffix} -%endif - -%endif - -%exclude %{_bindir}/llvm-config%{exec_suffix} -%exclude %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} - -%exclude %{_bindir}/llvm-config-%{maj_ver} -%exclude %{install_bindir}/llvm-config-%{maj_ver}-%{__isa_bits} -%exclude %{install_bindir}/not -%exclude %{install_bindir}/count -%exclude %{install_bindir}/yaml-bench -%exclude %{install_bindir}/lli-child-target -%exclude %{install_bindir}/llvm-isel-fuzzer -%exclude %{install_bindir}/llvm-opt-fuzzer -%{pkg_datadir}/opt-viewer +%expand_datas opt-viewer %files -n %{pkg_name_llvm}-libs %license llvm/LICENSE.TXT -%{install_libdir}/libLLVM-%{maj_ver}%{?llvm_snapshot_version_suffix}.so +%{expand_libs %{expand: + libLLVM-%{maj_ver}%{?llvm_snapshot_version_suffix}.so + libLLVM.so.%{maj_ver}.%{min_ver}%{?llvm_snapshot_version_suffix} + libLTO.so* + libRemarks.so* +}} %if %{with gold} -%{install_libdir}/LLVMgold.so +%expand_libs LLVMgold.so %if %{without compat_build} %{_libdir}/bfd-plugins/LLVMgold.so %endif %endif -%{install_libdir}/libLLVM.so.%{maj_ver}.%{min_ver}%{?llvm_snapshot_version_suffix} -%{install_libdir}/libLTO.so* -%{install_libdir}/libRemarks.so* + %if %{with compat_build} -%config(noreplace) /etc/ld.so.conf.d/%{name}-%{_arch}.conf +%config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{pkg_name_llvm}-%{_arch}.conf %endif %if %{with bundle_compat_lib} %{_libdir}/libLLVM.so.%{compat_maj_ver}* @@ -2103,20 +2514,18 @@ fi %files -n %{pkg_name_llvm}-devel %license llvm/LICENSE.TXT +%{install_bindir}/llvm-config +%ghost %{_bindir}/llvm-config-%{maj_ver} %if %{without compat_build} %ghost %{_bindir}/llvm-config -%{install_bindir}/llvm-config-%{__isa_bits} -%else -%{install_bindir}/llvm-config %endif -%ghost %{_bindir}/llvm-config-%{maj_ver} -%{install_bindir}/llvm-config-%{maj_ver}-%{__isa_bits} -%{_mandir}/man1/llvm-config* -%{install_includedir}/llvm -%{install_includedir}/llvm-c -%{install_libdir}/libLLVM.so -%{install_libdir}/cmake/llvm +%expand_mans llvm-config +%expand_includes llvm llvm-c +%{expand_libs %{expand: + libLLVM.so + cmake/llvm +}} %files -n %{pkg_name_llvm}-doc %license llvm/LICENSE.TXT @@ -2124,43 +2533,42 @@ fi %files -n %{pkg_name_llvm}-static %license llvm/LICENSE.TXT -%{install_libdir}/libLLVM*.a +%expand_libs libLLVM*.a %exclude %{install_libdir}/libLLVMTestingSupport.a %exclude %{install_libdir}/libLLVMTestingAnnotations.a +%if %{without compat_build} +%exclude %{_libdir}/libLLVMTestingSupport.a +%exclude %{_libdir}/libLLVMTestingAnnotations.a +%endif %files -n %{pkg_name_llvm}-cmake-utils %license llvm/LICENSE.TXT -%{pkg_datadir}/llvm/cmake +%expand_datas llvm-cmake %files -n %{pkg_name_llvm}-test %license llvm/LICENSE.TXT -%{install_bindir}/not -%{install_bindir}/count -%{install_bindir}/yaml-bench -%{install_bindir}/lli-child-target -%{install_bindir}/llvm-isel-fuzzer -%{install_bindir}/llvm-opt-fuzzer -%if %{with compat_build} -%{_bindir}/not%{exec_suffix} -%{_bindir}/count%{exec_suffix} -%{_bindir}/yaml-bench%{exec_suffix} -%{_bindir}/lli-child-target%{exec_suffix} -%{_bindir}/llvm-isel-fuzzer%{exec_suffix} -%{_bindir}/llvm-opt-fuzzer%{exec_suffix} -%endif +%{expand_bins %{expand: + not + count + yaml-bench + lli-child-target + llvm-isel-fuzzer + llvm-opt-fuzzer +}} %files -n %{pkg_name_llvm}-googletest %license llvm/LICENSE.TXT -%{install_libdir}/libLLVMTestingSupport.a -%{install_libdir}/libLLVMTestingAnnotations.a -%{install_libdir}/libllvm_gtest.a -%{install_libdir}/libllvm_gtest_main.a -%{install_includedir}/llvm-gtest -%{install_includedir}/llvm-gmock +%{expand_libs %{expand: + libLLVMTestingSupport.a + libLLVMTestingAnnotations.a + libllvm_gtest.a + libllvm_gtest_main.a +}} +%expand_includes llvm-gtest llvm-gmock %if %{with snapshot_build} %files -n %{pkg_name_llvm}-build-stats -%{pkg_datadir}/.ninja_log +%{_datadir}/.ninja_log %endif #endregion LLVM files @@ -2169,35 +2577,37 @@ fi %files -n %{pkg_name_clang} %license clang/LICENSE.TXT -%{install_bindir}/clang -%{install_bindir}/clang++ +%{expand_bins %{expand: + clang + clang++ + clang-cl + clang-cpp + clang-scan-deps +}} %{install_bindir}/clang-%{maj_ver} -%{install_bindir}/clang++-%{maj_ver} -%{install_bindir}/clang-cl -%{install_bindir}/clang-cpp + %{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-clang.cfg %{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-clang++.cfg %ifarch x86_64 %{_sysconfdir}/%{pkg_name_clang}/i386-redhat-linux-gnu-clang.cfg %{_sysconfdir}/%{pkg_name_clang}/i386-redhat-linux-gnu-clang++.cfg %endif -%{_mandir}/man1/clang-%{maj_ver}.1.gz -%{_mandir}/man1/clang++-%{maj_ver}.1.gz -%if %{without compat_build} -%{_mandir}/man1/clang.1.gz -%{_mandir}/man1/clang++.1.gz -%else -%{_bindir}/clang-%{maj_ver} -%{_bindir}/clang++-%{maj_ver} -%{_bindir}/clang-cl-%{maj_ver} -%{_bindir}/clang-cpp-%{maj_ver} -%endif +%{expand_mans clang clang++} %files -n %{pkg_name_clang}-libs %license clang/LICENSE.TXT %{_prefix}/lib/clang/%{maj_ver}/include/* -%{install_libdir}/libclang.so.%{maj_ver}* -%{install_libdir}/libclang-cpp.so.%{maj_ver}* +# Part of compiler-rt: +%exclude %{_prefix}/lib/clang/%{maj_ver}/include/fuzzer +%exclude %{_prefix}/lib/clang/%{maj_ver}/include/orc +%exclude %{_prefix}/lib/clang/%{maj_ver}/include/profile +%exclude %{_prefix}/lib/clang/%{maj_ver}/include/sanitizer +%exclude %{_prefix}/lib/clang/%{maj_ver}/include/xray +# Part of libomp-devel: +%exclude %{_prefix}/lib/clang/%{maj_ver}/include/omp*.h + +%expand_libs libclang.so.%{maj_ver}* +%expand_libs libclang-cpp.so.%{maj_ver}* %if %{with bundle_compat_lib} %{_libdir}/libclang.so.%{compat_maj_ver}* %{_libdir}/libclang-cpp.so.%{compat_maj_ver}* @@ -2205,16 +2615,17 @@ fi %files -n %{pkg_name_clang}-devel %license clang/LICENSE.TXT -%{install_libdir}/libclang-cpp.so -%{install_libdir}/libclang.so -%{install_includedir}/clang/ -%{install_includedir}/clang-c/ -%{install_libdir}/cmake/clang -%{install_bindir}/clang-tblgen -%if %{with compat_build} -%{_bindir}/clang-tblgen-%{maj_ver} -%endif +%{expand_libs %{expand: + cmake/clang + libclang-cpp.so + libclang.so +}} +%expand_includes clang clang-c +%expand_bins clang-tblgen %dir %{install_datadir}/clang/ +%if %{without compat_build} +%dir %{_datadir}/clang +%endif %files -n %{pkg_name_clang}-resource-filesystem %license clang/LICENSE.TXT @@ -2228,141 +2639,89 @@ fi %files -n %{pkg_name_clang}-analyzer %license clang/LICENSE.TXT -%{install_bindir}/scan-view -%{install_bindir}/scan-build -%{install_bindir}/analyze-build -%{install_bindir}/intercept-build -%{install_bindir}/scan-build-py -%if %{with compat_build} -%{_bindir}/scan-view-%{maj_ver} -%{_bindir}/scan-build-%{maj_ver} -%{_bindir}/analyze-build-%{maj_ver} -%{_bindir}/intercept-build-%{maj_ver} -%{_bindir}/scan-build-py-%{maj_ver} -%endif -%{install_libexecdir}/ccc-analyzer -%{install_libexecdir}/c++-analyzer -%{install_libexecdir}/analyze-c++ -%{install_libexecdir}/analyze-cc -%{install_libexecdir}/intercept-c++ -%{install_libexecdir}/intercept-cc -%{install_datadir}/scan-view/ -%{install_datadir}/scan-build/ -%{_mandir}/man1/scan-build%{exec_suffix}.1.* +%{expand_bins %{expand: + scan-view + scan-build + analyze-build + intercept-build +}} +%{expand_libexecs %{expand: + ccc-analyzer + c++-analyzer + analyze-c++ + analyze-cc + intercept-c++ + intercept-cc +}} +%expand_datas scan-view scan-build +%expand_mans scan-build %if %{without compat_build} +%expand_bins scan-build-py %{python3_sitelib}/libear %{python3_sitelib}/libscanbuild %endif - %files -n %{pkg_name_clang}-tools-extra %license clang-tools-extra/LICENSE.TXT -%{install_bindir}/amdgpu-arch -%{install_bindir}/clang-apply-replacements -%{install_bindir}/clang-change-namespace -%{install_bindir}/clang-check -%{install_bindir}/clang-doc -%{install_bindir}/clang-extdef-mapping -%{install_bindir}/clang-format -%{install_bindir}/clang-include-cleaner -%{install_bindir}/clang-include-fixer -%{install_bindir}/clang-installapi -%{install_bindir}/clang-move -%{install_bindir}/clang-offload-bundler -%{install_bindir}/clang-offload-packager -%{install_bindir}/clang-linker-wrapper -%{install_bindir}/clang-nvlink-wrapper -%{install_bindir}/clang-query -%{install_bindir}/clang-refactor -%{install_bindir}/clang-reorder-fields -%{install_bindir}/clang-repl -%{install_bindir}/clang-scan-deps -%if %{maj_ver} >= 20 -%{install_bindir}/clang-sycl-linker -%endif -%{install_bindir}/clang-tidy -%{install_bindir}/clangd -%{install_bindir}/diagtool -%{install_bindir}/hmaptool -%{install_bindir}/nvptx-arch -%{install_bindir}/pp-trace -%{install_bindir}/c-index-test -%{install_bindir}/find-all-symbols -%{install_bindir}/modularize -%{install_bindir}/clang-format-diff -%{install_bindir}/run-clang-tidy -%if %{maj_ver} < 20 -%{install_bindir}/clang-pseudo -%{install_bindir}/clang-rename -%endif -%if %{with compat_build} -%{_bindir}/amdgpu-arch-%{maj_ver} -%{_bindir}/clang-apply-replacements-%{maj_ver} -%{_bindir}/clang-change-namespace-%{maj_ver} -%{_bindir}/clang-check-%{maj_ver} -%{_bindir}/clang-doc-%{maj_ver} -%{_bindir}/clang-extdef-mapping-%{maj_ver} -%{_bindir}/clang-format-%{maj_ver} -%{_bindir}/clang-include-cleaner-%{maj_ver} -%{_bindir}/clang-include-fixer-%{maj_ver} -%{_bindir}/clang-installapi-%{maj_ver} -%{_bindir}/clang-move-%{maj_ver} -%{_bindir}/clang-offload-bundler-%{maj_ver} -%{_bindir}/clang-offload-packager-%{maj_ver} -%{_bindir}/clang-linker-wrapper-%{maj_ver} -%{_bindir}/clang-nvlink-wrapper-%{maj_ver} -%{_bindir}/clang-query-%{maj_ver} -%{_bindir}/clang-refactor-%{maj_ver} -%{_bindir}/clang-reorder-fields-%{maj_ver} -%{_bindir}/clang-repl-%{maj_ver} -%{_bindir}/clang-scan-deps-%{maj_ver} -%if %{maj_ver} >= 20 -%{_bindir}/clang-sycl-linker-%{maj_ver} -%endif -%{_bindir}/clang-tidy-%{maj_ver} -%{_bindir}/clangd-%{maj_ver} -%{_bindir}/diagtool-%{maj_ver} -%{_bindir}/hmaptool-%{maj_ver} -%{_bindir}/nvptx-arch-%{maj_ver} -%{_bindir}/pp-trace-%{maj_ver} -%{_bindir}/c-index-test-%{maj_ver} -%{_bindir}/find-all-symbols-%{maj_ver} -%{_bindir}/modularize-%{maj_ver} -%{_bindir}/clang-format-diff-%{maj_ver} -%{_bindir}/run-clang-tidy-%{maj_ver} -%if %{maj_ver} < 20 -%{_bindir}/clang-pseudo-%{maj_ver} -%{_bindir}/clang-rename-%{maj_ver} -%endif -%else -%{_emacs_sitestartdir}/clang-format.el -%if %{maj_ver} < 20 -%{_emacs_sitestartdir}/clang-rename.el -%endif -%{_emacs_sitestartdir}/clang-include-fixer.el -%endif -%{_mandir}/man1/diagtool%{exec_suffix}.1.gz -%{_mandir}/man1/extraclangtools%{exec_suffix}.1.gz -%{install_datadir}/clang/clang-format.py* -%{install_datadir}/clang/clang-format-diff.py* -%{install_datadir}/clang/clang-include-fixer.py* -%{install_datadir}/clang/clang-tidy-diff.py* -%{install_datadir}/clang/run-find-all-symbols.py* -%if %{maj_ver} < 20 -%{install_datadir}/clang/clang-rename.py* +%{expand_bins %{expand: + amdgpu-arch + clang-apply-replacements + clang-change-namespace + clang-check + clang-doc + clang-extdef-mapping + clang-format + clang-include-cleaner + clang-include-fixer + clang-installapi + clang-move + clang-offload-bundler + clang-offload-packager + clang-linker-wrapper + clang-nvlink-wrapper + clang-query + clang-refactor + clang-reorder-fields + clang-repl + clang-sycl-linker + clang-tidy + clangd + diagtool + hmaptool + nvptx-arch + pp-trace + c-index-test + find-all-symbols + modularize + 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 +%endif +%expand_mans diagtool extraclangtools +%{expand_datas %{expand: + clang/clang-format.py* + clang/clang-format-diff.py* + clang/clang-include-fixer.py* + clang/clang-tidy-diff.py* + clang/run-find-all-symbols.py* +}} %files -n %{pkg_name_clang}-tools-extra-devel %license clang-tools-extra/LICENSE.TXT -%{install_includedir}/clang-tidy/ +%expand_includes clang-tidy %files -n git-clang-format%{pkg_suffix} %license clang/LICENSE.TXT -%{install_bindir}/git-clang-format -%if %{with compat_build} -%{_bindir}/git-clang-format-%{maj_ver} -%endif +%expand_bins git-clang-format %if %{without compat_build} %files -n python%{python3_pkgversion}-clang @@ -2410,13 +2769,16 @@ fi %files -n %{pkg_name_libomp} %license openmp/LICENSE.TXT -%{install_libdir}/libomp.so -%{install_libdir}/libompd.so -%{install_libdir}/libarcher.so +%{expand_libs %{expand: + libomp.so + libompd.so + libarcher.so +}} %ifnarch %{ix86} # libomptarget is not supported on 32-bit systems. # s390x does not support the offloading plugins. -%{install_libdir}/libomptarget.so.%{so_suffix} +%expand_libs libomptarget.so.%{so_suffix} +%expand_libs libLLVMOffload.so.%{so_suffix} %endif %files -n %{pkg_name_libomp}-devel @@ -2426,16 +2788,19 @@ fi %{_prefix}/lib/clang/%{maj_ver}/include/omp-tools.h %{_prefix}/lib/clang/%{maj_ver}/include/ompt.h %{_prefix}/lib/clang/%{maj_ver}/include/ompt-multiplex.h -%{install_libdir}/cmake/openmp/ +%expand_libs cmake/openmp %ifnarch %{ix86} # libomptarget is not supported on 32-bit systems. # s390x does not support the offloading plugins. -%{install_libdir}/libomptarget.devicertl.a -%{install_libdir}/libomptarget-amdgpu-*.bc -%{install_libdir}/libomptarget-nvptx-*.bc -%{install_libdir}/libomptarget.so +%{expand_libs %{expand: + libomptarget.devicertl.a + libomptarget-amdgpu*.bc + libomptarget-nvptx*.bc + libomptarget.so + libLLVMOffload.so +}} +%expand_includes offload %endif - #endregion OPENMP files #region LLD files @@ -2443,40 +2808,38 @@ fi %files -n %{pkg_name_lld} %license lld/LICENSE.TXT %ghost %{_bindir}/ld -%{install_bindir}/lld -%{install_bindir}/lld-link -%{install_bindir}/ld.lld -%{install_bindir}/ld64.lld -%{install_bindir}/wasm-ld -%if %{without compat_build} -%{_mandir}/man1/ld.lld.1* -%else -%{_bindir}/lld%{exec_suffix} -%{_bindir}/lld-link%{exec_suffix} -%{_bindir}/ld.lld%{exec_suffix} -%{_bindir}/ld64.lld%{exec_suffix} -%{_bindir}/wasm-ld%{exec_suffix} -%endif +%{expand_bins %{expand: + lld + lld-link + ld.lld + ld64.lld + wasm-ld +}} +%expand_mans ld.lld %files -n %{pkg_name_lld}-devel %license lld/LICENSE.TXT -%{install_includedir}/lld -%{install_libdir}/liblldCOFF.so -%{install_libdir}/liblldCommon.so -%{install_libdir}/liblldELF.so -%{install_libdir}/liblldMachO.so -%{install_libdir}/liblldMinGW.so -%{install_libdir}/liblldWasm.so -%{install_libdir}/cmake/lld/ +%expand_includes lld +%{expand_libs %{expand: + liblldCOFF.so + liblldCommon.so + liblldELF.so + liblldMachO.so + liblldMinGW.so + liblldWasm.so + cmake/lld +}} %files -n %{pkg_name_lld}-libs %license lld/LICENSE.TXT -%{install_libdir}/liblldCOFF.so.* -%{install_libdir}/liblldCommon.so.* -%{install_libdir}/liblldELF.so.* -%{install_libdir}/liblldMachO.so.* -%{install_libdir}/liblldMinGW.so.* -%{install_libdir}/liblldWasm.so.* +%{expand_libs %{expand: + liblldCOFF.so.* + liblldCommon.so.* + liblldELF.so.* + liblldMachO.so.* + liblldMinGW.so.* + liblldWasm.so.* +}} #endregion LLD files @@ -2491,29 +2854,187 @@ fi %if %{with lldb} %files -n %{pkg_name_lldb} %license lldb/LICENSE.TXT -%{install_bindir}/lldb* +%{expand_bins %{expand: + lldb + lldb-argdumper + lldb-dap + lldb-instr + lldb-server +}} # Usually, *.so symlinks are kept in devel subpackages. However, the python # bindings depend on this symlink at runtime. -%{install_libdir}/liblldb*.so -%{install_libdir}/liblldb.so.* -%{install_libdir}/liblldbIntelFeatures.so.* -%{_mandir}/man1/lldb-server%{exec_suffix}.1.gz -%{_mandir}/man1/lldb%{exec_suffix}.1.gz +%{expand_libs %{expand: + liblldb*.so + liblldb.so.* + liblldbIntelFeatures.so.* +}} +%expand_mans lldb-server lldb %if %{with bundle_compat_lib} %{_libdir}/liblldb.so.%{compat_maj_ver}* %endif %files -n %{pkg_name_lldb}-devel -%{install_includedir}/lldb +%expand_includes lldb +%if %{without compat_build} %files -n python%{python3_pkgversion}-lldb %{python3_sitearch}/lldb %endif +%endif #endregion LLDB files + + +#region MLIR files +%if %{with mlir} +%files -n %{pkg_name_mlir} +%license LICENSE.TXT +%{expand_libs %{expand: + libmlir_arm_runner_utils.so.%{maj_ver}* + libmlir_arm_sme_abi_stubs.so.%{maj_ver}* + libmlir_async_runtime.so.%{maj_ver}* + libmlir_c_runner_utils.so.%{maj_ver}* + libmlir_float16_utils.so.%{maj_ver}* + libmlir_runner_utils.so.%{maj_ver}* + libMLIR*.so.%{maj_ver}* +}} + +%files -n %{pkg_name_mlir}-static +%expand_libs libMLIR*.a + +%files -n %{pkg_name_mlir}-devel +%{expand_bins %{expand: + mlir-linalg-ods-yaml-gen + mlir-lsp-server + mlir-opt + mlir-pdll + mlir-pdll-lsp-server + mlir-query + mlir-reduce + mlir-rewrite + mlir-runner + mlir-tblgen + mlir-translate + tblgen-lsp-server + tblgen-to-irdl +}} +%expand_includes mlir mlir-c +%{expand_libs %{expand: + cmake/mlir + libmlir_arm_runner_utils.so + libmlir_arm_sme_abi_stubs.so + libmlir_async_runtime.so + libmlir_c_runner_utils.so + libmlir_float16_utils.so + libmlir_runner_utils.so + libMLIR*.so +}} + +%files -n python%{python3_pkgversion}-%{pkg_name_mlir} +%{python3_sitearch}/mlir/ +%endif +#endregion MLIR files + +#region libcxx files +%if %{with libcxx} + +%files -n %{pkg_name_libcxx} +%license libcxx/LICENSE.TXT +%doc libcxx/CREDITS.TXT libcxx/TODO.TXT +%{_libdir}/libc++.so.* + +%files -n %{pkg_name_libcxx}-devel +%{_includedir}/c++/ +%exclude %{_includedir}/c++/v1/cxxabi.h +%exclude %{_includedir}/c++/v1/__cxxabi_config.h +%{_libdir}/libc++.so +%{_libdir}/libc++.modules.json +%{_datadir}/libc++/v1/* + +%files -n %{pkg_name_libcxx}-static +%license libcxx/LICENSE.TXT +%{_libdir}/libc++.a +%{_libdir}/libc++experimental.a + +%files -n %{pkg_name_libcxxabi} +%license libcxxabi/LICENSE.TXT +%doc libcxxabi/CREDITS.TXT +%{_libdir}/libc++abi.so.* + +%files -n %{pkg_name_libcxxabi}-devel +%{_includedir}/c++/v1/cxxabi.h +%{_includedir}/c++/v1/__cxxabi_config.h +%{_libdir}/libc++abi.so + +%files -n %{pkg_name_libcxxabi}-static +%{_libdir}/libc++abi.a + +%files -n %{pkg_name_llvm_libunwind} +%license libunwind/LICENSE.TXT +%{_libdir}/libunwind.so.1 +%{_libdir}/libunwind.so.1.0 + +%files -n %{pkg_name_llvm_libunwind}-devel +%{_includedir}/llvm-libunwind/__libunwind_config.h +%{_includedir}/llvm-libunwind/libunwind.h +%{_includedir}/llvm-libunwind/libunwind.modulemap +%{_includedir}/llvm-libunwind/mach-o/compact_unwind_encoding.h +%{_includedir}/llvm-libunwind/unwind.h +%{_includedir}/llvm-libunwind/unwind_arm_ehabi.h +%{_includedir}/llvm-libunwind/unwind_itanium.h +%dir %{_libdir}/llvm-unwind +%{_libdir}/llvm-unwind/libunwind.so + +%files -n %{pkg_name_llvm_libunwind}-static +%{_libdir}/libunwind.a +%endif +#endregion libcxx files + +#region BOLT files +%if %{with build_bolt} +%files -n %{pkg_name_bolt} +%license bolt/LICENSE.TXT +%{expand_bins %{expand: + llvm-bolt + llvm-boltdiff + llvm-bolt-binary-analysis + llvm-bolt-heatmap + merge-fdata + perf2bolt +}} + +%{expand_libs %{expand: + libbolt_rt_hugify.a + libbolt_rt_instr.a +}} +%endif +#endregion BOLT files + +#region polly files +%if %{with polly} +%files -n %{pkg_name_polly} +%license polly/LICENSE.TXT +%{expand_libs %{expand: + LLVMPolly.so + libPolly.so.* + libPollyISL.so +}} +%expand_mans polly + +%files -n %{pkg_name_polly}-devel +%expand_libs libPolly.so +%expand_includes polly +%expand_libs cmake/polly + +%endif +#endregion polly files + #endregion files #region changelog %changelog +* Mon Apr 14 2025 Konrad Kleine - 20.1.2-1 +- Update to LLVM 20.1.2 (RHEL-80988) + * Fri Jan 17 2025 Nikita Popov - 19.1.7-2 - Support CET in libomp.so (RHEL-74346) diff --git a/rpminspect.yaml b/rpminspect.yaml index 2f600c2..18c241f 100644 --- a/rpminspect.yaml +++ b/rpminspect.yaml @@ -18,3 +18,7 @@ badfuncs: - gethostbyname2 - inet_aton +unicode: + ignore: + # Ignore bidirectional unicode sequence documentation file + - llvm-project-*.src/clang-tools-extra/docs/clang-tidy/checks/misc/misleading-bidirectional.rst diff --git a/sources b/sources index d5e33a6..95bb2d4 100644 --- a/sources +++ b/sources @@ -1,2 +1,4 @@ +SHA512 (llvm-project-20.1.2.src.tar.xz) = c95e088e471d49c6692c8af1a7e40924467e4c269dada019c44455687c9f0e6a213b9b3ac8afa4e3d20cb3e757afc3400152e7cd06981aeebd61591cac15580d +SHA512 (llvm-project-20.1.2.src.tar.xz.sig) = d3f6a350ebd9884878442ea202f58328f8e85c30cfb150371e4af7fa8dc560bb421cd0f49f49e6bc95f57de6c06543633f0b2799aab9590750f440e099424e01 SHA512 (llvm-project-19.1.7.src.tar.xz) = c7d63286d662707a9cd54758c9e3aaf52794a91900c484c4a6efa62d90bc719d5e7a345e4192feeb0c9fd11c82570d64677c781e5be1d645556b6aa018e47ec8 SHA512 (llvm-project-19.1.7.src.tar.xz.sig) = 195797b06ac80a742e0ccbc03a50dc06dd2e04377d783d5474e3e72c5a75203b60292b047929312a411d22b137a239943fba414a4d136a2be14cbff978eb6bda diff --git a/tests/build-gating.fmf b/tests/build-gating.fmf index 1c7152e..db92f08 100644 --- a/tests/build-gating.fmf +++ b/tests/build-gating.fmf @@ -1,13 +1,14 @@ # -# Build/PR gating tests for *LLVM 13* +# Build/PR gating tests for *LLVM 19* # -# Compatible with various LLVM 13 distributions: +# Compatible with various LLVM 19 distributions: # # * Fedora (ursine packages) +# * CentOS 10 stream (ursine packages) # * Centos 9 stream (ursine packages) +# * RHEL-10 (ursine packages) # * RHEL-9 (ursine packages) # * RHEL-8 (Red Hat module) -# * RHEL-7 (software collection) # summary: LLVM tests for build/PR gating