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

61 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
@@ -69,7 +69,7 @@ namespace base {
PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR PA_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
@@ -90,11 +90,6 @@
PartitionPageShift() {
return 16; // 64 KiB
}
-#elif defined(ARCH_CPU_PPC64)
-PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR PA_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 PA_ALWAYS_INLINE size_t
--- a/base/allocator/partition_allocator/partition_alloc_forward.h
+++ b/base/allocator/partition_allocator/partition_alloc_forward.h
@@ -25,12 +25,17 @@
// the second one 16. We could technically return something different for
// malloc() and operator new(), but this would complicate things, and most of
// our allocations are presumably coming from operator new() anyway.
+#if defined(__powerpc64__)
+/* we want this to be 16 here always */
+constexpr size_t kAlignment = 16;
+#else
constexpr size_t kAlignment =
std::max(alignof(max_align_t),
static_cast<size_t>(__STDCPP_DEFAULT_NEW_ALIGNMENT__));
static_assert(kAlignment <= 16,
"PartitionAlloc doesn't support a fundamental alignment larger "
"than 16 bytes.");
+#endif
constexpr bool ThreadSafe = true;