Skip to content

Commit 5218c9a

Browse files
nikictbaederr
authored andcommitted
Add compiler-rt patch for RHEL 8 page sizes
RHEL 8 uses different page sizes, and we need to patch the CFI implementation to use those.
1 parent 3f9db56 commit 5218c9a

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 5f73befe5a0df82e455f4b1052e62f34009e98bb Mon Sep 17 00:00:00 2001
2+
From: Tom Stellard <[email protected]>
3+
Date: Tue, 23 Apr 2024 15:08:34 -0700
4+
Subject: [PATCH] Fix page size constant on aarch64 and ppc64le
5+
6+
---
7+
compiler-rt/lib/cfi/cfi.cpp | 2 ++
8+
1 file changed, 2 insertions(+)
9+
10+
diff --git a/compiler-rt/lib/cfi/cfi.cpp b/compiler-rt/lib/cfi/cfi.cpp
11+
index ad1c91623514..e7e86e5807a8 100644
12+
--- a/compiler-rt/lib/cfi/cfi.cpp
13+
+++ b/compiler-rt/lib/cfi/cfi.cpp
14+
@@ -53,6 +53,8 @@ namespace __cfi {
15+
16+
#if SANITIZER_LOONGARCH64
17+
#define kCfiShadowLimitsStorageSize 16384 // 16KiB on loongarch64 per page
18+
+#elif defined(__aarch64__) || defined(__powerpc64__)
19+
+#define kCfiShadowLimitsStorageSize 65536 // 1 page
20+
#else
21+
#define kCfiShadowLimitsStorageSize 4096 // 1 page
22+
#endif
23+
--
24+
2.40.1
25+

llvm.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Patch3002: 0001-Always-build-shared-libs-for-LLD.patch
8181
Patch9001: 0001-Remove-myst_parser-dependency-for-RHEL.patch
8282

8383
# RHEL 8 only
84-
#Patch9002: 0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch
84+
Patch9002: 0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch
8585
#endregion
8686

8787
%if 0%{?rhel} == 8

prep.spec.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
%if %{defined rhel}
1818
%patch -p1 -P9001
19+
20+
%if %{rhel} == 8
21+
%patch -p1 -P9002
22+
%endif
1923
%endif
2024

2125
#region LLVM preparation

0 commit comments

Comments
 (0)