From 1363667847ace45ffcc902cb5dd0a7de9c4dc43f Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Fri, 26 Jul 2024 23:27:14 +0200 Subject: [PATCH] refresh ppc64le patches --- chromium.spec | 2 +- fix-rust-linking.patch | 25 ++++--------------- use-sysconf-page-size-on-ppc64.patch | 37 +++++++++++++++------------- 3 files changed, 26 insertions(+), 38 deletions(-) diff --git a/chromium.spec b/chromium.spec index 870dde6a..fb019c29 100644 --- a/chromium.spec +++ b/chromium.spec @@ -1192,7 +1192,7 @@ Qt6 UI for chromium. %patch -P407 -p1 -b .fix-ppc64-linux-syscalls-headers %patch -P408 -p1 -b .use-sysconf-page-size-on-ppc64 -%patch -P409 -p1 -b .partition-alloc-4k-detect +#%%patch -P409 -p1 -b .partition-alloc-4k-detect %patch -P410 -p1 -b .dawn-fix-typos %patch -P411 -p1 -b .dawn-fix-ppc64le-detection diff --git a/fix-rust-linking.patch b/fix-rust-linking.patch index a2284e90..92ab34b2 100644 --- a/fix-rust-linking.patch +++ b/fix-rust-linking.patch @@ -1,8 +1,8 @@ -Index: chromium-121.0.6167.75/build/toolchain/gcc_toolchain.gni +Index: chromium-127.0.6533.72/build/toolchain/gcc_toolchain.gni =================================================================== ---- chromium-121.0.6167.75.orig/build/toolchain/gcc_toolchain.gni -+++ chromium-121.0.6167.75/build/toolchain/gcc_toolchain.gni -@@ -464,7 +464,13 @@ template("single_gcc_toolchain") { +--- chromium-127.0.6533.72.orig/build/toolchain/gcc_toolchain.gni ++++ chromium-127.0.6533.72/build/toolchain/gcc_toolchain.gni +@@ -439,7 +439,13 @@ template("single_gcc_toolchain") { # -soname flag is not available on aix ld soname_flag = "-Wl,-soname=\"$soname\"" } @@ -17,7 +17,7 @@ Index: chromium-121.0.6167.75/build/toolchain/gcc_toolchain.gni # Generate a map file to be used for binary size analysis. # Map file adds ~10% to the link time on a z620. -@@ -576,7 +582,13 @@ template("single_gcc_toolchain") { +@@ -551,7 +557,13 @@ template("single_gcc_toolchain") { whole_archive_flag = "-Wl,--whole-archive" no_whole_archive_flag = "-Wl,--no-whole-archive" } @@ -32,18 +32,3 @@ Index: chromium-121.0.6167.75/build/toolchain/gcc_toolchain.gni if (defined(invoker.strip)) { strip_command = "${invoker.strip} -o \"$sofile\" \"$unstripped_sofile\"" -@@ -636,7 +648,13 @@ template("single_gcc_toolchain") { - start_group_flag = "-Wl,--start-group" - end_group_flag = "-Wl,--end-group " - } -- link_command = "$ld {{ldflags}}${extra_ldflags} -o \"$unstripped_outfile\" $start_group_flag @\"$rspfile\" {{solibs}} $end_group_flag {{libs}} {{rlibs}}" -+ if (target_cpu == "ppc64") { -+ # Work around linker failures due to Rust libraries and the use of whole-archive -+ link_command = "$ld -Wl,--start-group {{ldflags}}${extra_ldflags} -o \"$unstripped_outfile\" @\"$rspfile\" {{solibs}} {{libs}} {{rlibs}} -Wl,--end-group" -+ } -+ else { -+ link_command = "$ld {{ldflags}}${extra_ldflags} -o \"$unstripped_outfile\" $start_group_flag @\"$rspfile\" {{solibs}} $end_group_flag {{libs}} {{rlibs}}" -+ } - - # Generate a map file to be used for binary size analysis. - # Map file adds ~10% to the link time on a z620. diff --git a/use-sysconf-page-size-on-ppc64.patch b/use-sysconf-page-size-on-ppc64.patch index 1d8b6161..26848ea1 100644 --- a/use-sysconf-page-size-on-ppc64.patch +++ b/use-sysconf-page-size-on-ppc64.patch @@ -1,10 +1,12 @@ ---- a/base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h -+++ b/base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h +Index: chromium-127.0.6533.72/base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h +=================================================================== +--- chromium-127.0.6533.72.orig/base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h ++++ chromium-127.0.6533.72/base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h @@ -176,7 +176,11 @@ SystemPageBaseMask() { return ~SystemPageOffsetMask(); } -+#if defined(ARCH_CPU_PPC64) ++#if PA_BUILDFLAG(PA_ARCH_CPU_PPC64_FAMILY) +constexpr size_t kPageMetadataShift = 6; // 64 bytes per partition page. +#else constexpr size_t kPageMetadataShift = 5; // 32 bytes per partition page. @@ -12,13 +14,15 @@ constexpr size_t kPageMetadataSize = 1 << kPageMetadataShift; } // namespace internal ---- a/base/allocator/partition_allocator/src/partition_alloc/partition_page.h -+++ b/base/allocator/partition_allocator/src/partition_alloc/partition_page.h -@@ -86,7 +86,11 @@ struct SlotSpanMetadata { +Index: chromium-127.0.6533.72/base/allocator/partition_allocator/src/partition_alloc/partition_page.h +=================================================================== +--- chromium-127.0.6533.72.orig/base/allocator/partition_allocator/src/partition_alloc/partition_page.h ++++ chromium-127.0.6533.72/base/allocator/partition_allocator/src/partition_alloc/partition_page.h +@@ -87,7 +87,11 @@ struct SlotSpanMetadata { // CHECK()ed in AllocNewSlotSpan(). // The maximum number of bits needed to cover all currently supported OSes. -+#if defined(ARCH_CPU_PPC64) ++#if PA_BUILDFLAG(PA_ARCH_CPU_PPC64_FAMILY) + static constexpr size_t kMaxSlotsPerSlotSpanBits = 15; +#else static constexpr size_t kMaxSlotsPerSlotSpanBits = 13; @@ -26,11 +30,11 @@ static_assert(kMaxSlotsPerSlotSpan < (1 << kMaxSlotsPerSlotSpanBits), ""); // |marked_full| isn't equivalent to being full. Slot span is marked as full -@@ -100,7 +104,11 @@ struct SlotSpanMetadata { +@@ -101,7 +105,11 @@ struct SlotSpanMetadata { private: const uint32_t can_store_raw_size_ : 1; uint32_t freelist_is_sorted_ : 1; -+#if defined(ARCH_CPU_PPC64) ++#if PA_BUILDFLAG(PA_ARCH_CPU_PPC64_FAMILY) + uint32_t unused1_ : (64 - 1 - 2 * kMaxSlotsPerSlotSpanBits - 1 - 1); +#else uint32_t unused1_ : (32 - 1 - 2 * kMaxSlotsPerSlotSpanBits - 1 - 1); @@ -38,16 +42,15 @@ // If |in_empty_cache_|==1, |empty_cache_index| is undefined and mustn't be // used. uint16_t in_empty_cache_ : 1; ---- a/base/allocator/partition_allocator/src/partition_alloc/partition_page_constants.h -+++ b/base/allocator/partition_allocator/src/partition_alloc/partition_page_constants.h -@@ -21,6 +21,11 @@ static constexpr size_t kMaxSlotsPerSlot +Index: chromium-127.0.6533.72/base/allocator/partition_allocator/src/partition_alloc/partition_page_constants.h +=================================================================== +--- chromium-127.0.6533.72.orig/base/allocator/partition_allocator/src/partition_alloc/partition_page_constants.h ++++ chromium-127.0.6533.72/base/allocator/partition_allocator/src/partition_alloc/partition_page_constants.h +@@ -20,7 +20,7 @@ + // System page size can be 4, 16, or 64 kiB on Linux on arm64. 64 kiB is // currently (kMaxSlotsPerSlotSpanBits == 13) not supported by the code, // so we use the 16 kiB maximum (64 kiB will crash). - static constexpr size_t kMaxSlotsPerSlotSpan = 4 * (1 << 14) / kSmallestBucket; -+#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_PPC64) -+// System page size is not a constant on OpenPOWER systems, but is either 4kiB -+// or 64kiB (1 << 12 or 1 << 16) -+// And PartitionPageSize() is 4 times the OS page size. +-static constexpr size_t kMaxSlotsPerSlotSpan = 4 * (1 << 14) / kSmallestBucket; +static constexpr size_t kMaxSlotsPerSlotSpan = 4 * (1 << 16) / kSmallestBucket; #else // A slot span can "span" multiple PartitionPages, but then its slot size is