Skip to content

Commit a7e3073

Browse files
committed
Patch numbering
We've established the habit of numbering patches the following way: 0-499: All patches that are unconditionally applied 500-1000: Patches applied under certain conditions (e.g. only on RHEL8) 1500-1599: Patches for LLVM 15 1600-1699: Patches for LLVM 16 1700-1799: Patches for LLVM 17 ... 2000-2099: Patches for LLVM 20 The idea behind this is that the last range of patch numbers (e.g. 2000-2099) allow us to "deprecate" a patch instead of deleting it right away. Suppose llvm upstream in git is at version 20 and there's a patch living in some PR that has not been merged yet. You can copy that patch and put it in a line like: Patch2011: upstream.patch As time goes by, llvm moves on to LLVM 21 and meanwhile the patch has landed. There's no need for you to remove the "Patch2011:" line. In fact, we encourage you to not remove it for some time. For compat libraries and compat packages we might still need this patch and so we're applying it automatically for you in those situations. Remember that a compat library is always at least one major version behind the latest packaged LLVM version. I've restored a patch for an older version of LLVM: We needed to move the `0001-Always-build-shared-libs-for-LLD.patch` from the `0-499` range to the `19xx` (current release) and `20xx` (snapshots) range. In addition the old version of the patch was restored with the following command and added to the `18xx` range: ``` $ git show 0656f30:0001-Always-build-shared-libs-for-LLD.patch > 0001-18-Always-build-shared-libs-for-LLD.patch ``` This was needed because the `bundle_compat_lib` (RHEL only) build condition needs the old version of the patch.
1 parent f0d7b28 commit a7e3073

File tree

3 files changed

+81
-16
lines changed

3 files changed

+81
-16
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
From b1c60d7fa322a2d208556087df9e7ef94bfbffb8 Mon Sep 17 00:00:00 2001
2+
From: Nikita Popov <[email protected]>
3+
Date: Wed, 8 May 2024 12:30:36 +0900
4+
Subject: [PATCH] Always build shared libs for LLD
5+
6+
We don't want to enable BUILD_SHARED_LIBS for the whole build,
7+
but we do want to build lld libraries.
8+
---
9+
lld/cmake/modules/AddLLD.cmake | 5 ++---
10+
1 file changed, 2 insertions(+), 3 deletions(-)
11+
12+
diff --git a/lld/cmake/modules/AddLLD.cmake b/lld/cmake/modules/AddLLD.cmake
13+
index 2ee066b41535..270c03f096ac 100644
14+
--- a/lld/cmake/modules/AddLLD.cmake
15+
+++ b/lld/cmake/modules/AddLLD.cmake
16+
@@ -7,9 +7,8 @@ macro(add_lld_library name)
17+
""
18+
""
19+
${ARGN})
20+
- if(ARG_SHARED)
21+
- set(ARG_ENABLE_SHARED SHARED)
22+
- endif()
23+
+ # Always build shared libs for LLD.
24+
+ set(ARG_ENABLE_SHARED SHARED)
25+
llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS})
26+
set_target_properties(${name} PROPERTIES FOLDER "lld libraries")
27+
28+
--
29+
2.44.0

llvm.spec

