void-packages/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch

57 lines
2.6 KiB
Diff

commit 45809f85bc3524f867e6e954f444fddd2333245a
Author: q66 <daniel@octaforge.org>
Date: Fri Jan 7 18:18:52 2022 +0100
switch ppc64 to 4k pages
since the partition allocator appears to hate larger constants
and at this point errors at compile time and i am not willing
to wade through this pile of curse and we use 4k kernels anyway,
assume 4K pages for ppc64
diff --git a/base/allocator/partition_allocator/page_allocator_constants.h b/base/allocator/partition_allocator/page_allocator_constants.h
index bfd5753..045082b 100644
--- a/base/allocator/partition_allocator/page_allocator_constants.h
+++ b/base/allocator/partition_allocator/page_allocator_constants.h
@@ -40,7 +40,7 @@ namespace base {
PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR ALWAYS_INLINE size_t
PageAllocationGranularityShift() {
-#if BUILDFLAG(IS_WIN) || defined(ARCH_CPU_PPC64)
+#if BUILDFLAG(IS_WIN)
// Modern ppc64 systems support 4kB (shift = 12) and 64kB (shift = 16) page
// sizes. Since 64kB is the de facto standard on the platform and binaries
// compiled for 64kB are likely to work on 4kB systems, 64kB is a good choice
diff --git a/base/allocator/partition_allocator/partition_alloc_constants.h b/base/allocator/partition_allocator/partition_alloc_constants.h
index 0b9260d..3e054ec 100644
--- a/base/allocator/partition_allocator/partition_alloc_constants.h
+++ b/base/allocator/partition_allocator/partition_alloc_constants.h
@@ -74,11 +74,6 @@
PartitionPageShift() {
return 16; // 64 KiB
}
-#elif defined(ARCH_CPU_PPC64)
-PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR ALWAYS_INLINE size_t
-PartitionPageShift() {
- return 18; // 256 KiB
-}
#elif (BUILDFLAG(IS_APPLE) && defined(ARCH_CPU_64_BITS)) || \
(BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64))
PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR ALWAYS_INLINE size_t
diff --git a/base/allocator/partition_allocator/partition_alloc_forward.h b/base/allocator/partition_allocator/partition_alloc_forward.h
index 938ea38..9414b41 100644
--- a/base/allocator/partition_allocator/partition_alloc_forward.h
+++ b/base/allocator/partition_allocator/partition_alloc_forward.h
@@ -26,7 +26,10 @@ namespace base {
//
// __STDCPP_DEFAULT_NEW_ALIGNMENT__ is C++17. As such, it is not defined on all
// platforms, as Chrome's requirement is C++14 as of 2020.
-#if defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__)
+#if defined(__powerpc64__)
+/* we want this to be 16 here always */
+constexpr size_t kAlignment = 16;
+#elif defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__)
constexpr size_t kAlignment =
std::max(alignof(max_align_t), __STDCPP_DEFAULT_NEW_ALIGNMENT__);
#else