From e04bd2a7c530f59cfa348fe5f8af9c133b71523a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 14 Aug 2024 10:15:15 +0000 Subject: [PATCH] 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. --- ...size-constant-on-aarch64-and-ppc64le.patch | 25 +++++++++++++++++++ llvm.spec | 3 +++ prep.spec.inc | 4 +++ 3 files changed, 32 insertions(+) create mode 100644 0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch diff --git a/0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch b/0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch new file mode 100644 index 0000000..925c996 --- /dev/null +++ b/0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch @@ -0,0 +1,25 @@ +From 5f73befe5a0df82e455f4b1052e62f34009e98bb Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Tue, 23 Apr 2024 15:08:34 -0700 +Subject: [PATCH] Fix page size constant on aarch64 and ppc64le + +--- + compiler-rt/lib/cfi/cfi.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/compiler-rt/lib/cfi/cfi.cpp b/compiler-rt/lib/cfi/cfi.cpp +index ad1c91623514..e7e86e5807a8 100644 +--- a/compiler-rt/lib/cfi/cfi.cpp ++++ b/compiler-rt/lib/cfi/cfi.cpp +@@ -53,6 +53,8 @@ namespace __cfi { + + #if SANITIZER_LOONGARCH64 + #define kCfiShadowLimitsStorageSize 16384 // 16KiB on loongarch64 per page ++#elif defined(__aarch64__) || defined(__powerpc64__) ++#define kCfiShadowLimitsStorageSize 65536 // 1 page + #else + #define kCfiShadowLimitsStorageSize 4096 // 1 page + #endif +-- +2.40.1 + diff --git a/llvm.spec b/llvm.spec index a9031c7..5a71103 100644 --- a/llvm.spec +++ b/llvm.spec @@ -73,6 +73,9 @@ Patch3002: 0001-Always-build-shared-libs-for-LLD.patch #region RHEL patches # All RHEL Patch9001: 0001-Remove-myst_parser-dependency-for-RHEL.patch + +# RHEL 8 only +Patch9002: 0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch #endregion %if 0%{?rhel} == 8 diff --git a/prep.spec.inc b/prep.spec.inc index c28a911..896a4c4 100644 --- a/prep.spec.inc +++ b/prep.spec.inc @@ -16,6 +16,10 @@ %if %{defined rhel} %patch -p1 -P9001 + +%if %{rhel} == 8 +%patch -p1 -P9002 +%endif %endif #region LLVM preparation