Lines changed: 52 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -206,36 +206,61 @@ Source3001: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{com
206206
Source1000: version.spec.inc
207207
%endif
208208

209+
# We've established the habit of numbering patches the following way:
210+
#
211+
# 0-499: All patches that are unconditionally applied
212+
# 500-1000: Patches applied under certain conditions (e.g. only on RHEL8)
213+
# 1500-1599: Patches for LLVM 15
214+
# 1600-1699: Patches for LLVM 16
215+
# 1700-1799: Patches for LLVM 17
216+
# ...
217+
# 2000-2099: Patches for LLVM 20
218+
#
219+
# The idea behind this is that the last range of patch numbers (e.g. 2000-2099) allow
220+
# us to "deprecate" a patch instead of deleting it right away.
221+
# Suppose llvm upstream in git is at version 20 and there's a patch living
222+
# in some PR that has not been merged yet. You can copy that patch and put it
223+
# in a line like:
224+
#
225+
# Patch2011: upstream.patch
226+
#
227+
# As time goes by, llvm moves on to LLVM 21 and meanwhile the patch has landed.
228+
# There's no need for you to remove the "Patch2011:" line. In fact, we encourage you
229+
# to not remove it for some time. For compat libraries and compat packages we might
230+
# still need this patch and so we're applying it automatically for you in those
231+
# situations. Remember that a compat library is always at least one major version
232+
# behind the latest packaged LLVM version.
233+
209234
#region OpenMP patches
210-
%if %{maj_ver} < 20
211-
Patch1001: 0001-openmp-Add-option-to-disable-tsan-tests-111548.patch
212-
Patch1002: 0001-openmp-Use-core_siblings_list-if-physical_package_id.patch
213-
%endif
235+
Patch1900: 0001-openmp-Add-option-to-disable-tsan-tests-111548.patch
236+
Patch1901: 0001-openmp-Use-core_siblings_list-if-physical_package_id.patch
214237
#endregion OpenMP patches
215238

216239
#region CLANG patches
217-
Patch2001: 0001-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
218-
Patch2002: 0003-PATCH-clang-Don-t-install-static-libraries.patch
240+
Patch101: 0001-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
241+
Patch102: 0003-PATCH-clang-Don-t-install-static-libraries.patch
219242
#endregion CLANG patches
220243

221244
# Workaround a bug in ORC on ppc64le.
222245
# More info is available here: https://reviews.llvm.org/D159115#4641826
223-
Patch2005: 0001-Workaround-a-bug-in-ORC-on-ppc64le.patch
246+
Patch103: 0001-Workaround-a-bug-in-ORC-on-ppc64le.patch
224247

225248
#region LLD patches
226-
Patch3002: 0001-Always-build-shared-libs-for-LLD.patch
249+
Patch1800: 0001-18-Always-build-shared-libs-for-LLD.patch
250+
Patch1902: 0001-19-Always-build-shared-libs-for-LLD.patch
251+
Patch2000: 0001-19-Always-build-shared-libs-for-LLD.patch
227252
#endregion LLD patches
228253

229254
#region RHEL patches
230255
# All RHEL
231256
%if %{maj_ver} >= 20
232-
Patch9001: 0001-20-Remove-myst_parser-dependency-for-RHEL.patch
257+
Patch500: 0001-20-Remove-myst_parser-dependency-for-RHEL.patch
233258
%else
234-
Patch9001: 0001-19-Remove-myst_parser-dependency-for-RHEL.patch
259+
Patch500: 0001-19-Remove-myst_parser-dependency-for-RHEL.patch
235260
%endif
236261

237262
# RHEL 8 only
238-
Patch9002: 0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch
263+
Patch501: 0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch
239264
#endregion RHEL patches
240265

241266
%if 0%{?rhel} == 8
@@ -724,6 +749,14 @@ The package contains the LLDB Python module.
724749
%if %{with bundle_compat_lib}
725750
%{gpgverify} --keyring='%{SOURCE6}' --signature='%{SOURCE3001}' --data='%{SOURCE3000}'
726751
%setup -T -q -b 3000 -n llvm-project-%{compat_ver}.src
752+
753+
# Apply all patches with number < 500 (unconditionally)
754+
# See https://rpm-software-management.github.io/rpm/manual/autosetup.html
755+
%autopatch -M499 -p1
756+
757+
# automatically apply patches based on LLVM version
758+
%autopatch -m%{compat_maj_ver}00 -M%{compat_maj_ver}99 -p1
759+
727760
%endif
728761

729762
# -T : Do Not Perform Default Archive Unpacking (without this, the <n>th source would be unpacked twice)
@@ -733,15 +766,18 @@ The package contains the LLDB Python module.
733766
# see http://ftp.rpm.org/max-rpm/s1-rpm-inside-macros.html
734767
%autosetup -N -T -b 0 -n %{src_tarball_dir}
735768

736-
# Apply all patches with number <= 9000
769+
# Apply all patches with number < 500 (unconditionally)
737770
# See https://rpm-software-management.github.io/rpm/manual/autosetup.html
738-
%autopatch -M9000 -p1
771+
%autopatch -M499 -p1
772+
773+
# automatically apply patches based on LLVM version
774+
%autopatch -m%{maj_ver}00 -M%{maj_ver}99 -p1
739775

740776
%if %{defined rhel}
741-
%patch -p1 -P9001
777+
%patch -p1 -P500
742778

743779
%if %{rhel} == 8
744-
%patch -p1 -P9002
780+
%patch -p1 -P501
745781
%endif
746782
%endif
747783

@@ -1374,7 +1410,7 @@ function reset_test_opts()
13741410

13751411
# See https://llvm.org/docs/CommandGuide/lit.html#general-options
13761412
export LIT_OPTS="-vv --time-tests"
1377-
1413+
13781414
# Set to mark tests as expected to fail.
13791415
# See https://llvm.org/docs/CommandGuide/lit.html#cmdoption-lit-xfail
13801416
unset LIT_XFAIL

0 commit comments

Comments
 (0)