From 1363667847ace45ffcc902cb5dd0a7de9c4dc43f Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Fri, 26 Jul 2024 23:27:14 +0200 Subject: [PATCH 1/2] 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 From 3396c12c1167d1cf5fd11f2b99130ccc513eb253 Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Sat, 27 Jul 2024 00:25:01 +0200 Subject: [PATCH 2/2] workaround for missing bindgen on el8 --- .gitignore | 2 ++ chromium.spec | 29 ++++++++++++++++------------- sources | 3 ++- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 6a2d41a5..4f2e25c3 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,5 @@ /linux-arm64-0.19.2.tgz /linux-x64-0.19.2.tgz /v0.69.4.tar.gz +/bindgen-cli-aarch64.tar.xz +/bindgen-cli-x86_64.tar.xz diff --git a/chromium.spec b/chromium.spec index fb019c29..43df6131 100644 --- a/chromium.spec +++ b/chromium.spec @@ -513,7 +513,8 @@ Source15: https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-%{esbuil %endif # bindgen for epel8 -Source16: https://github.com/rust-lang/rust-bindgen/archive/refs/tags/v0.69.4.tar.gz +Source16: https://than.fedorapeople.org/epel8/bindgen-cli-aarch64.tar.xz +Source17: https://than.fedorapeople.org/epel8/bindgen-cli-x86_64.tar.xz # esbuild binary from fedora %if 0%{?fedora} @@ -1213,6 +1214,20 @@ Qt6 UI for chromium. # See `man find` for how the `-exec command {} +` syntax works find -type f \( -iname "*.py" \) -exec sed -i '1s=^#! */usr/bin/\(python\|env python\)[23]\?=#!%{chromium_pybin}=' {} + +# workaround for missing bindgen on el8 +%if 0%{?rhel} == 8 +%ifarch aarch64 +tar -Jxf %{SOURCE16} +%endif +%ifarch x86_64 +tar -Jxf %{SOURCE17} +%endif +mkdir -p usr/%{_lib} +pushd usr/%{_lib} +ln -fs %{_libdir}/libclang* . +popd +%endif + # Add correct path for nodejs binary %if ! %{system_nodejs} pushd third_party/node/linux @@ -1274,18 +1289,6 @@ cp -a third_party/dav1d/version/version.h third_party/dav1d/libdav1d/include/dav %endif %build -# build bindgen on el8 -%if 0%{?rhel} == 8 -tar -zxf %{SOURCE16} -pushd rust-bindgen-0.69.4 -cargo --offline build -mkdir -p ..%{_bindir} ..%{_libdir} -cp target/debug/bindgen ..%{_bindir} -pushd ..%{_libdir} -ln -fs %{_libdir}/libclang* . -popd -popd -%endif # reduce warnings %if %{clang} diff --git a/sources b/sources index 60b93c8d..824d4710 100644 --- a/sources +++ b/sources @@ -3,4 +3,5 @@ SHA512 (node-v20.6.1-linux-x64.tar.xz) = 7e15c05041a9a50f0046266aadb2e092a5aefbe SHA512 (linux-arm64-0.19.2.tgz) = 8a0d8fec6786fffcd6954d00820037a55d61e60762c74300df0801f8db27057562c221a063bedfb8df56af9ba80abb366336987e881782c5996e6f871abd3dc6 SHA512 (linux-x64-0.19.2.tgz) = a31cc74c4bfa54f9b75d735a1cfc944d3b5efb7c06bfba9542da9a642ae0b2d235ea00ae84d3ad0572c406405110fe7b61377af0fd15803806ef78d20fc6f05d SHA512 (chromium-127.0.6533.72-clean.tar.xz) = 6faa0b0df800bafb31acb003d23f62e5eeea12c49ed3b9bf52c2e4f7ef3a7d7f6069f41026092bcb1e222dcbf4f0a3a0595e9be52502375f0b1094551cc7a98c -SHA512 (v0.69.4.tar.gz) = a493474c89255c801c6fd4eb44e6a94f4d23830dc13c0bbae08c46e5c364e0df176fc00174d6462b70239578d0821e9ff1aaf127d8c60688f38a50a62cf292f4 +SHA512 (bindgen-cli-aarch64.tar.xz) = 1a5ae4e8fdd31d80e8111c4d5f2115336684763ecd3a442ffecdbc2a37bab146f88bdee0bb1ea7a98e1049f81b12e64bd0ce5510529b30a74ce3306488ac129b +SHA512 (bindgen-cli-x86_64.tar.xz) = 7ccc9b43b32d3a064a75cfc150e060711356da8fe98e83d855bae017108ef8e9e172fbdd6e2579433c19cfb56ababa5b77a8db6fa57a5e657a3878778ca10a37