* [PR PATCH] chromium: update to 109.0.5414.74.
@ 2023-01-11 1:12 Duncaen
2023-01-11 14:05 ` [PR PATCH] [Updated] " Duncaen
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Duncaen @ 2023-01-11 1:12 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 406 bytes --]
There is a new pull request by Duncaen against master on the void-packages repository
https://github.com/Duncaen/void-packages chromium-109
https://github.com/void-linux/void-packages/pull/41570
chromium: update to 109.0.5414.74.
[ci skip]
* [ ] x86_64-glibc
* [ ] x86_64-musl
* [ ] aarch64-musl
* [ ] i686
A patch file from https://github.com/void-linux/void-packages/pull/41570.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-chromium-109-41570.patch --]
[-- Type: text/x-diff, Size: 178944 bytes --]
From d8786f0c5156ca3ed3f031c550d29cf2ec766c3d Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Wed, 11 Jan 2023 01:28:40 +0100
Subject: [PATCH] chromium: update to 109.0.5414.74.
---
.../musl-patches/xxx-ppc64le-support.patch | 187 -
.../patches/build-add-use_cxx17.patch | 38 +-
.../patches/fix-build-with-old-clang.patch | 20 +
.../patches/fix-musl-pthread-stacksize.patch | 40 -
.../chromium/patches/fix-narrowing-cast.patch | 53 -
.../patches/fix-nasm-musl-config.patch | 12 -
srcpkgs/chromium/patches/narrowing-cast.patch | 21 +
...uild-error-on-linux-with-system-zlib.patch | 41 -
.../patches/remove-strip_binary.patch | 32 -
.../patches/xxx-ppc64le-4k-pages.patch | 60 -
.../chromium/patches/xxx-ppc64le-libvpx.patch | 33 -
.../xxx-ppc64le-sandbox-linux-stat.patch | 31 -
.../patches/xxx-ppc64le-support.patch | 3590 -----------------
.../patches/xxx-ppc64le-swiftshader.patch | 18 -
srcpkgs/chromium/template | 11 +-
15 files changed, 62 insertions(+), 4125 deletions(-)
delete mode 100644 srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
create mode 100644 srcpkgs/chromium/patches/fix-build-with-old-clang.patch
delete mode 100644 srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
delete mode 100644 srcpkgs/chromium/patches/fix-narrowing-cast.patch
delete mode 100644 srcpkgs/chromium/patches/fix-nasm-musl-config.patch
create mode 100644 srcpkgs/chromium/patches/narrowing-cast.patch
delete mode 100644 srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
delete mode 100644 srcpkgs/chromium/patches/remove-strip_binary.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-support.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
diff --git a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 555f69c072c8..000000000000
--- a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,187 +0,0 @@
-diff --git sandbox/linux/bpf_dsl/seccomp_macros.h sandbox/linux/bpf_dsl/seccomp_macros.h
-index a6aec544e..2a4a7f1bc 100644
---- sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,7 +16,7 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
--#elif defined(__powerpc64__)
-+#elif defined(__powerpc64__) && defined(__GLIBC__)
- // Manually define greg_t on ppc64
- typedef unsigned long long greg_t;
- #endif
-@@ -361,11 +361,11 @@ typedef struct pt_regs regs_struct;
- #define SECCOMP_ARCH AUDIT_ARCH_PPC64
- #endif
-
--#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+#define SECCOMP_REG(_ctx, _reg) (((struct pt_regs *)(_ctx)->uc_mcontext.regs)->gpr[_reg])
-
- #define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
--#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_IP(_ctx) ((struct pt_regs *)(_ctx)->uc_mcontext.regs)->nip
- #define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
- #define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-diff --git sandbox/linux/seccomp-bpf/syscall.cc sandbox/linux/seccomp-bpf/syscall.cc
-index d53a7ff56..c290f0e92 100644
---- sandbox/linux/seccomp-bpf/syscall.cc
-+++ sandbox/linux/seccomp-bpf/syscall.cc
-@@ -499,9 +499,9 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // Same as MIPS, need to invert ret and set error register (cr0.SO)
- if (ret_val <= -1 && ret_val >= -4095) {
- ret_val = -ret_val;
-- ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr |= (1 << 28);
- } else {
-- ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr &= ~(1 << 28);
- }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
---- third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-+++ third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-@@ -22,6 +22,7 @@
- // The following platforms have an implementation of a hardware counter.
- #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
- defined(__powerpc__) || defined(__ppc__) || defined(__riscv) || \
-+ ((defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__)) || defined(__riscv) || \
- defined(_M_IX86) || (defined(_M_X64) && !defined(_M_ARM64EC))
- #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1
- #else
---- third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-+++ third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-@@ -64,7 +64,7 @@
- #elif defined(__i386__) || defined(__x86_64__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_x86-inl.inc"
--#elif defined(__ppc__) || defined(__PPC__)
-+#elif (defined(__ppc__) || defined(__PPC__)) && defined(__GLIBC__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_powerpc-inl.inc"
- #elif defined(__aarch64__)
-diff --git third_party/breakpad/BUILD.gn third_party/breakpad/BUILD.gn
-index f9a60e37..25f3a0b7 100644
---- third_party/breakpad/BUILD.gn
-+++ third_party/breakpad/BUILD.gn
-@@ -637,6 +637,7 @@ if (is_linux || is_android) {
-
- if (current_cpu == "ppc64") {
- defines = [ "HAVE_GETCONTEXT" ]
-+ libs += [ "ucontext" ]
- } else {
- sources += [
- "breakpad/src/common/linux/breakpad_getcontext.S"
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index 03afec7a..0264ecf1 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -273,6 +273,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t ThreadInfo::GetInstructionPointer() const {
- return mcontext.gp_regs[PT_NIP];
- }
-@@ -290,9 +293,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->ctr = mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] = \
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 1090470f..e580233d 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -257,6 +257,9 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
- return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
- }
-@@ -280,9 +283,9 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&uc->uc_mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&uc->uc_mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] =
-diff --git third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index 5a7ab50c..ee8b858c 100644
---- third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -105,6 +105,11 @@
- #define PR_SET_PTRACER 0x59616d61
- #endif
-
-+/* musl hack, can't include asm/ptrace.h as that causes conflicts */
-+#if defined(__powerpc64__) && !defined(PT_NIP)
-+#define PT_NIP 32
-+#endif
-+
- namespace google_breakpad {
-
- namespace {
-diff --git third_party/crashpad/crashpad/snapshot/linux/signal_context.h third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 8e335a09..b2a0f155 100644
---- third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -469,7 +469,7 @@ struct MContext64 {
- SignalThreadContext64 gp_regs;
- SignalFloatContext64 fp_regs;
- SignalVectorContext64 *v_regs;
-- int64_t vmx_reserve[69];
-+ int64_t vmx_reserve[101];
- };
-
- struct ContextTraits64 : public Traits64 {
-diff --git third_party/crashpad/crashpad/util/linux/thread_info.h third_party/crashpad/crashpad/util/linux/thread_info.h
-index dea0d1f3..b203e5b2 100644
---- third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -30,6 +30,7 @@
-
- #if defined(ARCH_CPU_PPC64_FAMILY)
- #include <sys/ucontext.h>
-+#include <asm/ptrace.h>
- #endif
-
- namespace crashpad {
-diff --git third_party/lss/linux_syscall_support.h third_party/lss/linux_syscall_support.h
-index 9955ce44..4c1cc488 100644
---- third_party/lss/linux_syscall_support.h
-+++ third_party/lss/linux_syscall_support.h
-@@ -4216,9 +4216,13 @@ struct kernel_statfs {
- }
- #endif
- #if defined(__NR_fstatat64)
-+ // musl does #define fstatat64 fstatat
-+ #undef fstatat64
- LSS_INLINE _syscall4(int, fstatat64, int, d,
- const char *, p,
- struct kernel_stat64 *, b, int, f)
-+ // set it back like it was
-+ #define fstatat64 fstatat
- #endif
- #if defined(__NR_waitpid)
- // waitpid is polyfilled below when not available.
diff --git a/srcpkgs/chromium/patches/build-add-use_cxx17.patch b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
index 091b1c553727..b50825fb7e2c 100644
--- a/srcpkgs/chromium/patches/build-add-use_cxx17.patch
+++ b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
@@ -1,26 +1,22 @@
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
-@@ -167,6 +167,10 @@
- # Enable -H, which prints the include tree during compilation.
- # For use by tools/clang/scripts/analyze_includes.py
- show_includes = false
-+
-+ # Allow projects that wish to stay on C++17 to override Chromium's default.
-+ # TODO(crbug.com/1402249): evaluate removing this end of 2023
-+ use_cxx17 = false
+@@ -191,6 +191,10 @@
+ current_cpu == "x64"))))
}
- declare_args() {
-@@ -596,7 +600,11 @@
- } else if (is_linux) {
- # TODO(crbug.com/1284275): Switch to C++20 on all platforms.
- if (is_clang) {
-- cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ if (use_cxx17) {
-+ cflags_cc += [ "-std=${standard_prefix}++17" ]
-+ } else {
-+ cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ }
++declare_args() {
++ use_cxx17 = false
++}
++
+ if (is_android || (is_chromeos_ash && is_chromeos_device)) {
+ # Set the path to use orderfile for linking Chrome
+ # Note that this is for using only one orderfile for linking
+@@ -605,7 +609,7 @@
+ cflags_cc += [ "-fno-trigraphs" ]
+ }
+ } else if (is_clang) {
+- if (is_chromeos_device) {
++ if (is_chromeos_device || use_cxx17) {
+ # TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
+ cflags_cc += [ "-std=${standard_prefix}++17" ]
} else {
- # The gcc bots are currently using GCC 9, which is not new enough to
- # support "c++20"/"gnu++20".
diff --git a/srcpkgs/chromium/patches/fix-build-with-old-clang.patch b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
new file mode 100644
index 000000000000..f23218e71e4d
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
@@ -0,0 +1,20 @@
+--- a/build/config/compiler/BUILD.gn
++++ b/build/config/compiler/BUILD.gn
+@@ -805,17 +805,6 @@
+ cflags += [ "-fcomplete-member-pointers" ]
+ }
+
+- # Use DWARF simple template names, with the following exceptions:
+- #
+- # * Windows is not supported as it doesn't use DWARF.
+- # * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
+- # lldb doesn't have the needed changes yet.
+- # * Fuchsia isn't supported as zxdb doesn't support simple template names yet.
+- # TODO(crbug.com/1379070): Remove if the upstream default ever changes.
+- if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
+- cflags_cc += [ "-gsimple-template-names" ]
+- }
+-
+ # MLGO specific flags. These flags enable an ML-based inliner trained on
+ # Chrome on Android (arm32) with ThinLTO enabled, optimizing for size.
+ # The "release" ML model is embedded into clang as part of its build.
diff --git a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch b/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
deleted file mode 100644
index cd5533190db9..000000000000
--- a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- a/base/threading/platform_thread_linux.cc
-+++ b/base/threading/platform_thread_linux.cc
-@@ -436,8 +436,13 @@
-
- size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
- #if !defined(THREAD_SANITIZER)
-+#if defined(__GLIBC__)
- return 0;
- #else
-+ // musl libcs default is too small, use 8mb like glibc
-+ return (1 << 23);
-+#endif
-+#else
- // ThreadSanitizer bloats the stack heavily. Evidence has been that the
- // default stack size isn't enough for some browser tests.
- return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux).
---- a/chrome/browser/shutdown_signal_handlers_posix.cc
-+++ b/chrome/browser/shutdown_signal_handlers_posix.cc
-@@ -188,11 +188,21 @@
- g_shutdown_pipe_read_fd = pipefd[0];
- g_shutdown_pipe_write_fd = pipefd[1];
- #if !defined(ADDRESS_SANITIZER)
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
- #else
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 * 8;
-+#endif
-+#else
- // ASan instrumentation bloats the stack frames, so we need to increase the
- // stack size to avoid hitting the guard page.
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
-+#else
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 * 8;
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+#endif
- #endif
- ShutdownDetector* detector = new ShutdownDetector(
- g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);
diff --git a/srcpkgs/chromium/patches/fix-narrowing-cast.patch b/srcpkgs/chromium/patches/fix-narrowing-cast.patch
deleted file mode 100644
index afd42a1489ae..000000000000
--- a/srcpkgs/chromium/patches/fix-narrowing-cast.patch
+++ /dev/null
@@ -1,53 +0,0 @@
---- a/base/files/file_util_linux.cc
-+++ b/base/files/file_util_linux.cc
-@@ -23,14 +23,14 @@
-
- // Not all possible |statfs_buf.f_type| values are in linux/magic.h.
- // Missing values are copied from the statfs man page.
-- switch (statfs_buf.f_type) {
-+ switch (static_cast<uintmax_t>(statfs_buf.f_type)) {
- case 0:
- *type = FILE_SYSTEM_0;
- break;
- case EXT2_SUPER_MAGIC: // Also ext3 and ext4
- case MSDOS_SUPER_MAGIC:
- case REISERFS_SUPER_MAGIC:
-- case static_cast<int>(BTRFS_SUPER_MAGIC):
-+ case BTRFS_SUPER_MAGIC:
- case 0x5346544E: // NTFS
- case 0x58465342: // XFS
- case 0x3153464A: // JFS
-@@ -40,14 +40,14 @@
- *type = FILE_SYSTEM_NFS;
- break;
- case SMB_SUPER_MAGIC:
-- case static_cast<int>(0xFF534D42): // CIFS
-+ case 0xFF534D42: // CIFS
- *type = FILE_SYSTEM_SMB;
- break;
- case CODA_SUPER_MAGIC:
- *type = FILE_SYSTEM_CODA;
- break;
-- case static_cast<int>(HUGETLBFS_MAGIC):
-- case static_cast<int>(RAMFS_MAGIC):
-+ case HUGETLBFS_MAGIC:
-+ case RAMFS_MAGIC:
- case TMPFS_MAGIC:
- *type = FILE_SYSTEM_MEMORY;
- break;
---- a/base/system/sys_info_posix.cc
-+++ b/base/system/sys_info_posix.cc
-@@ -100,10 +100,10 @@
- if (HANDLE_EINTR(statfs(path.value().c_str(), &stats)) != 0)
- return false;
-
-- switch (stats.f_type) {
-+ switch (static_cast<uintmax_t>(stats.f_type)) {
- case TMPFS_MAGIC:
-- case static_cast<int>(HUGETLBFS_MAGIC):
-- case static_cast<int>(RAMFS_MAGIC):
-+ case HUGETLBFS_MAGIC:
-+ case RAMFS_MAGIC:
- return true;
- }
- return false;
diff --git a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch b/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
deleted file mode 100644
index 7a0337f3bf3b..000000000000
--- a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/third_party/nasm/config/config-linux.h
-+++ b/third_party/nasm/config/config-linux.h
-@@ -139,7 +139,9 @@
- #define HAVE_ACCESS 1
-
- /* Define to 1 if you have the `canonicalize_file_name' function. */
-+#ifdef __GLIBC__
- #define HAVE_CANONICALIZE_FILE_NAME 1
-+#endif
-
- /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
- /* #undef HAVE_CPU_TO_LE16 */
diff --git a/srcpkgs/chromium/patches/narrowing-cast.patch b/srcpkgs/chromium/patches/narrowing-cast.patch
new file mode 100644
index 000000000000..d10940eb7e89
--- /dev/null
+++ b/srcpkgs/chromium/patches/narrowing-cast.patch
@@ -0,0 +1,21 @@
+from the manpage for statfs:
+
+The __fsword_t type used for various fields in the statfs structure
+definition is a glibc internal type, not intended for public use. This
+leaves the programmer in a bit of a conundrum when trying to copy or
+compare these fields to local variables in a program. Using
+unsigned int for such variables suffices on most systems.
+
+--- a/base/system/sys_info_posix.cc
++++ b/base/system/sys_info_posix.cc
+@@ -64,8 +64,8 @@
+
+ switch (stats.f_type) {
+ case TMPFS_MAGIC:
+- case static_cast<int>(HUGETLBFS_MAGIC):
+- case static_cast<int>(RAMFS_MAGIC):
++ case static_cast<unsigned int>(HUGETLBFS_MAGIC):
++ case static_cast<unsigned int>(RAMFS_MAGIC):
+ return true;
+ }
+ return false;
diff --git a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch b/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
deleted file mode 100644
index 13d504d3e792..000000000000
--- a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From dda01a706453ded8c01c41775707cb5ef4e316f8 Mon Sep 17 00:00:00 2001
-From: Andres Salomon <dilinger@queued.net>
-Date: Tue, 25 Oct 2022 21:11:46 +0000
-Subject: [PATCH] Re-fix TFLite build error on linux when using the system zlib
-
-In commit ae0f9adb7e14c0d19ca695ef6ad40b321a8cb64c, I fixed some build
-errors related to minizip patch inclusion in TFLite. However, after that
-when TFLite Support was rolled to HEAD, a small part of that patch got
-dropped. The result is the following build error with 107.0.5304.62:
-
-../../third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc:22:10: fatal error: 'contrib/minizip/ioapi.h' file not found
- ^~~~~~~~~~~~~~~~~~~~~~~~~
-1 error generated.
-
-This commit re-adds the lost fix.
-
-R=junzou@chromium.org
-
-Change-Id: Ie96c3571894b5100a1e2a2771da29699eff0beb3
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3972087
-Reviewed-by: Robert Ogden <robertogden@chromium.org>
-Commit-Queue: Robert Ogden <robertogden@chromium.org>
-Auto-Submit: Andres Salomon <dilinger@queued.net>
-Cr-Commit-Position: refs/heads/main@{#1063478}
----
- .../metadata/cc/utils/zip_readonly_mem_file.cc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-index 392b6b411fe..525ae4a2b45 100644
---- a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-+++ b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-@@ -19,7 +19,7 @@ limitations under the License.
- #include <cstdio>
-
- #include "absl/strings/string_view.h" // from @com_google_absl
--#include "contrib/minizip/ioapi.h"
-+#include "third_party/zlib/contrib/minizip/ioapi.h"
-
- namespace tflite {
- namespace metadata {
diff --git a/srcpkgs/chromium/patches/remove-strip_binary.patch b/srcpkgs/chromium/patches/remove-strip_binary.patch
deleted file mode 100644
index 8b13c6a056a8..000000000000
--- a/srcpkgs/chromium/patches/remove-strip_binary.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/chrome/test/chromedriver/BUILD.gn.orig
-+++ b/chrome/test/chromedriver/BUILD.gn
-@@ -308,11 +308,7 @@
- }
- }
-
--if (is_linux) {
-- chromedriver_output = "chromedriver.unstripped"
--} else {
-- chromedriver_output = "chromedriver"
--}
-+chromedriver_output = "chromedriver"
-
- executable("$chromedriver_output") {
- testonly = true
-@@ -336,16 +332,6 @@
- }
- }
-
--if (is_linux) {
-- strip_binary("chromedriver") {
-- testonly = true
-- binary_input = "$root_out_dir/$chromedriver_output"
-- symbol_output = "$root_out_dir/chromedriver.debug"
-- stripped_binary_output = "$root_out_dir/chromedriver"
-- deps = [ ":$chromedriver_output" ]
-- }
--}
--
- python_library("chromedriver_py_tests") {
- testonly = true
- deps = [
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch b/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
deleted file mode 100644
index 28c4ad35f14e..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-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;
-
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch b/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
deleted file mode 100644
index 0c03ad4a65eb..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-commit 981437bc846fcdb854062e89fd3d86f112e5f426
-Author: q66 <daniel@octaforge.org>
-Date: Sat Jun 25 12:35:37 2022 +0200
-
- Use generic target for now.
-
- This is because the source tree is missing vsx optimizations that
- then do not get included and result in failed linking such as:
-
- ld.lld: error: undefined symbol: vpx_mse16x16_vsx
-
-diff --git a/third_party/libvpx/generate_gni.sh b/third_party/libvpx/generate_gni.sh
-index 7429080..43ee29a 100755
---- a/third_party/libvpx/generate_gni.sh
-+++ b/third_party/libvpx/generate_gni.sh
-@@ -405,7 +405,7 @@
- gen_config_files linux/mips64el "--target=mips64-linux-gcc ${all_platforms}"
- gen_config_files linux/loongarch \
- "--target=loongarch64-linux-gcc ${all_platforms}"
--gen_config_files linux/ppc64 "--target=ppc64le-linux-gcc ${all_platforms}"
-+gen_config_files linux/ppc64 "--target=generic-gnu ${all_platforms}"
- gen_config_files linux/generic "--target=generic-gnu $HIGHBD ${all_platforms}"
- gen_config_files win/arm64 \
- "--target=arm64-win64-vs15 ${all_platforms} ${HIGHBD}"
-@@ -468,7 +468,7 @@
- gen_rtcd_header linux/mipsel mipsel
- gen_rtcd_header linux/mips64el mips64el
- gen_rtcd_header linux/loongarch loongarch
--gen_rtcd_header linux/ppc64 ppc
-+gen_rtcd_header linux/ppc64 generic
- gen_rtcd_header linux/generic generic
- gen_rtcd_header win/arm64 armv8
- gen_rtcd_header win/ia32 x86 "${require_sse2}"
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch b/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
deleted file mode 100644
index 4bfb5d494b06..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/sandbox/linux/system_headers/linux_stat.h
-+++ b/sandbox/linux/system_headers/linux_stat.h
-@@ -155,6 +155,28 @@ struct kernel_stat {
- unsigned int __unused4;
- unsigned int __unused5;
- };
-+#elif defined(__powerpc64__)
-+struct kernel_stat {
-+ unsigned long st_dev;
-+ unsigned long st_ino;
-+ unsigned long st_nlink;
-+ unsigned int st_mode;
-+ unsigned int st_uid;
-+ unsigned int st_gid;
-+ unsigned long st_rdev;
-+ long st_size;
-+ unsigned long st_blksize;
-+ unsigned long st_blocks;
-+ unsigned long st_atime_;
-+ unsigned long st_atime_nsec_;
-+ unsigned long st_mtime_;
-+ unsigned long st_mtime_nsec_;
-+ unsigned long st_ctime_;
-+ unsigned long st_ctime_nsec_;
-+ unsigned long __unused4;
-+ unsigned long __unused5;
-+ unsigned long __unused6;
-+};
- #endif
-
- // On 32-bit systems, we default to the 64-bit stat struct like libc
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 0bc505358916..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,3590 +0,0 @@
-commit 2c013a317b1114ef67cdbbc30824b28907b9ea94
-Author: Daniel Kolesa <daniel@octaforge.org>
-Date: Wed Mar 3 19:08:29 2021 +0100
-
- ppc64le support
-
-diff --git a/build/download_nacl_toolchains.py b/build/download_nacl_toolchains.py
-index 286a92a27..ec36a85d3 100755
---- a/build/download_nacl_toolchains.py
-+++ b/build/download_nacl_toolchains.py
-@@ -13,6 +13,10 @@ import sys
-
-
- def Main(args):
-+ # If `disable_nacl=1` is in GYP_DEFINES, exit
-+ if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''):
-+ return 0
-+
- script_dir = os.path.dirname(os.path.abspath(__file__))
- src_dir = os.path.dirname(script_dir)
- nacl_dir = os.path.join(src_dir, 'native_client')
---- a/chrome/installer/linux/BUILD.gn
-+++ b/chrome/installer/linux/BUILD.gn
-@@ -97,8 +97,6 @@
- "$root_out_dir/xdg-mime",
- "$root_out_dir/xdg-settings",
- "$root_out_dir/locales/en-US.pak",
-- "$root_out_dir/MEIPreload/manifest.json",
-- "$root_out_dir/MEIPreload/preloaded_data.pb",
- ]
-
- action_foreach("calculate_deb_dependencies") {
-@@ -377,7 +377,6 @@
- "//chrome",
- "//chrome:packed_resources",
- "//chrome/browser/enterprise/connectors/device_trust/key_management/installer/management_service:chrome_management_service",
-- "//chrome/browser/resources/media/mei_preload:component",
- "//components/crash/core/app:chrome_crashpad_handler",
- "//sandbox/linux:chrome_sandbox",
- ]
-diff --git a/sandbox/features.gni b/sandbox/features.gni
-index db30ae6d6..9dc09bf53 100644
---- a/sandbox/features.gni
-+++ b/sandbox/features.gni
-@@ -11,7 +11,8 @@ import("//build/config/nacl/config.gni")
- use_seccomp_bpf = (is_linux || is_chromeos || is_android) &&
- (current_cpu == "x86" || current_cpu == "x64" ||
- current_cpu == "arm" || current_cpu == "arm64" ||
-- current_cpu == "mipsel" || current_cpu == "mips64el")
-+ current_cpu == "mipsel" || current_cpu == "mips64el" ||
-+ current_cpu == "ppc64")
-
- use_seccomp_bpf = use_seccomp_bpf || is_nacl_nonsfi
-
-diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn
-index e9a94b461..cca1a5da5 100644
---- a/sandbox/linux/BUILD.gn
-+++ b/sandbox/linux/BUILD.gn
-@@ -427,6 +427,8 @@ component("sandbox_services") {
-
- source_set("sandbox_services_headers") {
- sources = [
-+ "system_headers/ppc64_linux_syscalls.h",
-+ "system_headers/ppc64_linux_ucontext.h",
- "system_headers/arm64_linux_syscalls.h",
- "system_headers/arm_linux_syscalls.h",
- "system_headers/arm_linux_ucontext.h",
-diff --git a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-index 313511f22..0ca3a326f 100644
---- a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-+++ b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-@@ -56,6 +56,13 @@
- #define MAX_PUBLIC_SYSCALL __NR_syscalls
- #define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-
-+#elif defined(__powerpc64__)
-+
-+#include <asm-generic/unistd.h>
-+#define MIN_SYSCALL 0u
-+#define MAX_PUBLIC_SYSCALL __NR_syscalls
-+#define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-+
- #else
- #error "Unsupported architecture"
- #endif
-diff --git a/sandbox/linux/bpf_dsl/seccomp_macros.h b/sandbox/linux/bpf_dsl/seccomp_macros.h
-index 1a407b952..a6aec544e 100644
---- a/sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ b/sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,6 +16,9 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
-+#elif defined(__powerpc64__)
-+// Manually define greg_t on ppc64
-+typedef unsigned long long greg_t;
- #endif
- #endif
-
-@@ -346,6 +349,51 @@ struct regs_struct {
- #define SECCOMP_PT_PARM4(_regs) (_regs).regs[3]
- #define SECCOMP_PT_PARM5(_regs) (_regs).regs[4]
- #define SECCOMP_PT_PARM6(_regs) (_regs).regs[5]
-+
-+#elif defined(__powerpc64__)
-+#include <asm/ptrace.h>
-+
-+typedef struct pt_regs regs_struct;
-+
-+#ifdef ARCH_CPU_LITTLE_ENDIAN
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64LE
-+#else
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64
-+#endif
-+
-+#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+
-+#define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
-+#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
-+#define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-+#define SECCOMP_PARM4(_ctx) SECCOMP_REG(_ctx, 6)
-+#define SECCOMP_PARM5(_ctx) SECCOMP_REG(_ctx, 7)
-+#define SECCOMP_PARM6(_ctx) SECCOMP_REG(_ctx, 8)
-+
-+#define SECCOMP_NR_IDX (offsetof(struct arch_seccomp_data, nr))
-+#define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch))
-+#define SECCOMP_IP_MSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 4)
-+#define SECCOMP_IP_LSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 0)
-+#define SECCOMP_ARG_MSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 4)
-+#define SECCOMP_ARG_LSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 0)
-+
-+#define SECCOMP_PT_RESULT(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_SYSCALL(_regs) (_regs).gpr[0]
-+#define SECCOMP_PT_IP(_regs) (_regs).nip
-+#define SECCOMP_PT_PARM1(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_PARM2(_regs) (_regs).gpr[4]
-+#define SECCOMP_PT_PARM3(_regs) (_regs).gpr[5]
-+#define SECCOMP_PT_PARM4(_regs) (_regs).gpr[6]
-+#define SECCOMP_PT_PARM5(_regs) (_regs).gpr[7]
-+#define SECCOMP_PT_PARM6(_regs) (_regs).gpr[8]
-+
- #else
- #error Unsupported target platform
-
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-index 6a1ec2389..f20c582dd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-@@ -88,7 +88,8 @@ bool IsBaselinePolicyWatched(int sysno) {
- SyscallSets::IsPrctl(sysno) ||
- SyscallSets::IsProcessGroupOrSession(sysno) ||
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- SyscallSets::IsSocketCall(sysno) ||
- #endif
- #if defined(__arm__)
-@@ -227,7 +228,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_mmap)
- return RestrictMmapFlags();
- #endif
-@@ -245,7 +246,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- return RestrictPrctl();
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_socketpair) {
- // Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen.
- static_assert(AF_UNIX == PF_UNIX,
-@@ -285,7 +286,8 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- if (SyscallSets::IsSocketCall(sysno))
- return RestrictSocketcallCommand();
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:11:10.481579470 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:12:43.524831376 -0400
-@@ -302,7 +302,7 @@
- TEST_BASELINE_SIGSYS(__NR_syslog)
- TEST_BASELINE_SIGSYS(__NR_timer_create)
-
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- TEST_BASELINE_SIGSYS(__NR_inotify_init)
- TEST_BASELINE_SIGSYS(__NR_vserver)
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-@@ -358,7 +358,16 @@
- if (args.nr == __NR_fstatat_default) {
- if (*reinterpret_cast<const char*>(args.args[1]) == '\0' &&
- args.args[3] == static_cast<uint64_t>(AT_EMPTY_PATH)) {
-- return syscall(__NR_fstat_default, static_cast<int>(args.args[0]),
-+ int fd = static_cast<int>(args.args[0]);
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO: Investigate the root cause and fix in glibc
-+ if (fd < 0)
-+ fd = -fd;
-+#endif
-+ return syscall(__NR_fstat_default, fd,
- reinterpret_cast<default_stat_struct*>(args.args[2]));
- }
- return -reinterpret_cast<intptr_t>(fs_denied_errno);
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
-index 2a97d3916..8e81aa6cf 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-14 14:41:08.000000000 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-15 13:17:57.808715733 -0400
-@@ -37,7 +37,8 @@
-
- #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
- !defined(__arm__) && !defined(__aarch64__) && \
-- !defined(PTRACE_GET_THREAD_AREA)
-+ !defined(PTRACE_GET_THREAD_AREA) && \
-+ !defined(__powerpc64__)
- // Also include asm/ptrace-abi.h since ptrace.h in older libc (for instance
- // the one in Ubuntu 16.04 LTS) is missing PTRACE_GET_THREAD_AREA.
- // asm/ptrace-abi.h doesn't exist on arm32 and PTRACE_GET_THREAD_AREA isn't
-@@ -45,6 +46,11 @@
- #include <asm/ptrace-abi.h>
- #endif
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- #if BUILDFLAG(IS_ANDROID)
-
- #if !defined(F_DUPFD_CLOEXEC)
-@@ -99,6 +105,14 @@
- return true;
- #else
- return false;
-+#endif
-+}
-+
-+inline bool IsArchitecturePPC64() {
-+#if defined(__powerpc64__)
-+ return true;
-+#else
-+ return false;
- #endif
- }
-
-@@ -239,6 +254,8 @@
- uint64_t kOLargeFileFlag = O_LARGEFILE;
- if (IsArchitectureX86_64() || IsArchitectureI386() || IsArchitectureMips())
- kOLargeFileFlag = 0100000;
-+ else if (IsArchitecturePPC64())
-+ kOLargeFileFlag = 0200000;
-
- const Arg<int> cmd(1);
- const Arg<long> long_arg(2);
-@@ -256,7 +273,16 @@
- F_SETLKW,
- F_GETLK,
- F_DUPFD,
-- F_DUPFD_CLOEXEC),
-+ F_DUPFD_CLOEXEC
-+#if defined(__powerpc64__)
-+// On PPC64, F_SETLK, F_GETLK, F_SETLKW are defined as the 64-bit variants
-+// but glibc will sometimes still use the 32-bit versions. Allow both.
-+ ,
-+ 5, /* F_GETLK (32) */
-+ 6, /* F_SETLK (32) */
-+ 7 /* F_SETLKW (32) */
-+#endif
-+ ),
- Allow())
- .Case(F_SETFL,
- If((long_arg & ~kAllowedMask) == 0, Allow()).Else(CrashSIGSYS()))
-@@ -266,7 +292,7 @@
- // clang-format on
- }
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- ResultExpr RestrictSocketcallCommand() {
- // Unfortunately, we are unable to restrict the first parameter to
- // socketpair(2). Whilst initially sounding bad, it's noteworthy that very
-@@ -419,7 +445,7 @@
- #endif
- return Switch(request)
- .CASES((
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- PTRACE_GETREGS, PTRACE_GETFPREGS, PTRACE_GET_THREAD_AREA,
- PTRACE_GETREGSET,
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-index ba4289f05..9a4d5ab2d 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-@@ -48,7 +48,7 @@ SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictMprotectFlags();
- // O_NONBLOCK | O_SYNC | O_LARGEFILE | O_CLOEXEC | O_NOATIME.
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictFcntlCommands();
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- // Restrict socketcall(2) to only allow socketpair(2), send(2), recv(2),
- // sendto(2), recvfrom(2), shutdown(2), sendmsg(2) and recvmsg(2).
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictSocketcallCommand();
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-index 642df7207..34f47eb73 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-@@ -29,7 +29,8 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- switch (sysno) {
- case __NR_gettimeofday:
- #if defined(__i386__) || defined(__x86_64__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_time:
- #endif
- return true;
-@@ -52,12 +53,14 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- case __NR_clock_nanosleep_time64: // Parameters filtered by RestrictClockID().
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ftime: // Obsolete.
- #endif
- case __NR_settimeofday: // Privileged.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stime:
- #endif
- default:
-@@ -135,7 +138,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_faccessat: // EPERM not a valid errno.
- case __NR_fchmodat:
- case __NR_fchownat: // Should be called chownat ?
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat: // fstatat(). EPERM not a valid errno.
- #elif defined(__i386__) || defined(__arm__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-@@ -154,7 +157,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_memfd_create:
- case __NR_mkdirat:
- case __NR_mknodat:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldlstat:
- case __NR_oldstat:
- #endif
-@@ -168,7 +171,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- #endif
- case __NR_statfs: // EPERM not a valid errno.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_statfs64:
- #endif
- case __NR_symlinkat:
-@@ -178,7 +182,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_truncate64:
- #endif
- case __NR_unlinkat:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_utime:
- #endif
- case __NR_utimensat: // New.
-@@ -203,7 +208,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- #endif
- return true;
- // TODO(jln): these should be denied gracefully as well (moved below).
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_fadvise64: // EPERM not a valid errno.
- #endif
- #if defined(__i386__)
-@@ -216,11 +222,12 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_flock: // EPERM not a valid errno.
- case __NR_fstatfs: // Give information about the whole filesystem.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_fstatfs64:
- #endif
- case __NR_fsync: // EPERM not a valid errno.
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldfstat:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-@@ -228,6 +235,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_sync_file_range: // EPERM not a valid errno.
- #elif defined(__arm__)
- case __NR_arm_sync_file_range: // EPERM not a valid errno.
-+#elif defined(__powerpc64__)
-+ case __NR_sync_file_range2: // EPERM not a valid errno.
- #endif
- default:
- return false;
-@@ -248,7 +257,8 @@ bool SyscallSets::IsDeniedFileSystemAccessViaFd(int sysno) {
- #endif
- case __NR_getdents64: // EPERM not a valid errno.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_readdir:
- #endif
- return true;
-@@ -289,7 +299,7 @@ bool SyscallSets::IsGetSimpleId(int sysno) {
- bool SyscallSets::IsProcessPrivilegeChange(int sysno) {
- switch (sysno) {
- case __NR_capset:
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_ioperm: // Intel privilege.
- case __NR_iopl: // Intel privilege.
- #endif
-@@ -340,8 +350,11 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- case __NR_rt_sigreturn:
- case __NR_rt_sigtimedwait:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
-+#ifndef __powerpc64__
- case __NR_rt_sigtimedwait_time64:
-+#endif
- case __NR_sigaction:
- case __NR_sigprocmask:
- case __NR_sigreturn:
-@@ -357,7 +370,8 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- #endif
- case __NR_signalfd4:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_sigpending:
- case __NR_sigsuspend:
- #endif
-@@ -381,7 +395,7 @@ bool SyscallSets::IsAllowedOperationOnFd(int sysno) {
- #endif
- case __NR_dup3:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_shutdown:
- #endif
- return true;
-@@ -414,7 +428,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- case __NR_exit_group:
- case __NR_wait4:
- case __NR_waitid:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_waitpid:
- #endif
- return true;
-@@ -431,7 +445,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- #endif
- case __NR_set_tid_address:
- case __NR_unshare:
--#if !defined(__mips__) && !defined(__aarch64__)
-+#if !defined(__mips__) && !defined(__aarch64__) || defined(__powerpc64__)
- case __NR_vfork:
- #endif
- default:
-@@ -484,7 +498,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- return true;
- default:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_socketpair: // We will want to inspect its argument.
- #endif
- return false;
-@@ -494,7 +508,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- switch (sysno) {
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_accept:
- case __NR_accept4:
- case __NR_bind:
-@@ -509,7 +523,8 @@ bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- bool SyscallSets::IsSocketCall(int sysno) {
- switch (sysno) {
-@@ -523,7 +538,8 @@ bool SyscallSets::IsSocketCall(int sysno) {
- }
- #endif
-
--#if defined(__x86_64__) || defined(__arm__) || defined(__mips__)
-+#if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- bool SyscallSets::IsNetworkSocketInformation(int sysno) {
- switch (sysno) {
- case __NR_getpeername:
-@@ -548,7 +564,7 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
- case __NR_mincore:
- case __NR_mlockall:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_mmap:
- #endif
- #if defined(__i386__) || defined(__arm__) || \
-@@ -578,7 +594,8 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- switch (sysno) {
- case __NR_lseek:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR__llseek:
- #endif
- #if !defined(__aarch64__)
-@@ -598,26 +615,28 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- case __NR_readv:
- case __NR_pread64:
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_recv:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_recvfrom: // Could specify source.
- case __NR_recvmsg: // Could specify source.
- #endif
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_select:
- #endif
--#if defined(__i386__) || defined(__arm__) || defined(__mips__)
-+#if defined(__i386__) || defined(__arm__) || defined(__mips__) || defined(__powerpc64__)
- case __NR__newselect:
- #endif
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_send:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_sendmsg: // Could specify destination.
- case __NR_sendto: // Could specify destination.
- #endif
-@@ -673,7 +692,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- return true;
- case __NR_getpriority:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_nice:
- #endif
- case __NR_setpriority:
-@@ -685,7 +705,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- bool SyscallSets::IsAdminOperation(int sysno) {
- switch (sysno) {
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_bdflush:
- #endif
- case __NR_kexec_load:
-@@ -701,7 +722,8 @@ bool SyscallSets::IsAdminOperation(int sysno) {
-
- bool SyscallSets::IsKernelModule(int sysno) {
- switch (sysno) {
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_create_module:
- case __NR_get_kernel_syms: // Should ENOSYS.
- case __NR_query_module:
-@@ -734,7 +756,8 @@ bool SyscallSets::IsFsControl(int sysno) {
- case __NR_swapoff:
- case __NR_swapon:
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_umount:
- #endif
- case __NR_umount2:
-@@ -750,7 +773,7 @@ bool SyscallSets::IsNuma(int sysno) {
- case __NR_getcpu:
- case __NR_mbind:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_migrate_pages:
- #endif
- case __NR_move_pages:
-@@ -785,14 +808,15 @@ bool SyscallSets::IsGlobalProcessEnvironment(int sysno) {
- switch (sysno) {
- case __NR_acct: // Privileged.
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
--#if defined(__i386__) || defined(__arm__)
-+#if defined(__i386__) || defined(__arm__) || defined(__powerpc64__)
- case __NR_ugetrlimit:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ulimit:
- #endif
- case __NR_getrusage:
-@@ -826,7 +850,7 @@ bool SyscallSets::IsGlobalSystemStatus(int sysno) {
- #endif
- case __NR_sysinfo:
- case __NR_uname:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_olduname:
- case __NR_oldolduname:
- #endif
-@@ -892,8 +916,16 @@ bool SyscallSets::IsSystemVSemaphores(int sysno) {
- }
- #endif
-
-+/* shitty hack around Void's 4.19 kernel headers missing those numbers */
-+#if defined(__powerpc64__) && !defined(__NR_shmget)
-+#define __NR_shmget 395
-+#define __NR_shmctl 396
-+#define __NR_shmat 397
-+#define __NR_shmdt 398
-+#endif
-+
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- bool SyscallSets::IsSystemVSharedMemory(int sysno) {
-@@ -925,7 +957,8 @@ bool SyscallSets::IsSystemVMessageQueue(int sysno) {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- bool SyscallSets::IsSystemVIpc(int sysno) {
- switch (sysno) {
-@@ -945,7 +978,8 @@ bool SyscallSets::IsAnySystemV(int sysno) {
- return IsSystemVMessageQueue(sysno) || IsSystemVSemaphores(sysno) ||
- IsSystemVSharedMemory(sysno);
- #elif defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- return IsSystemVIpc(sysno);
- #endif
- }
-@@ -1002,7 +1036,8 @@ bool SyscallSets::IsFaNotify(int sysno) {
- bool SyscallSets::IsTimer(int sysno) {
- switch (sysno) {
- case __NR_getitimer:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_alarm:
- #endif
- case __NR_setitimer:
-@@ -1084,18 +1119,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_syncfs:
- case __NR_vhangup:
- // The system calls below are not implemented.
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_afs_syscall:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_break:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_getpmsg:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_gtty:
- case __NR_idle:
- case __NR_lock:
-@@ -1103,20 +1142,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_prof:
- case __NR_profil:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_putpmsg:
- #endif
- #if defined(__x86_64__)
- case __NR_security:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stty:
- #endif
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- case __NR_tuxcall:
- #endif
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- case __NR_vserver:
- #endif
- return true;
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-index 923533ec9..411f72acd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-@@ -43,13 +43,14 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsDeniedGetOrModifySocket(int sysno);
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- static bool IsSocketCall(int sysno);
- #endif
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- static bool IsNetworkSocketInformation(int sysno);
- #endif
-
-@@ -76,7 +77,7 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsSystemVSemaphores(int sysno);
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- static bool IsSystemVSharedMemory(int sysno);
-@@ -88,7 +89,8 @@ class SANDBOX_EXPORT SyscallSets {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- static bool IsSystemVIpc(int sysno);
- #endif
-diff --git a/sandbox/linux/seccomp-bpf/syscall.cc b/sandbox/linux/seccomp-bpf/syscall.cc
-index e47e98bf5..d53a7ff56 100644
---- a/sandbox/linux/seccomp-bpf/syscall.cc
-+++ b/sandbox/linux/seccomp-bpf/syscall.cc
-@@ -18,7 +18,7 @@ namespace sandbox {
- namespace {
-
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined (ARCH_CPU_PPC64_FAMILY)
- // Number that's not currently used by any Linux kernel ABIs.
- const int kInvalidSyscallNumber = 0x351d3;
- #else
-@@ -310,12 +310,56 @@ asm(// We need to be able to tell the kernel exactly where we made a
- // Enter the kernel
- "svc 0\n"
- "2:ret\n"
-+ ".cfi_endproc\n"
-+ ".size SyscallAsm, .-SyscallAsm\n"
-+#elif defined(__powerpc64__)
-+ ".text\n"
-+ ".align 4\n"
-+ ".type SyscallAsm @function\n"
-+ "SyscallAsm:\n"
-+ ".cfi_startproc\n"
-+
-+ // Check if r3 is negative
-+ "cmpdi 3, 0\n"
-+ "bgt 2f\n"
-+
-+ // Load address of 3f into r3 and return
-+ "mflr 10\n"
-+ "bl 1f\n"
-+ "1: mflr 3\n"
-+ "mtlr 10\n"
-+ "addi 3, 3, 4*13\n"
-+ "blr\n"
-+
-+ // Load arguments from array into r3-8
-+ // save param 3 in r10
-+ "2:\n"
-+ "mr 0, 3\n"
-+ "ld 3, 0(4)\n"
-+ "ld 5, 16(4)\n"
-+ "ld 6, 24(4)\n"
-+ "ld 7, 32(4)\n"
-+ "ld 8, 40(4)\n"
-+ "ld 4, 8(4)\n"
-+ "li 9, 0\n"
-+
-+ // Enter kernel
-+ "sc\n"
-+
-+ // Magic return address
-+ "3:\n"
-+ // Like MIPS, ppc64 return values are always positive.
-+ // Check for error in cr0.SO and negate upon error
-+ "bc 4, 3, 4f\n"
-+ "neg 3, 3\n"
-+ "4: blr\n"
-+
- ".cfi_endproc\n"
- ".size SyscallAsm, .-SyscallAsm\n"
- #endif
- ); // asm
-
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- extern "C" {
- intptr_t SyscallAsm(intptr_t nr, const intptr_t args[6]);
- }
-@@ -429,6 +473,8 @@ intptr_t Syscall::Call(int nr,
- ret = inout;
- }
-
-+#elif defined(__powerpc64__)
-+ intptr_t ret = SyscallAsm(nr, args);
- #else
- #error "Unimplemented architecture"
- #endif
-@@ -445,8 +491,18 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // needs to be changed back.
- ret_val = -ret_val;
- SECCOMP_PARM4(ctx) = 1;
-- } else
-+ } else {
- SECCOMP_PARM4(ctx) = 0;
-+ }
-+#endif
-+#if defined(__powerpc64__)
-+ // Same as MIPS, need to invert ret and set error register (cr0.SO)
-+ if (ret_val <= -1 && ret_val >= -4095) {
-+ ret_val = -ret_val;
-+ ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ } else {
-+ ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
- }
-diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc
-index f5b86a73a..5e6c4a068 100644
---- a/sandbox/linux/seccomp-bpf/trap.cc
-+++ b/sandbox/linux/seccomp-bpf/trap.cc
-@@ -232,6 +232,20 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
- SetIsInSigHandler();
- }
-
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO(shawn@anastas.io): investigate this issue further
-+ auto nr = SECCOMP_SYSCALL(ctx);
-+ if (nr == __NR_openat || nr == __NR_mkdirat || nr == __NR_faccessat || nr == __NR_readlinkat ||
-+ nr == __NR_renameat || nr == __NR_renameat2 || nr == __NR_newfstatat || nr == __NR_unlinkat) {
-+ if (static_cast<int>(SECCOMP_PARM1(ctx)) > 0) {
-+ SECCOMP_PARM1(ctx) = -SECCOMP_PARM1(ctx);
-+ }
-+ }
-+#endif
-+
- // Copy the seccomp-specific data into a arch_seccomp_data structure. This
- // is what we are showing to TrapFnc callbacks that the system call
- // evaluator registered with the sandbox.
-diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc
-index d7b5d8c44..4adc6d0d4 100644
---- a/sandbox/linux/services/credentials.cc
-+++ b/sandbox/linux/services/credentials.cc
-@@ -81,7 +81,7 @@ bool ChrootToSafeEmptyDir() {
- pid_t pid = -1;
- alignas(16) char stack_buf[PTHREAD_STACK_MIN];
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // The stack grows downward.
- void* stack = stack_buf + sizeof(stack_buf);
- #else
-@@ -90,7 +90,9 @@
-
- int clone_flags = CLONE_FS | LINUX_SIGCHLD;
- void* tls = nullptr;
--#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
-+// RAJA this might be it...
-+#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY) || \
-+ defined(ARCH_CPU_PPC64_FAMILY)) && \
- !defined(MEMORY_SANITIZER)
- // Use CLONE_VM | CLONE_VFORK as an optimization to avoid copying page tables.
- // Since clone writes to the new child's TLS before returning, we must set a
-@@ -98,6 +100,11 @@
- // glibc performs syscalls by calling a function pointer in TLS, so we do not
- // attempt this optimization.
- // TODO(crbug.com/1247458) Broken in MSan builds after LLVM f1bb30a4956f.
-+ //
-+ // NOTE: Without CLONE_VM, fontconfig will attempt to reload configuration
-+ // in every thread. Since the rendered threads are sandboxed without
-+ // filesystem access (e.g. to /etc/fonts/fonts.conf) this will cause font
-+ // configuraiton loading failures and no fonts will be displayed!
- clone_flags |= CLONE_VM | CLONE_VFORK | CLONE_SETTLS;
-
- char tls_buf[PTHREAD_STACK_MIN] = {0};
-diff --git a/sandbox/linux/services/syscall_wrappers.cc b/sandbox/linux/services/syscall_wrappers.cc
-index fcfd2aa12..f6eb32fb7 100644
---- a/sandbox/linux/services/syscall_wrappers.cc
-+++ b/sandbox/linux/services/syscall_wrappers.cc
-@@ -58,7 +58,7 @@ long sys_clone(unsigned long flags,
- #if defined(ARCH_CPU_X86_64)
- return syscall(__NR_clone, flags, child_stack, ptid, ctid, tls);
- #elif defined(ARCH_CPU_X86) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // CONFIG_CLONE_BACKWARDS defined.
- return syscall(__NR_clone, flags, child_stack, ptid, tls, ctid);
- #endif
-diff --git a/sandbox/linux/syscall_broker/broker_process.cc b/sandbox/linux/syscall_broker/broker_process.cc
-index d72c9d238..77f1d95f5 100644
---- a/sandbox/linux/syscall_broker/broker_process.cc
-+++ b/sandbox/linux/syscall_broker/broker_process.cc
-@@ -169,7 +169,7 @@ bool BrokerProcess::IsSyscallBrokerable(int sysno, bool fast_check) const {
- #if defined(__NR_fstatat64)
- case __NR_fstatat64:
- #endif
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat:
- #endif
- return !fast_check || allowed_command_set_.test(COMMAND_STAT);
-diff --git a/sandbox/linux/system_headers/linux_seccomp.h b/sandbox/linux/system_headers/linux_seccomp.h
-index 1fa47ed09..39cc9ab53 100644
---- a/sandbox/linux/system_headers/linux_seccomp.h
-+++ b/sandbox/linux/system_headers/linux_seccomp.h
-@@ -41,6 +41,9 @@
- #ifndef EM_AARCH64
- #define EM_AARCH64 183
- #endif
-+#ifndef EM_PPC64
-+#define EM_PPC64 21
-+#endif
-
- #ifndef __AUDIT_ARCH_64BIT
- #define __AUDIT_ARCH_64BIT 0x80000000
-@@ -73,6 +76,12 @@
- #ifndef AUDIT_ARCH_AARCH64
- #define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
- #endif
-+#ifndef AUDIT_ARCH_PPC64
-+#define AUDIT_ARCH_PPC64 (EM_PPC64 | __AUDIT_ARCH_64BIT)
-+#endif
-+#ifndef AUDIT_ARCH_PPC64LE
-+#define AUDIT_ARCH_PPC64LE (EM_PPC64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
-+#endif
-
- // For prctl.h
- #ifndef PR_SET_SECCOMP
-diff --git a/sandbox/linux/system_headers/linux_signal.h b/sandbox/linux/system_headers/linux_signal.h
-index f5a736761..515b21a5f 100644
---- a/sandbox/linux/system_headers/linux_signal.h
-+++ b/sandbox/linux/system_headers/linux_signal.h
-@@ -13,7 +13,7 @@
- // (not undefined, but defined different values and in different memory
- // layouts). So, fill the gap here.
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
-
- #define LINUX_SIGHUP 1
- #define LINUX_SIGINT 2
-diff --git a/sandbox/linux/system_headers/linux_syscalls.h b/sandbox/linux/system_headers/linux_syscalls.h
-index 2b78a0cc3..0a70f5ea5 100644
---- a/sandbox/linux/system_headers/linux_syscalls.h
-+++ b/sandbox/linux/system_headers/linux_syscalls.h
-@@ -35,5 +35,9 @@
- #include "sandbox/linux/system_headers/arm64_linux_syscalls.h"
- #endif
-
-+#if defined(__powerpc64__)
-+#include "sandbox/linux/system_headers/ppc64_linux_syscalls.h"
-+#endif
-+
- #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SYSCALLS_H_
-
-diff --git a/sandbox/linux/system_headers/ppc64_linux_syscalls.h b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-new file mode 100644
-index 000000000..ccacffe22
---- /dev/null
-+++ b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-@@ -0,0 +1,12 @@
-+// Copyright 2014 The Chromium Authors. All rights reserved.
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+#define SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+
-+#include <asm/unistd.h>
-+
-+//TODO: is it necessary to redefine syscall numbers for PPC64?
-+
-+#endif // SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-diff --git a/sandbox/policy/linux/bpf_utility_policy_linux.cc b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_utility_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-@@ -34,7 +34,7 @@
- case __NR_fdatasync:
- case __NR_fsync:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
- #if defined(__i386__) || defined(__arm__)
-diff --git a/sandbox/policy/linux/bpf_renderer_policy_linux.cc b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-@@ -15,6 +15,11 @@
- #include "sandbox/linux/system_headers/linux_syscalls.h"
- #include "sandbox/policy/linux/sandbox_linux.h"
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- // TODO(vignatti): replace the local definitions below with #include
- // <linux/dma-buf.h> once kernel version 4.6 becomes widely used.
- #include <linux/types.h>
-@@ -77,7 +77,7 @@
- case __NR_ftruncate64:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- case __NR_setrlimit:
- // We allow setrlimit to dynamically adjust the address space limit as
-diff --git a/third_party/angle/src/compiler/translator/InfoSink.h b/third_party/angle/src/compiler/translator/InfoSink.h
-index 3a807e1e3..5258617a7 100644
---- a/third_party/angle/src/compiler/translator/InfoSink.h
-+++ b/third_party/angle/src/compiler/translator/InfoSink.h
-@@ -92,7 +92,16 @@ class TInfoSinkBase
- stream.precision(8);
- stream << f;
- }
-- sink.append(stream.str());
-+
-+ // Hack to work around a bug where negative floating point values
-+ // are rendered like '.0.5' instead of '-0.5'
-+ std::string res(stream.str());
-+
-+ if (signbit(f)) { // test if f is negative
-+ res[0] = '-';
-+ }
-+
-+ sink.append(res);
- return *this;
- }
- // Write boolean values as their names instead of integral value.
-diff --git a/third_party/angle/src/libANGLE/Constants.h b/third_party/angle/src/libANGLE/Constants.h
-index fcbc9246a..39ae66148 100644
---- a/third_party/angle/src/libANGLE/Constants.h
-+++ b/third_party/angle/src/libANGLE/Constants.h
-@@ -9,6 +9,7 @@
- #ifndef LIBANGLE_CONSTANTS_H_
- #define LIBANGLE_CONSTANTS_H_
-
-+#include <cstddef>
- #include "common/platform.h"
-
- #include <stdint.h>
-diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
-index 17cf9cda9..8ce96bd32 100644
---- a/third_party/boringssl/BUILD.gn
-+++ b/third_party/boringssl/BUILD.gn
-@@ -103,6 +103,13 @@ if (is_win && !is_msan && current_cpu != "arm64") {
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-+ } else if (current_cpu == "ppc64") {
-+ if (is_linux) {
-+ # TODO: ppc64 (be) check
-+ sources += crypto_sources_linux_ppc64le
-+ } else {
-+ public_configs = [ ":no_asm_config" ]
-+ }
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-diff --git a/third_party/breakpad/BUILD.gn b/third_party/breakpad/BUILD.gn
-index 4af3d7bbf..adbf54159 100644
---- a/third_party/breakpad/BUILD.gn
-+++ b/third_party/breakpad/BUILD.gn
-@@ -596,7 +596,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/minidump_file_writer.h",
- "breakpad/src/common/convert_UTF.cc",
- "breakpad/src/common/convert_UTF.h",
-- "breakpad/src/common/linux/breakpad_getcontext.S",
- "breakpad/src/common/linux/elf_core_dump.cc",
- "breakpad/src/common/linux/elf_core_dump.h",
- "breakpad/src/common/linux/elfutils.cc",
-@@ -634,6 +633,14 @@ if (is_linux || is_chromeos || is_android) {
-
- libs = [ "dl" ]
-
-+ if (current_cpu == "ppc64") {
-+ defines = [ "HAVE_GETCONTEXT" ]
-+ } else {
-+ sources += [
-+ "breakpad/src/common/linux/breakpad_getcontext.S"
-+ ]
-+ }
-+
- include_dirs = [
- ".",
- "breakpad/src",
-@@ -682,7 +689,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc",
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
- "breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
-- "breakpad/src/common/linux/breakpad_getcontext_unittest.cc",
- "breakpad/src/common/linux/elf_core_dump_unittest.cc",
- "breakpad/src/common/linux/file_id_unittest.cc",
- "breakpad/src/common/linux/linux_libc_support_unittest.cc",
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-index 07d9171a0..9aed4cb36 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-@@ -44,6 +44,8 @@ typedef MDRawContextARM RawContextCPU;
- typedef MDRawContextARM64_Old RawContextCPU;
- #elif defined(__mips__)
- typedef MDRawContextMIPS RawContextCPU;
-+#elif defined(__powerpc64__)
-+typedef MDRawContextPPC64 RawContextCPU;
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index aae1dc13b..03afec7a5 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -270,7 +270,42 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->float_save.fir = mcontext.fpc_eir;
- #endif
- }
--#endif // __mips__
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t ThreadInfo::GetInstructionPointer() const {
-+ return mcontext.gp_regs[PT_NIP];
-+}
-+
-+void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = mcontext.gp_regs[i];
-+
-+ out->lr = mcontext.gp_regs[PT_LNK];
-+ out->srr0 = mcontext.gp_regs[PT_NIP];
-+ out->srr1 = mcontext.gp_regs[PT_MSR];
-+ out->cr = mcontext.gp_regs[PT_CCR];
-+ out->xer = mcontext.gp_regs[PT_XER];
-+ out->ctr = mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] = \
-+ {(((uint64_t)vregs.vrregs[i][0]) << 32)
-+ | vregs.vrregs[i][1],
-+ (((uint64_t)vregs.vrregs[i][2]) << 32)
-+ | vregs.vrregs[i][3]};
-+
-+ out->vrsave = vregs.vrsave;
-+ out->vector_save.save_vscr = {0, vregs.vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+#endif // __powerpc64__
-
- void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- assert(gp_regs || size);
-@@ -279,6 +314,11 @@ void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- *gp_regs = mcontext.gregs;
- if (size)
- *size = sizeof(mcontext.gregs);
-+#elif defined(__powerpc64__)
-+ if (gp_regs)
-+ *gp_regs = mcontext.gp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.gp_regs);
- #else
- if (gp_regs)
- *gp_regs = ®s;
-@@ -294,6 +334,11 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- *fp_regs = &mcontext.fpregs;
- if (size)
- *size = sizeof(mcontext.fpregs);
-+#elif defined(__powerpc64__)
-+ if (fp_regs)
-+ *fp_regs = &mcontext.fp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.fp_regs);
- #else
- if (fp_regs)
- *fp_regs = &fpregs;
-@@ -302,4 +347,13 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- #endif
- }
-
-+#if defined(__powerpc64__)
-+void ThreadInfo::GetVectorRegisters(void** v_regs, size_t* size) {
-+ if (v_regs)
-+ *v_regs = &vregs;
-+ if (size)
-+ *size = sizeof(vregs);
-+}
-+#endif
-+
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-index fb216fa6d..593aac822 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-@@ -68,6 +68,10 @@ struct ThreadInfo {
- // Use the structures defined in <sys/user.h>
- struct user_regs_struct regs;
- struct user_fpsimd_struct fpregs;
-+#elif defined(__powerpc64__)
-+ // Use the structures defined in <sys/ucontext.h>.
-+ mcontext_t mcontext;
-+ vrregset_t vregs;
- #elif defined(__mips__)
- // Use the structure defined in <sys/ucontext.h>.
- mcontext_t mcontext;
-@@ -84,6 +88,11 @@ struct ThreadInfo {
-
- // Returns the pointer and size of float point register area.
- void GetFloatingPointRegisters(void** fp_regs, size_t* size);
-+
-+#if defined(__powerpc64__)
-+ // Returns the pointer and size of the vector register area. (PPC64 only)
-+ void GetVectorRegisters(void** v_regs, size_t* size);
-+#endif
- };
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 6eec1be24..741983a1a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -254,6 +254,48 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc) {
- out->float_save.fir = uc->uc_mcontext.fpc_eir; // Unused.
- #endif
- }
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
-+}
-+
-+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[PT_NIP];
-+}
-+
-+void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
-+ const vrregset_t* vregs) {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = uc->uc_mcontext.gp_regs[i];
-+
-+ out->lr = uc->uc_mcontext.gp_regs[PT_LNK];
-+ out->srr0 = uc->uc_mcontext.gp_regs[PT_NIP];
-+ out->srr1 = uc->uc_mcontext.gp_regs[PT_MSR];
-+ out->cr = uc->uc_mcontext.gp_regs[PT_CCR];
-+ out->xer = uc->uc_mcontext.gp_regs[PT_XER];
-+ out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] =
-+ {(((uint64_t)vregs->vrregs[i][0]) << 32)
-+ | vregs->vrregs[i][1],
-+ (((uint64_t)vregs->vrregs[i][2]) << 32)
-+ | vregs->vrregs[i][3]};
-+
-+ out->vrsave = vregs->vrsave;
-+ out->vector_save.save_vscr = {0, vregs->vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+
- #endif
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-index 7d4100881..c122ac92e 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-@@ -55,6 +55,9 @@ struct UContextReader {
- #elif defined(__aarch64__)
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- const struct fpsimd_context* fpregs);
-+#elif defined(__powerpc64__)
-+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
-+ const vrregset_t* vregs);
- #else
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc);
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index a6cb5f984..ae16b64d9 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -461,9 +461,16 @@ bool ExceptionHandler::HandleSignal(int /*sig*/, siginfo_t* info, void* uc) {
- memcpy(&g_crash_context_.float_state, fp_ptr,
- sizeof(g_crash_context_.float_state));
- }
-+#elif defined(__powerpc64__)
-+ // On PPC64, we must copy VR state
-+ ucontext_t* uc_ptr = (ucontext_t*)uc;
-+ if (uc_ptr->uc_mcontext.v_regs) {
-+ memcpy(&g_crash_context_.vector_state, uc_ptr->uc_mcontext.v_regs,
-+ sizeof(g_crash_context_.vector_state));
-+ }
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- // FP state is not part of user ABI on ARM Linux.
-- // In case of MIPS Linux FP state is already part of ucontext_t
-+ // In case of MIPS, Linux FP state is already part of ucontext_t
- // and 'float_state' is not a member of CrashContext.
- ucontext_t* uc_ptr = (ucontext_t*)uc;
- if (uc_ptr->uc_mcontext.fpregs) {
-@@ -708,11 +715,19 @@ bool ExceptionHandler::WriteMinidump() {
- }
- #endif
-
--#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__)
-+#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__) \
-+ && !defined(__powerpc64__)
- // FPU state is not part of ARM EABI ucontext_t.
- memcpy(&context.float_state, context.context.uc_mcontext.fpregs,
- sizeof(context.float_state));
- #endif
-+
-+#if defined(__powerpc64__)
-+ // Vector registers must be copied on PPC64
-+ memcpy(&context.vector_state, context.context.uc_mcontext.v_regs,
-+ sizeof(context.vector_state));
-+#endif
-+
- context.tid = sys_gettid();
-
- // Add an exception stream to the minidump for better reporting.
-@@ -733,6 +748,9 @@ bool ExceptionHandler::WriteMinidump() {
- #elif defined(__mips__)
- context.siginfo.si_addr =
- reinterpret_cast<void*>(context.context.uc_mcontext.pc);
-+#elif defined(__powerpc64__)
-+ context.siginfo.si_addr =
-+ reinterpret_cast<void*>(context.context.uc_mcontext.gp_regs[PT_NIP]);
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-index f80843ea7..260dd10f7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-@@ -192,7 +192,11 @@ class ExceptionHandler {
- siginfo_t siginfo;
- pid_t tid; // the crashing thread.
- ucontext_t context;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ // PPC64's FP state is a part of ucontext_t like MIPS but the vector
-+ // state is not, so a struct is needed.
-+ vstate_t vector_state;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- // #ifdef this out because FP state is not part of user ABI for Linux ARM.
- // In case of MIPS Linux FP state is already part of ucontext_t so
- // 'float_state' is not required.
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-index 35dcbfd4d..7934370fd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-@@ -307,7 +307,7 @@ TEST(ExceptionHandlerTest, ParallelChildCrashesDontHang) {
- }
-
- // Wait a while until the child should have crashed.
-- usleep(1000000);
-+ usleep(2000000);
- // Kill the child if it is still running.
- kill(child, SIGKILL);
-
-@@ -559,6 +559,8 @@ const unsigned char kIllegalInstruction[] = {
- #if defined(__mips__)
- // mfc2 zero,Impl - usually illegal in userspace.
- 0x48, 0x00, 0x00, 0x48
-+#elif defined(__powerpc64__)
-+ 0x01, 0x01, 0x01, 0x01 // Crashes on a tested POWER9 cpu
- #else
- // This crashes with SIGILL on x86/x86-64/arm.
- 0xff, 0xff, 0xff, 0xff
-@@ -754,10 +756,10 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
-
- // These are defined here so the parent can use them to check the
- // data from the minidump afterwards.
-- // Use 4k here because the OS will hand out a single page even
-+ // Use the page size here because the OS will hand out a single page even
- // if a smaller size is requested, and this test wants to
- // test the upper bound of the memory range.
-- const uint32_t kMemorySize = 4096; // bytes
-+ const uint32_t kMemorySize = getpagesize(); // bytes
- const int kOffset = kMemorySize - sizeof(kIllegalInstruction);
-
- const pid_t child = fork();
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-index fa3c1713a..6ce709e2f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-@@ -138,7 +138,9 @@ class MicrodumpWriter {
- const MicrodumpExtraInfo& microdump_extra_info,
- LinuxDumper* dumper)
- : ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -337,6 +339,8 @@ class MicrodumpWriter {
- # else
- # error "This mips ABI is currently not supported (n32)"
- #endif
-+#elif defined(__powerpc64__)
-+ const char kArch[] = "ppc64";
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -409,7 +413,9 @@ class MicrodumpWriter {
- void DumpCPUState() {
- RawContextCPU cpu;
- my_memset(&cpu, 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(&cpu, ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(&cpu, ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(&cpu, ucontext_);
-@@ -605,7 +611,9 @@ class MicrodumpWriter {
- void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); }
-
- const ucontext_t* const ucontext_;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_;
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-index 6339ac0cd..291af106b 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-@@ -279,10 +279,19 @@ TEST(MicrodumpWriterTest, BasicWithMappings) {
- CrashAndGetMicrodump(mappings, MicrodumpExtraInfo(), &buf);
- ASSERT_TRUE(ContainsMicrodump(buf));
-
-+ int page_size = getpagesize();
- #ifdef __LP64__
-- ASSERT_NE(std::string::npos,
-- buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-- "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ // This test is only available for the following page sizes
-+ ASSERT_TRUE((page_size == 4096) || (page_size == 65536));
-+ if (page_size == 4096) {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ } else {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000010000 000000000000002A 0000000000010000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ }
- #else
- ASSERT_NE(std::string::npos,
- buf.find("M 00001000 0000002A 00001000 "
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-index 415068983..b93e4afcf 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-@@ -112,6 +112,9 @@ bool LinuxCoreDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-@@ -197,7 +200,10 @@ bool LinuxCoreDumper::EnumerateThreads() {
- memset(&info, 0, sizeof(ThreadInfo));
- info.tgid = status->pr_pgrp;
- info.ppid = status->pr_ppid;
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ for (int i = 0; i < 31; i++)
-+ info.mcontext.gp_regs[i] = status->pr_reg[i];
-+#elif defined(__mips__)
- #if defined(__ANDROID__)
- for (int i = EF_R0; i <= EF_R31; i++)
- info.mcontext.gregs[i - EF_R0] = status->pr_reg[i];
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-index 7fd6532ad..199cbfffd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-@@ -765,7 +765,9 @@ bool LinuxDumper::GetStackInfo(const void** stack, size_t* stack_len,
- reinterpret_cast<uint8_t*>(int_stack_pointer & ~(page_size - 1));
-
- // The number of bytes of stack which we try to capture.
-- static const ptrdiff_t kStackToCapture = 32 * 1024;
-+ // This now depends on page_size to avoid missing data
-+ // on systems with larger page sizes.
-+ static const ptrdiff_t kStackToCapture = 8 * page_size;
-
- const MappingInfo* mapping = FindMapping(stack_pointer);
- if (!mapping)
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-index 7bee160f1..07bb2b81a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-@@ -63,7 +63,8 @@ namespace google_breakpad {
- (defined(__mips__) && _MIPS_SIM == _ABIO32)
- typedef Elf32_auxv_t elf_aux_entry;
- #elif defined(__x86_64) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM != _ABIO32)
-+ (defined(__mips__) && _MIPS_SIM != _ABIO32) || \
-+ defined(__powerpc64__)
- typedef Elf64_auxv_t elf_aux_entry;
- #endif
-
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-index 331f4bb34..3f722947f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-@@ -51,6 +51,8 @@
- #define TID_PTR_REGISTER "rcx"
- #elif defined(__mips__)
- #define TID_PTR_REGISTER "$1"
-+#elif defined(__powerpc64__)
-+#define TID_PTR_REGISTER "r8"
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-index e3ddb81a6..fa28575ef 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-@@ -149,19 +149,27 @@ bool LinuxPtraceDumper::CopyFromProcess(void* dest, pid_t child,
- return true;
- }
-
--bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid)
--{
-+bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid) {
- #ifdef PTRACE_GETREGSET
- struct iovec io;
- info->GetGeneralPurposeRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
- return false;
- }
-
- info->GetFloatingPointRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
- return false;
- }
-+
-+#if defined(__powerpc64__)
-+ // Grab the vector registers on PPC64 too
-+ info->GetVectorRegisters(&io.iov_base, &io.iov_len);
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PPC_VMX, (void*)&io) == -1) {
-+ return false;
-+ }
-+#endif // defined(__powerpc64__)
-+
- return true;
- #else
- return false;
-@@ -298,6 +306,9 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-index da71e15dc..12bfb317a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-@@ -462,6 +462,9 @@ TEST(LinuxPtraceDumperTest, VerifyStackReadWithMultipleThreads) {
- #elif defined(__mips__)
- pid_t* process_tid_location =
- reinterpret_cast<pid_t*>(one_thread.mcontext.gregs[1]);
-+#elif defined(__powerpc64__)
-+ pid_t* process_tid_location =
-+ reinterpret_cast<pid_t*>(one_thread.mcontext.gp_regs[8]);
- #else
- #error This test has not been ported to this platform.
- #endif
-@@ -559,6 +562,8 @@ TEST_F(LinuxPtraceDumperTest, SanitizeStackCopy) {
- uintptr_t heap_addr = thread_info.regs.rcx;
- #elif defined(__mips__)
- uintptr_t heap_addr = thread_info.mcontext.gregs[1];
-+#elif defined(__powerpc64__)
-+ uintptr_t heap_addr = thread_info.mcontext.gp_regs[8];
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-index 32634ef00..2a56948de 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-@@ -136,7 +136,9 @@ class MinidumpWriter {
- : fd_(minidump_fd),
- path_(minidump_path),
- ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -468,7 +470,9 @@ class MinidumpWriter {
- if (!cpu.Allocate())
- return false;
- my_memset(cpu.get(), 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(cpu.get(), ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(cpu.get(), ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(cpu.get(), ucontext_);
-@@ -897,7 +901,7 @@ class MinidumpWriter {
- dirent->location.rva = 0;
- }
-
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || defined(__powerpc64__)
- bool WriteCPUInformation(MDRawSystemInfo* sys_info) {
- char vendor_id[sizeof(sys_info->cpu.x86_cpu_info.vendor_id) + 1] = {0};
- static const char vendor_id_name[] = "vendor_id";
-@@ -917,7 +921,9 @@ class MinidumpWriter {
-
- // processor_architecture should always be set, do this first
- sys_info->processor_architecture =
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ MD_CPU_ARCHITECTURE_PPC64;
-+#elif defined(__mips__)
- # if _MIPS_SIM == _ABIO32
- MD_CPU_ARCHITECTURE_MIPS;
- # elif _MIPS_SIM == _ABI64
-@@ -1333,7 +1339,9 @@ class MinidumpWriter {
- const char* path_; // Path to the file where the minidum should be written.
-
- const ucontext_t* const ucontext_; // also from the signal handler
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_; // ditto
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-index e3b0b16da..ccd8aa0a4 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-@@ -48,6 +48,8 @@ class ExceptionHandler;
-
- #if defined(__aarch64__)
- typedef struct fpsimd_context fpstate_t;
-+#elif defined(__powerpc64__)
-+typedef vrregset_t vstate_t;
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- typedef std::remove_pointer<fpregset_t>::type fpstate_t;
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-index d192e5cbb..fc1bfa8d7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-@@ -715,6 +715,9 @@ TEST(MinidumpWriterTest, InvalidStackPointer) {
- #elif defined(__mips__)
- context.context.uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP] =
- invalid_stack_pointer;
-+#elif defined(__powerpc64__)
-+ context.context.uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP] =
-+ invalid_stack_pointer;
- #else
- # error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-index 99362945c..c54ba7145 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-@@ -65,8 +65,7 @@ bool MemoryMappedFile::Map(const char* path, size_t offset) {
- }
-
- #if defined(__x86_64__) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM == _ABI64)
--
-+ (defined(__mips__) && _MIPS_SIM == _ABI64) || defined(__powerpc64__)
- struct kernel_stat st;
- if (sys_fstat(fd, &st) == -1 || st.st_size < 0) {
- #else
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-index fad59f40c..616496d67 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-@@ -176,9 +176,10 @@ TEST_F(MemoryMappedFileTest, RemapAfterMap) {
- TEST_F(MemoryMappedFileTest, MapWithOffset) {
- // Put more data in the test file this time. Offsets can only be
- // done on page boundaries, so we need a two page file to test this.
-- const int page_size = 4096;
-- char data1[2 * page_size];
-- size_t data1_size = sizeof(data1);
-+ const int page_size = getpagesize();
-+ char *data1 = static_cast<char*>(malloc(2 * page_size));
-+ EXPECT_TRUE(data1 != NULL);
-+ size_t data1_size = (2 * page_size);
- for (size_t i = 0; i < data1_size; ++i) {
- data1[i] = i & 0x7f;
- }
-diff --git a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-index 5803b90d5..2a1cf14f0 100644
---- a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-@@ -57,8 +57,9 @@ TEST(PageAllocatorTest, LargeObject) {
-
- EXPECT_EQ(0U, allocator.pages_allocated());
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(10000));
-+ uint64_t expected_pages = 1 + ((10000 - 1) / getpagesize());
- ASSERT_FALSE(p == NULL);
-- EXPECT_EQ(3U, allocator.pages_allocated());
-+ EXPECT_EQ(expected_pages, allocator.pages_allocated());
- for (unsigned i = 1; i < 10; ++i) {
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(i));
- ASSERT_FALSE(p == NULL);
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-index 798056dfa..22bd81fff 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-@@ -202,12 +202,14 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) {
- // Check architecture and set architecture variable to corresponding flag
- // in objdump.
- switch (context->GetContextCPU()) {
-+#if defined(__i386) || defined(__x86_64)
- case MD_CONTEXT_X86:
- architecture = "i386";
- break;
- case MD_CONTEXT_AMD64:
- architecture = "i386:x86-64";
- break;
-+#endif
- default:
- // Unsupported architecture. Note that ARM architectures are not
- // supported because objdump does not support ARM.
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-index 528ee5f21..72764d6c1 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-@@ -104,6 +104,8 @@ ExploitabilityFor(const string& filename) {
- }
-
- TEST(ExploitabilityTest, TestWindowsEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("ascii_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -136,9 +138,12 @@ TEST(ExploitabilityTest, TestWindowsEngine) {
- ExploitabilityFor("read_av_clobber_write.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_LOW,
- ExploitabilityFor("read_av_conditional.dmp"));
-+#endif
- }
-
- TEST(ExploitabilityTest, TestLinuxEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if defined(__i386) || defined(__x86_64)
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_null_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -171,7 +176,8 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_executable_heap.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_jmp_to_module_not_exe_region.dmp"));
--#ifndef _WIN32
-+#endif
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_write_to_nonwritable_module.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -182,10 +188,10 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_write_to_outside_module_via_math.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_write_to_under_4k.dmp"));
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (!defined(__i386) && !defined(__x86_64))
- }
-
--#ifndef _WIN32
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- TEST(ExploitabilityLinuxUtilsTest, DisassembleBytesTest) {
- ASSERT_FALSE(ExploitabilityLinuxTest::DisassembleBytes("", NULL, 5, NULL));
- uint8_t bytes[6] = {0xc7, 0x0, 0x5, 0x0, 0x0, 0x0};
-@@ -301,6 +307,7 @@ TEST(ExploitabilityLinuxUtilsTest, CalculateAddressTest) {
- context,
- &write_address));
- }
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
-+
-
- } // namespace
-diff --git a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-index aade82c99..195aa73f3 100644
---- a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-+++ b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-@@ -77,6 +77,8 @@
- #define ELF_ARCH EM_MIPS
- #elif defined(__aarch64__)
- #define ELF_ARCH EM_AARCH64
-+#elif defined(__powerpc64__)
-+ #define ELF_ARCH EM_PPC64
- #endif
-
- #if defined(__arm__)
-@@ -87,6 +89,8 @@ typedef user_regs user_regs_struct;
- #elif defined (__mips__)
- // This file-local typedef simplifies the source code.
- typedef gregset_t user_regs_struct;
-+#elif defined(__powerpc64__)
-+typedef struct pt_regs user_regs_struct;
- #endif
-
- using google_breakpad::MDTypeHelper;
-@@ -321,6 +325,9 @@ struct CrashedProcess {
- #endif
- #if defined(__aarch64__)
- user_fpsimd_struct fpregs;
-+#endif
-+#if defined(__powerpc64__)
-+ mcontext_t mcontext;
- #endif
- uintptr_t stack_addr;
- const uint8_t* stack;
-@@ -535,6 +542,38 @@ ParseThreadRegisters(CrashedProcess::Thread* thread,
- thread->mcontext.fpc_eir = rawregs->float_save.fir;
- #endif
- }
-+#elif defined(__powerpc64__)
-+static void
-+ParseThreadRegisters(CrashedProcess::Thread* thread,
-+ const MinidumpMemoryRange& range) {
-+ const MDRawContextPPC64* rawregs = range.GetData<MDRawContextPPC64>(0);
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ thread->mcontext.gp_regs[i] = rawregs->gpr[i];
-+
-+ thread->mcontext.gp_regs[PT_LNK] = rawregs->lr;
-+ thread->mcontext.gp_regs[PT_NIP] = rawregs->srr0;
-+ thread->mcontext.gp_regs[PT_MSR] = rawregs->srr1;
-+ thread->mcontext.gp_regs[PT_CCR] = rawregs->cr;
-+ thread->mcontext.gp_regs[PT_XER] = rawregs->xer;
-+ thread->mcontext.gp_regs[PT_CTR] = rawregs->ctr;
-+ thread->mcontext.v_regs->vrsave = rawregs->vrsave;
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ thread->mcontext.fp_regs[i] = rawregs->float_save.fpregs[i];
-+
-+ thread->mcontext.fp_regs[NFPREG-1] = rawregs->float_save.fpscr;
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++) {
-+ thread->mcontext.v_regs->vrregs[i][0] = rawregs->vector_save.save_vr[i].high >> 32;
-+ thread->mcontext.v_regs->vrregs[i][1] = rawregs->vector_save.save_vr[i].high;
-+ thread->mcontext.v_regs->vrregs[i][2] = rawregs->vector_save.save_vr[i].low >> 32;
-+ thread->mcontext.v_regs->vrregs[i][3] = rawregs->vector_save.save_vr[i].low;
-+ }
-+
-+ thread->mcontext.v_regs->vscr.vscr_word = rawregs->vector_save.save_vscr.low & 0xFFFFFFFF;
-+}
-+
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -623,6 +662,12 @@ ParseSystemInfo(const Options& options, CrashedProcess* crashinfo,
- # else
- # error "This mips ABI is currently not supported (n32)"
- # endif
-+#elif defined(__powerpc64__)
-+ if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_PPC64) {
-+ fprintf(stderr,
-+ "This version of minidump-2-core only supports PPC64.\n");
-+ exit(1);
-+ }
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-diff --git a/third_party/crashpad/crashpad/CONTRIBUTORS b/third_party/crashpad/crashpad/CONTRIBUTORS
-index 8724b7f32..8e29424ef 100644
---- a/third_party/crashpad/crashpad/CONTRIBUTORS
-+++ b/third_party/crashpad/crashpad/CONTRIBUTORS
-@@ -13,3 +13,4 @@ Mark Mentovai <mark@chromium.org>
- Robert Sesek <rsesek@chromium.org>
- Scott Graham <scottmg@chromium.org>
- Joshua Peraza <jperaza@chromium.org>
-+Shawn Anastasio <shawn@anastas.io>
-diff --git a/third_party/crashpad/crashpad/compat/linux/sys/user.h b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-index 6ed77a98e..1fd83469a 100644
---- a/third_party/crashpad/crashpad/compat/linux/sys/user.h
-+++ b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_COMPAT_LINUX_SYS_USER_H_
- #define CRASHPAD_COMPAT_LINUX_SYS_USER_H_
-
-+#include <cstddef>
- #include_next <sys/user.h>
-
- #include <features.h>
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context.h b/third_party/crashpad/crashpad/minidump/minidump_context.h
-index 3a3e603cb..3118d9e9f 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context.h
-@@ -592,6 +592,70 @@ struct MinidumpContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief ppc64-specific flags for MinidumpPPC64::context_flags
-+//! Based on minidump_cpu_ppc64.h from breakpad
-+enum MinidumpContextPPC64Flags : uint32_t {
-+ //! \brief Identifies the context as PPC64.
-+ kMinidumpContextPPC64 = 0x01000000,
-+
-+ //! \brief Indicates the validity of general purpose registers.
-+ //!
-+ //! Registers `r0`-`r31`, `nip`, `msr`, `lr`, etc. are valid.
-+ kMinidumpContextPPC64Base = kMinidumpContextPPC64 | 0x00000001,
-+
-+ //! \brief Indicates the validity of floating point registers.
-+ //!
-+ //! Registers `fp0`-`fp31`, `fpscr` are valid.
-+ kMinidumpContextPPC64Floating = kMinidumpContextPPC64 | 0x00000008,
-+
-+ //! \brief Indicates the validity of Altivec/VMX registers.
-+ //!
-+ //! Registers `v0`-`v31`, `vscr`, `vrsave`.
-+ kMinidumpContextPPC64Vector = kMinidumpContextPPC64 | 0x00000020,
-+
-+ //! \brief Indicates the validity of all registers
-+ kMinidumpContextPPC64All = kMinidumpContextPPC64Base |
-+ kMinidumpContextPPC64Floating |
-+ kMinidumpContextPPC64Vector
-+};
-+
-+//! \brief A PPC64 CPU context carried in a minidump file.
-+//! Based on minidump_cpu_ppc64.h from breakpad.
-+struct MinidumpContextPPC64 {
-+ uint64_t context_flags;
-+
-+ //! \brief General purpose registers.
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+
-+ //! \brief Floating point registers.
-+ double fpregs[32];
-+
-+ //! \brief FPU status register.
-+ double fpscr;
-+
-+ //! \brief Altivec/VMX vector registers.
-+ struct {
-+ //! \brief Vector registers are 128bits.
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad5[4];
-+
-+ //! \brief VRSAVE register.
-+ uint32_t save_vrsave;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad6[7];
-+ } vregs;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-index d7e53a493..d89eb9e01 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-@@ -101,6 +101,13 @@ MinidumpContextWriter::CreateFromSnapshot(const CPUContext* context_snapshot) {
- break;
- }
-
-+ case kCPUArchitecturePPC64: {
-+ context = std::make_unique<MinidumpContextPPC64Writer>();
-+ reinterpret_cast<MinidumpContextPPC64Writer*>(context.get())
-+ ->InitalizeFromSnapshot(context_snapshot->ppc64);
-+ break;
-+ }
-+
- default: {
- LOG(ERROR) << "unknown context architecture "
- << context_snapshot->architecture;
-@@ -453,4 +460,47 @@ size_t MinidumpContextMIPS64Writer::ContextSize() const {
- return sizeof(context_);
- }
-
-+MinidumpContextPPC64Writer::MinidumpContextPPC64Writer()
-+ : MinidumpContextWriter(), context_() {
-+ context_.context_flags = kMinidumpContextPPC64;
-+}
-+
-+MinidumpContextPPC64Writer::~MinidumpContextPPC64Writer() = default;
-+
-+void MinidumpContextPPC64Writer::InitalizeFromSnapshot(
-+ const CPUContextPPC64* context_snapshot) {
-+ DCHECK_EQ(state(), kStateMutable);
-+ DCHECK_EQ(context_.context_flags, kMinidumpContextPPC64);
-+
-+ context_.context_flags = kMinidumpContextPPC64All;
-+
-+ memcpy(context_.regs, context_snapshot->regs, sizeof(context_.regs));
-+ context_.nip = context_snapshot->nip;
-+ context_.msr = context_snapshot->msr;
-+ context_.ccr = context_snapshot->ccr;
-+ context_.xer = context_snapshot->xer;
-+ context_.lnk = context_snapshot->lnk;
-+ context_.ctr = context_snapshot->ctr;
-+
-+ memcpy(context_.fpregs, context_snapshot->fpregs, sizeof(context_.fpregs));
-+ context_.fpscr = context_snapshot->fpscr;
-+
-+ memcpy(context_.vregs.save_vr, context_snapshot->vregs.save_vr,
-+ sizeof(context_.vregs.save_vr));
-+ memcpy(&context_.vregs.save_vscr, &context_snapshot->vregs.save_vscr,
-+ sizeof(context_.vregs.save_vscr));
-+ context_.vregs.save_vrsave = context_snapshot->vregs.save_vrsave;
-+}
-+
-+bool MinidumpContextPPC64Writer::WriteObject(
-+ FileWriterInterface* file_writer) {
-+ DCHECK_EQ(state(), kStateWritable);
-+ return file_writer->Write(&context_, sizeof(context_));
-+}
-+
-+size_t MinidumpContextPPC64Writer::ContextSize() const {
-+ DCHECK_GE(state(), kStateFrozen);
-+ return sizeof(context_);
-+}
-+
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-index d4ab936ee..1d22fc59c 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-@@ -315,6 +315,43 @@ class MinidumpContextMIPS64Writer final : public MinidumpContextWriter {
- MinidumpContextMIPS64 context_;
- };
-
-+class MinidumpContextPPC64Writer final : public MinidumpContextWriter {
-+ public:
-+ MinidumpContextPPC64Writer();
-+ ~MinidumpContextPPC64Writer() override;
-+
-+ //! \brief Initalizes the MinidumpContextPPC64 based on \a context_snapshot.
-+ //!
-+ //! \param[in] context_snapshot The context snapshot to use as source data.
-+ //!
-+ //! \note Valid in #kStateMutable. No mutation of context() may be done before
-+ //! calling this method, and it is not normally necessary to alter
-+ //! context() after calling this method.
-+ void InitalizeFromSnapshot(const CPUContextPPC64* context_snapshot);
-+
-+ //! \brief Returns a pointer to the context structure that this object will
-+ //! write.
-+ //!
-+ //! \attention This returns a non-`const` pointer to this object’s private
-+ //! data so that a caller can populate the context structure directly.
-+ //! This is done because providing setter interfaces to each field in the
-+ //! context structure would be unwieldy and cumbersome. Care must be taken
-+ //! to populate the context structure correctly. The context structure
-+ //! must only be modified while this object is in the #kStateMutable
-+ //! state.
-+ MinidumpContextPPC64* context() { return &context_; }
-+
-+ protected:
-+ // MinidumpWritable:
-+ bool WriteObject(FileWriterInterface* file_writer) override;
-+
-+ // MinidumpContextWriter:
-+ size_t ContextSize() const override;
-+
-+ private:
-+ MinidumpContextPPC64 context_;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_WRITER_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-index 3216a906b..a9fcbe9d8 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-@@ -213,6 +213,21 @@ TEST(MinidumpContextWriter, MIPS64_FromSnapshot) {
- context, ExpectMinidumpContextMIPS64, kSeed);
- }
-
-+TEST(MinidumpContextWriter, PPC64_Zeros) {
-+ EmptyContextTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ ExpectMinidumpContextPPC64);
-+}
-+
-+TEST(MinidumpContextWriter, PPC64_FromSnapshot) {
-+ constexpr uint32_t kSeed = 64;
-+ CPUContextPPC64 context_ppc64;
-+ CPUContext context;
-+ context.ppc64 = &context_ppc64;
-+ InitializeCPUContextPPC64(&context, kSeed);
-+ FromSnapshotTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ context, ExpectMinidumpContextPPC64, kSeed);
-+}
-+
- } // namespace
- } // namespace test
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-index 0974e3ddf..b71ec5880 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-@@ -135,6 +135,8 @@ std::string MinidumpMiscInfoDebugBuildString() {
- static constexpr char kCPU[] = "mips";
- #elif defined(ARCH_CPU_MIPS64EL)
- static constexpr char kCPU[] = "mips64";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kCPU[] = "ppc64";
- #else
- #error define kCPU for this CPU
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/capture_memory.cc b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-index 7a1b2763c..beda8da9e 100644
---- a/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-+++ b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-@@ -112,6 +112,11 @@ void CaptureMemory::PointedToByContext(const CPUContext& context,
- for (size_t i = 0; i < std::size(context.mipsel->regs); ++i) {
- MaybeCaptureMemoryAround(delegate, context.mipsel->regs[i]);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->nip);
-+ for (size_t i = 0; i < std::size(context.ppc64->regs); ++i) {
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->regs[i]);
-+ }
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-index 811a72095..f4f83981d 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-@@ -43,7 +43,10 @@ enum CPUArchitecture {
- kCPUArchitectureMIPSEL,
-
- //! \brief 64-bit MIPSEL.
-- kCPUArchitectureMIPS64EL
-+ kCPUArchitectureMIPS64EL,
-+
-+ //! \brief 64-bit PPC64.
-+ kCPUArchitecturePPC64
- };
-
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.cc b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-index c75b5555e..aeade577a 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-@@ -169,6 +169,8 @@ uint64_t CPUContext::InstructionPointer() const {
- return arm->pc;
- case kCPUArchitectureARM64:
- return arm64->pc;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->nip;
- default:
- NOTREACHED();
- return ~0ull;
-@@ -185,6 +187,8 @@ uint64_t CPUContext::StackPointer() const {
- return arm->sp;
- case kCPUArchitectureARM64:
- return arm64->sp;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->regs[1];
- default:
- NOTREACHED();
- return ~0ull;
-@@ -196,6 +200,7 @@ bool CPUContext::Is64Bit() const {
- case kCPUArchitectureX86_64:
- case kCPUArchitectureARM64:
- case kCPUArchitectureMIPS64EL:
-+ case kCPUArchitecturePPC64:
- return true;
- case kCPUArchitectureX86:
- case kCPUArchitectureARM:
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.h b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-index fb23c4679..eebede63c 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-@@ -352,6 +352,24 @@ struct CPUContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief A context structure carrying PPC64 CPU state.
-+struct CPUContextPPC64 {
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+ double fpregs[32];
-+ double fpscr;
-+ struct {
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+ uint32_t save_vrsave;
-+ } vregs;
-+};
-+
- //! \brief A context structure capable of carrying the context of any supported
- //! CPU architecture.
- struct CPUContext {
-@@ -382,6 +400,7 @@ struct CPUContext {
- CPUContextARM64* arm64;
- CPUContextMIPS* mipsel;
- CPUContextMIPS64* mips64;
-+ CPUContextPPC64* ppc64;
- };
- };
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-index 9f46a4897..aa677c4eb 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
- #define CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
-
-+#include <cstring>
- #include "build/build_config.h"
- #include "snapshot/cpu_context.h"
- #include "snapshot/linux/signal_context.h"
-@@ -174,6 +175,78 @@ void InitializeCPUContextMIPS(
-
- #endif // ARCH_CPU_MIPS_FAMILY || DOXYGEN
-
-+#if defined(ARCH_CPU_PPC64_FAMILY) || DOXYGEN
-+
-+//! \brief Initalizes a CPUContextPPC64 structure from native context
-+//! structures on Linux.
-+//!
-+//! \param[in] thread_context The native thread context.
-+//! \param[in] float_context The native float context.
-+//! \param[in] vector_context The native vector context.
-+//! \param[out] context The CPUContextPPC64 structure to initalize.
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const ThreadContext::t64_t& thread_context,
-+ const FloatContext::f64_t& float_context,
-+ const VectorContext::v64_t& vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.gpr, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.fpregs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const SignalThreadContext64 &thread_context,
-+ const SignalFloatContext64 &float_context,
-+ const SignalVectorContext64 &vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.regs, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.regs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+
-+#endif
-+
- } // namespace internal
- } // namespace crashpad
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-index d32bd1937..2dd538c2b 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-@@ -192,6 +192,8 @@ void TestAgainstTarget(PtraceConnection* connection) {
- device == 0 && inode == 0 && mapping_name == "[vdso]";
- #if defined(ARCH_CPU_X86)
- static constexpr char kPrefix[] = "linux-gate.so.";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kPrefix[] = "linux-vdso64.so.";
- #else
- static constexpr char kPrefix[] = "linux-vdso.so.";
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-index cd40b3b12..6bcf23b6f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-@@ -323,6 +323,69 @@ bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
- reader, context_address, context_.mips64);
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+template <typename Traits>
-+static bool ReadContext(ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address,
-+ typename Traits::CPUContext* dest_context) {
-+ const ProcessMemory* memory = reader->Memory();
-+
-+ LinuxVMAddress gp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, gp_regs);
-+
-+ typename Traits::SignalThreadContext thread_context;
-+ if (!memory->Read(gp_regs_address, sizeof(thread_context), &thread_context)) {
-+ LOG(ERROR) << "Couldn't read gp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress fp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, fp_regs);
-+
-+ typename Traits::SignalFloatContext fp_context;
-+ if (!memory->Read(fp_regs_address, sizeof(fp_context), &fp_context)) {
-+ LOG(ERROR) << "Couldn't read fp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress v_regs_ptr_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, vmx_reserve) + 8;
-+
-+ typename Traits::SignalVectorContext v_context;
-+ if (!memory->Read(v_regs_ptr_address, sizeof(v_context), &v_context)) {
-+ LOG(ERROR) << "Couldn't read v_regs!";
-+ return false;
-+ }
-+
-+ InitializeCPUContextPPC64<ContextTraits64>(thread_context, fp_context,
-+ v_context, dest_context);
-+
-+ return true;
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+
-+ return internal::ReadContext<ContextTraits64>(
-+ reader, context_address, context_.ppc64);
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits32>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ // PPC64 is 64-bit
-+ return false;
-+}
-+
- #endif // ARCH_CPU_X86_FAMILY
-
- bool ExceptionSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-index ea0cd2106..e42df520f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-@@ -84,6 +84,8 @@ class ExceptionSnapshotLinux final : public ExceptionSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #endif
- } context_union_;
- CPUContext context_;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-index c17170b43..b6a714cc6 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-@@ -296,7 +296,28 @@ void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
- 0);
- #undef CPU_ARCH_NAME
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+using NativeCPUContext = ucontext_t;
-+
-+void InitializeContext(NativeCPUContext* context) {
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ context->uc_mcontext.gp_regs[reg] = reg;
-+ }
-+
-+ memset(&context->uc_mcontext.fp_regs, 44,
-+ sizeof(context->uc_mcontext.fp_regs));
-+}
-
-+void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
-+ EXPECT_EQ(actual.architecture, kCPUArchitecturePPC64);
-+
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ EXPECT_EQ(actual.ppc64->regs[reg], expected.uc_mcontext.gp_regs[reg]);
-+ }
-+
-+ EXPECT_EQ(memcmp(actual.ppc64->fpregs, expected.uc_mcontext.fp_regs,
-+ sizeof(actual.ppc64->fpregs)), 0);
-+}
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-index ee246e8bc..9555dce04 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-@@ -108,6 +108,8 @@ void ProcessReaderLinux::Thread::InitializeStack(ProcessReaderLinux* reader) {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- stack_pointer = reader->Is64Bit() ? thread_info.thread_context.t64.regs[29]
- : thread_info.thread_context.t32.regs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ stack_pointer = thread_info.thread_context.t64.gpr[1];
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 110024680..a1f2da259 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -422,6 +422,89 @@ static_assert(offsetof(UContext<ContextTraits64>, mcontext.fpregs) ==
- "context offset mismatch");
- #endif
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+struct SignalThreadContext64 {
-+ uint64_t regs[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_r3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
-+ uint64_t dscr;
-+ uint64_t fpr0[3];
-+};
-+
-+struct SignalFloatContext64 {
-+ double regs[32];
-+ double fpscr;
-+};
-+
-+struct SignalVectorContext64 {
-+ int32_t vrregs[32][4];
-+ struct {
-+ int32_t __pad[3];
-+ int32_t vscr_word;
-+ } vscr;
-+ int32_t vrsave;
-+ int32_t __pad[3];
-+} __attribute__((__aligned__(16)));
-+
-+
-+#pragma pack(pop)
-+struct MContext64 {
-+ uint64_t reserved[4];
-+ int32_t signal;
-+ int32_t __pad0;
-+ uint64_t handler;
-+ uint64_t oldmask;
-+ uint64_t pt_regs_ptr;
-+ SignalThreadContext64 gp_regs;
-+ SignalFloatContext64 fp_regs;
-+ SignalVectorContext64 *v_regs;
-+ int64_t vmx_reserve[69];
-+};
-+
-+struct ContextTraits64 : public Traits64 {
-+ using MContext = MContext64;
-+ using SignalThreadContext = SignalThreadContext64;
-+ using SignalFloatContext = SignalFloatContext64;
-+ using SignalVectorContext = SignalVectorContext64;
-+ using CPUContext = CPUContextPPC64;
-+};
-+
-+struct ContextTraits32 : public Traits32 {};
-+
-+struct UContext {
-+ uint64_t flags;
-+ uint64_t link;
-+ SignalStack<ContextTraits64> stack;
-+ Sigset<ContextTraits64> sigmask;
-+ MContext64 mcontext;
-+};
-+#pragma pack(push, 1)
-+
-+static_assert(sizeof(UContext) == sizeof(ucontext_t),
-+ "ucontext_t size mismatch");
-+static_assert(sizeof(MContext64) == sizeof(mcontext_t),
-+ "mcontext_t size mismatch");
-+static_assert(sizeof(SignalThreadContext64) == sizeof(gregset_t),
-+ "gregset_t size mismatch");
-+static_assert(sizeof(SignalFloatContext64) == sizeof(fpregset_t),
-+ "fpregset_t size mismatch");
-+static_assert(sizeof(SignalVectorContext64) == sizeof(vrregset_t),
-+ "vrregset_t size mismatch");
-+static_assert(offsetof(UContext, mcontext) ==
-+ offsetof(ucontext_t, uc_mcontext), "mcontext offset mismatch");
-+static_assert(offsetof(MContext64, gp_regs) ==
-+ offsetof(mcontext_t, gp_regs), "gp_regs offset mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-index a99da3e4b..03b973083 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-@@ -204,6 +204,8 @@ CPUArchitecture SystemSnapshotLinux::GetCPUArchitecture() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return process_reader_->Is64Bit() ? kCPUArchitectureMIPS64EL
- : kCPUArchitectureMIPSEL;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return kCPUArchitecturePPC64;
- #else
- #error port to your architecture
- #endif
-@@ -219,6 +221,9 @@ uint32_t SystemSnapshotLinux::CPURevision() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return 0;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return 0;
- #else
- #error port to your architecture
- #endif
-@@ -239,6 +244,9 @@ std::string SystemSnapshotLinux::CPUVendor() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return std::string();
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return std::string();
- #else
- #error port to your architecture
- #endif
-@@ -372,6 +380,9 @@ bool SystemSnapshotLinux::NXEnabled() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return false;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return false;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-index b2450c206..7ba78b2ae 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-@@ -110,6 +110,8 @@ bool WriteTestModule(const base::FilePath& module_path,
- module.ehdr.e_machine = EM_AARCH64;
- #elif defined(ARCH_CPU_MIPSEL) || defined(ARCH_CPU_MIPS64EL)
- module.ehdr.e_machine = EM_MIPS;
-+#elif defined(ARCH_CPU_PPC64)
-+ module.ehdr.e_machine = EM_PPC64;
- #endif
-
- module.ehdr.e_version = EV_CURRENT;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-index e3e2bebdd..8ef43752e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-@@ -186,6 +186,14 @@ bool ThreadSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
- thread.thread_info.float_context.f32,
- context_.mipsel);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+ InitializeCPUContextPPC64<ContextTraits64>(
-+ thread.thread_info.thread_context.t64,
-+ thread.thread_info.float_context.f64,
-+ thread.thread_info.vector_context.v64,
-+ context_.ppc64);
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-index 44cc6f6d9..d4136461e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-@@ -68,6 +68,8 @@ class ThreadSnapshotLinux final : public ThreadSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
---- a/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-+++ b/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-@@ -236,6 +236,12 @@
- #elif defined(ARCH_CPU_BIG_ENDIAN)
- static constexpr char arch[] = "aarch64_be";
- #endif
-+#elif defined(__powerpc64__)
-+#if defined(ARCH_CPU_LITTLE_ENDIAN)
-+ static constexpr char arch[] = "ppc64le";
-+#elif defined(ARCH_CPU_BIG_ENDIAN)
-+ static constexpr char arch[] = "ppc64";
-+#endif
- #else
- #error Port
- #endif
-diff --git a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-index d3d5ebdfb..3fd730cb5 100644
---- a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-+++ b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-@@ -56,6 +56,11 @@ bool AuxiliaryVector::Read(PtraceConnection* connection) {
- if (type == AT_IGNORE) {
- continue;
- }
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ if (type == AT_IGNOREPPC) {
-+ continue;
-+ }
-+#endif
- if (!MapInsertOrReplace(&values_, type, value, nullptr)) {
- LOG(ERROR) << "duplicate auxv entry";
- return false;
-diff --git a/third_party/crashpad/crashpad/util/linux/ptracer.cc b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-index 557e0d363..08ae434b8 100644
---- a/third_party/crashpad/crashpad/util/linux/ptracer.cc
-+++ b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-@@ -398,6 +398,64 @@ bool GetThreadArea64(pid_t tid,
- return true;
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+// PPC64 has had HAVE_ARCH_TRACEHOOK set since 2.6.27 (even before x86 had it).
-+// That means we can simply use PTRACE_GETREGESET.
-+
-+template <typename Destination>
-+bool GetRegisterSet(pid_t tid, int set, Destination* dest, bool can_log) {
-+ iovec iov;
-+ iov.iov_base = reinterpret_cast<void*>(dest);
-+ iov.iov_len = sizeof(*dest);
-+ if (ptrace(PTRACE_GETREGSET, tid, reinterpret_cast<void*>(set), &iov) != 0) {
-+ PLOG_IF(ERROR, can_log) << "ptrace";
-+ return false;
-+ }
-+ if (iov.iov_len != sizeof(*dest)) {
-+ LOG_IF(ERROR, can_log) << "Unexpected registers size";
-+ return false;
-+ }
-+ return true;
-+}
-+
-+bool GetVectorRegisters64(pid_t tid,
-+ VectorContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PPC_VMX, &context->v64, can_log);
-+}
-+
-+bool GetFloatingPointRegisters64(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PRFPREG, &context->f64, can_log);
-+}
-+
-+bool GetThreadArea64(pid_t tid,
-+ const ThreadContext& context,
-+ LinuxVMAddress* address,
-+ bool can_log) {
-+ // PPC64 doesn't have PTRACE_GET_THREAD_AREA since the thread pointer
-+ // is stored in GPR 13.
-+ ThreadContext::t64_t tc;
-+ if (!GetRegisterSet(tid, NT_PRSTATUS, &tc, can_log)) {
-+ LOG_IF(ERROR, can_log) << "Unable to get thread pointer!";
-+ return false;
-+ }
-+
-+ *address = tc.gpr[13];
-+
-+ return true;
-+}
-+
-+// Stubs for 32-bit functions not applicable on PPC64
-+bool GetFloatingPointRegisters32(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) { return false; }
-+bool GetThreadArea32(pid_t tid,
-+ const ThreadContext &context,
-+ LinuxVMAddress *address,
-+ bool can_log) { return false; }
-+
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -494,6 +552,9 @@ bool Ptracer::GetThreadInfo(pid_t tid, ThreadInfo* info) {
- if (is_64_bit_) {
- return GetGeneralPurposeRegisters64(tid, &info->thread_context, can_log_) &&
- GetFloatingPointRegisters64(tid, &info->float_context, can_log_) &&
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ GetVectorRegisters64(tid, &info->vector_context, can_log_) &&
-+#endif
- GetThreadArea64(tid,
- info->thread_context,
- &info->thread_specific_data_address,
-diff --git a/third_party/crashpad/crashpad/util/linux/thread_info.h b/third_party/crashpad/crashpad/util/linux/thread_info.h
-index 5b55c24a7..dea0d1f39 100644
---- a/third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ b/third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -28,6 +28,10 @@
- #include <android/api-level.h>
- #endif
-
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+#include <sys/ucontext.h>
-+#endif
-+
- namespace crashpad {
-
- //! \brief The set of general purpose registers for an architecture family.
-@@ -79,6 +83,8 @@ union ThreadContext {
- uint32_t cp0_status;
- uint32_t cp0_cause;
- uint32_t padding1_;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // PPC64 is 64-bit
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -132,6 +138,21 @@ union ThreadContext {
- uint64_t cp0_badvaddr;
- uint64_t cp0_status;
- uint64_t cp0_cause;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects struct pt_regs in asm/ptrace.h.
-+ uint64_t gpr[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_gpr3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -143,6 +164,8 @@ union ThreadContext {
- using NativeThreadContext = user_regs;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate NativeThreadsContext type available for MIPS
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ using NativeThreadContext = struct pt_regs;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY || ARCH_CPU_ARM64
-@@ -218,6 +241,9 @@ union FloatContext {
- } fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Crashpad's PPC support is 64-bit only, so this
-+ // 32bit-only struct is declared as empty.
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -252,6 +278,10 @@ union FloatContext {
- double fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects fpregset_t in sys/ucontext.h
-+ double fpregs[32];
-+ double fpscr;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -280,6 +310,8 @@ union FloatContext {
- static_assert(sizeof(f64) == sizeof(user_fpsimd_struct), "Size mismatch");
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate floating point context native type for available MIPS.
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ static_assert(sizeof(f64) == sizeof(fpregset_t), "Size mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86
-@@ -287,6 +319,26 @@ union FloatContext {
- static_assert(std::is_standard_layout<FloatContext>::value,
- "Not standard layout");
-
-+//! \brief The vector registers used for an architecture family
-+union VectorContext {
-+ struct v32_t {} v32;
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ __attribute__((__aligned__(16))) // Vector context must be doubleword aligned.
-+#endif
-+ struct v64_t {
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects vrregset_t in sys/ucontext.h
-+ uint32_t vrregs[32][4];
-+ struct {
-+ uint32_t __pad[3];
-+ uint32_t vscr_word;
-+ } vscr;
-+ uint32_t vrsave;
-+ uint32_t __pad[3];
-+#endif
-+ } v64;
-+};
-+
- //! \brief A collection of `ptrace`-able information about a thread.
- struct ThreadInfo {
- ThreadInfo();
-@@ -298,6 +350,9 @@ struct ThreadInfo {
- //! \brief The floating point registers for the thread.
- FloatContext float_context;
-
-+ //! \brief (Optional) The vector registers used for the thread.
-+ VectorContext vector_context;
-+
- //! \brief The thread-local storage address for the thread.
- LinuxVMAddress thread_specific_data_address;
- };
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context.h b/third_party/crashpad/crashpad/util/misc/capture_context.h
-index d21a24f19..acc325349 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context.h
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context.h
-@@ -69,6 +69,7 @@ using NativeCPUContext = ucontext_t;
- //! macOS/Linux/Fuchsia | x86_64 | `%%rdi`
- //! Linux | ARM/ARM64 | `r0`/`x0`
- //! Linux | MIPS/MIPS64 | `$a0`
-+//! Linux | PPC64 | `r3`
- //!
- //! Additionally, the value `LR` on ARM/ARM64 will be the return address of
- //! this function.
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-index 52215ee5d..b3e4a3ec7 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-@@ -32,7 +32,7 @@
- .balign 4, 0x0
- .type CAPTURECONTEXT_SYMBOL, %function
- .type CAPTURECONTEXT_SYMBOL2, %function
--#elif defined(__mips__)
-+#elif defined(__mips__) || defined(__powerpc64__)
- .balign 4, 0x0
- #endif
-
-@@ -423,4 +423,214 @@ CAPTURECONTEXT_SYMBOL2:
- jr $ra
-
- .set at
-+#elif defined(__powerpc64__)
-+ // Store r0-r31
-+ std 0, 0xe8(3) // context->uc_mcontext.gp_regs[0]
-+ std 1, 0xf0(3) // context->uc_mcontext.gp_regs[1]
-+ std 2, 0xf8(3) // context->uc_mcontext.gp_regs[2]
-+ // note that r3's original value was lost
-+ std 3, 0x100(3) // context->uc_mcontext.gp_regs[3]
-+ std 4, 0x108(3) // context->uc_mcontext.gp_regs[4]
-+ std 5, 0x110(3) // context->uc_mcontext.gp_regs[5]
-+ std 6, 0x118(3) // context->uc_mcontext.gp_regs[6]
-+ std 7, 0x120(3) // context->uc_mcontext.gp_regs[7]
-+ std 8, 0x128(3) // context->uc_mcontext.gp_regs[8]
-+ std 9, 0x130(3) // context->uc_mcontext.gp_regs[9]
-+ std 10, 0x138(3) // context->uc_mcontext.gp_regs[10]
-+ std 11, 0x140(3) // context->uc_mcontext.gp_regs[11]
-+ std 12, 0x148(3) // context->uc_mcontext.gp_regs[12]
-+ std 13, 0x150(3) // context->uc_mcontext.gp_regs[13]
-+ std 14, 0x158(3) // context->uc_mcontext.gp_regs[14]
-+ std 15, 0x160(3) // context->uc_mcontext.gp_regs[15]
-+ std 16, 0x168(3) // context->uc_mcontext.gp_regs[16]
-+ std 17, 0x170(3) // context->uc_mcontext.gp_regs[17]
-+ std 18, 0x178(3) // context->uc_mcontext.gp_regs[18]
-+ std 19, 0x180(3) // context->uc_mcontext.gp_regs[19]
-+ std 20, 0x188(3) // context->uc_mcontext.gp_regs[20]
-+ std 21, 0x190(3) // context->uc_mcontext.gp_regs[21]
-+ std 22, 0x198(3) // context->uc_mcontext.gp_regs[22]
-+ std 23, 0x1a0(3) // context->uc_mcontext.gp_regs[23]
-+ std 24, 0x1a8(3) // context->uc_mcontext.gp_regs[24]
-+ std 25, 0x1b0(3) // context->uc_mcontext.gp_regs[25]
-+ std 26, 0x1b8(3) // context->uc_mcontext.gp_regs[26]
-+ std 27, 0x1c0(3) // context->uc_mcontext.gp_regs[27]
-+ std 28, 0x1c8(3) // context->uc_mcontext.gp_regs[28]
-+ std 29, 0x1d0(3) // context->uc_mcontext.gp_regs[29]
-+ std 30, 0x1d8(3) // context->uc_mcontext.gp_regs[30]
-+ std 31, 0x1e0(3) // context->uc_mcontext.gp_regs[31]
-+
-+ // For NIP, we can use the value in the link register
-+ mflr 0
-+ std 0, 0x1e8(3) // context->uc_mcontext.gp_regs[PT_NIP]
-+
-+ // CTR
-+ mfctr 0
-+ std 0, 0x200(3) // context->uc_mcontext.gp_regs[PT_CTR]
-+
-+ // For LNK, we'll use the caller's LR save area (2 stack frames up).
-+ // r4 can be used as a scratch register since it has already been saved.
-+ ld 4, 0(1)
-+ ld 4, 16(4)
-+ std 4, 0x208(3) // context->uc_mcontext.gp_regs[PT_LNK]
-+
-+ // XER
-+ mfxer 0
-+ std 0, 0x210(3) // context->uc_mcontext.gp_regs[PT_XER]
-+
-+ // CCR
-+ mfcr 0
-+ std 0, 0x218(3) // context->uc_mcontext.gp_regs[PT_CCR]
-+
-+ // MSR, orig_r3, MQ, TRAP, DAR, DSISR, RESULT, DSCR,
-+ // not used or not relevant, zero them out.
-+ li 4, 0
-+ std 4, 0x1f0(3) // context->uc_mcontext.gp_regs[PT_MSR]
-+ std 4, 0x1f8(3) // context->uc_mcontext.gp_regs[PT_ORIG_R3]
-+ std 4, 0x220(3) // context->uc_mcontext.gp_regs[PT_MQ]
-+ std 4, 0x228(3) // context->uc_mcontext.gp_regs[PT_TRAP]
-+ std 4, 0x230(3) // context->uc_mcontext.gp_regs[PT_DAR]
-+ std 4, 0x238(3) // context->uc_mcontext.gp_regs[PT_DSISR]
-+ std 4, 0x240(3) // context->uc_mcontext.gp_regs[PT_RESULT]
-+ std 4, 0x248(3) // context->uc_mcontext.gp_regs[PT_DSCR]
-+
-+ // Update context->uc_mcontext.regs to point to gp_regs
-+ addi 0, 3, 0xe8
-+ std 0, 0xe0(3)
-+
-+ // Save floating point registers 0-31
-+ stfd 0, 0x268(3) // context->uc_mcontext.fp_regs[0]
-+ stfd 1, 0x270(3) // context->uc_mcontext.fp_regs[1]
-+ stfd 2, 0x278(3) // context->uc_mcontext.fp_regs[2]
-+ stfd 3, 0x280(3) // context->uc_mcontext.fp_regs[3]
-+ stfd 4, 0x288(3) // context->uc_mcontext.fp_regs[4]
-+ stfd 5, 0x290(3) // context->uc_mcontext.fp_regs[5]
-+ stfd 6, 0x298(3) // context->uc_mcontext.fp_regs[6]
-+ stfd 7, 0x2a0(3) // context->uc_mcontext.fp_regs[7]
-+ stfd 8, 0x2a8(3) // context->uc_mcontext.fp_regs[8]
-+ stfd 9, 0x2b0(3) // context->uc_mcontext.fp_regs[9]
-+ stfd 10, 0x2b8(3) // context->uc_mcontext.fp_regs[10]
-+ stfd 11, 0x2c0(3) // context->uc_mcontext.fp_regs[11]
-+ stfd 12, 0x2c8(3) // context->uc_mcontext.fp_regs[12]
-+ stfd 13, 0x2d0(3) // context->uc_mcontext.fp_regs[13]
-+ stfd 14, 0x2d8(3) // context->uc_mcontext.fp_regs[14]
-+ stfd 15, 0x2e0(3) // context->uc_mcontext.fp_regs[15]
-+ stfd 16, 0x2e8(3) // context->uc_mcontext.fp_regs[16]
-+ stfd 17, 0x2f0(3) // context->uc_mcontext.fp_regs[17]
-+ stfd 18, 0x2f8(3) // context->uc_mcontext.fp_regs[18]
-+ stfd 19, 0x300(3) // context->uc_mcontext.fp_regs[19]
-+ stfd 20, 0x308(3) // context->uc_mcontext.fp_regs[20]
-+ stfd 21, 0x310(3) // context->uc_mcontext.fp_regs[21]
-+ stfd 22, 0x318(3) // context->uc_mcontext.fp_regs[22]
-+ stfd 23, 0x320(3) // context->uc_mcontext.fp_regs[23]
-+ stfd 24, 0x328(3) // context->uc_mcontext.fp_regs[24]
-+ stfd 25, 0x330(3) // context->uc_mcontext.fp_regs[25]
-+ stfd 26, 0x338(3) // context->uc_mcontext.fp_regs[26]
-+ stfd 27, 0x340(3) // context->uc_mcontext.fp_regs[27]
-+ stfd 28, 0x348(3) // context->uc_mcontext.fp_regs[28]
-+ stfd 29, 0x350(3) // context->uc_mcontext.fp_regs[29]
-+ stfd 30, 0x358(3) // context->uc_mcontext.fp_regs[30]
-+ stfd 31, 0x360(3) // context->uc_mcontext.fp_regs[31]
-+
-+ // FPSCR
-+ mffs 0
-+ stfd 0, 0x368(3) // context->uc_mcontext.fp_regs[32]
-+
-+ // Save VMX Vector registers
-+ // Update r4 to contain the base address of vmx_reserve
-+ addi 4, 3, 0x378
-+ // Ensure that it is quadword aligned
-+ andi. 5, 4, 0xF
-+ beq 1f // No alignment is necessary
-+ // Address is doubleword aligned and not quadword aligned, add 8
-+ addi 4, 4, 8
-+
-+1:
-+ // Store VMX registers 0-31
-+ // r4 will contain the base address
-+ // r5 will contain the index
-+ li 5, 0
-+ stvx 0, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 0]
-+ addi 5, 5, 16
-+ stvx 1, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 1]
-+ addi 5, 5, 16
-+ stvx 2, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 2]
-+ addi 5, 5, 16
-+ stvx 3, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 3]
-+ addi 5, 5, 16
-+ stvx 4, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 4]
-+ addi 5, 5, 16
-+ stvx 5, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 5]
-+ addi 5, 5, 16
-+ stvx 6, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 6]
-+ addi 5, 5, 16
-+ stvx 7, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 7]
-+ addi 5, 5, 16
-+ stvx 8, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 8]
-+ addi 5, 5, 16
-+ stvx 9, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 9]
-+ addi 5, 5, 16
-+ stvx 10, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 10]
-+ addi 5, 5, 16
-+ stvx 11, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 11]
-+ addi 5, 5, 16
-+ stvx 12, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 12]
-+ addi 5, 5, 16
-+ stvx 13, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 13]
-+ addi 5, 5, 16
-+ stvx 14, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 14]
-+ addi 5, 5, 16
-+ stvx 15, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 15]
-+ addi 5, 5, 16
-+ stvx 16, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 16]
-+ addi 5, 5, 16
-+ stvx 17, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 17]
-+ addi 5, 5, 16
-+ stvx 18, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 18]
-+ addi 5, 5, 16
-+ stvx 19, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 19]
-+ addi 5, 5, 16
-+ stvx 20, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 20]
-+ addi 5, 5, 16
-+ stvx 21, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 21]
-+ addi 5, 5, 16
-+ stvx 22, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 22]
-+ addi 5, 5, 16
-+ stvx 23, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 23]
-+ addi 5, 5, 16
-+ stvx 24, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 24]
-+ addi 5, 5, 16
-+ stvx 25, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 25]
-+ addi 5, 5, 16
-+ stvx 26, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 26]
-+ addi 5, 5, 16
-+ stvx 27, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 27]
-+ addi 5, 5, 16
-+ stvx 28, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 28]
-+ addi 5, 5, 16
-+ stvx 29, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 29]
-+ addi 5, 5, 16
-+ stvx 30, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 30]
-+ addi 5, 5, 16
-+ stvx 31, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 31]
-+ addi 5, 5, 16
-+
-+ // VSCR
-+ mfvscr 0
-+ stvx 0, 4, 5
-+ addi 5, 5, 16
-+
-+ // VRSAVE
-+ mfvrsave 0
-+ stwx 0, 4, 5
-+
-+ // Update context->uc_mcontext.v_regs to point to vmx_reserve + alignment.
-+ std 4, 0x370(3)
-+
-+ // Zero out all unused fields
-+ li 4, 0
-+ std 4, 0xc8(3) // context->uc_mcontext.signal
-+ std 4, 0xd0(3) // context->uc_mcontext.handler
-+ std 4, 0xd8(3) // context->uc_mcontext.oldmask
-+
-+ blr
- #endif // __i386__
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-index cf23c2def..5f264bc92 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-@@ -57,7 +57,7 @@ void TestCaptureContext() {
- uintptr_t pc = ProgramCounterFromContext(context_1);
-
- #if !defined(ADDRESS_SANITIZER) && !defined(ARCH_CPU_MIPS_FAMILY) && \
-- !defined(MEMORY_SANITIZER)
-+ !defined(MEMORY_SANITIZER) && !defined(ARCH_CPU_PPC64_FAMILY)
- // Sanitizers can cause enough code bloat that the “nearby” check would
- // likely fail.
- const uintptr_t kReferencePC =
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-index 30a2ab21d..60509f21d 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-@@ -35,6 +35,8 @@ void SanityCheckContext(const NativeCPUContext& context) {
- EXPECT_EQ(context.uc_mcontext.regs[0], FromPointerCast<uintptr_t>(&context));
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- EXPECT_EQ(context.uc_mcontext.gregs[4], FromPointerCast<uintptr_t>(&context));
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ EXPECT_EQ(context.uc_mcontext.gp_regs[3], FromPointerCast<uintptr_t>(&context));
- #endif
- }
-
-@@ -49,6 +51,8 @@ uintptr_t ProgramCounterFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.pc;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.pc;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[PT_NIP];
- #endif
- }
-
-@@ -63,6 +67,8 @@ uintptr_t StackPointerFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.sp;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.gregs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[1];
- #endif
- }
-
-diff --git a/third_party/dav1d/config/linux/ppc64/config.h b/third_party/dav1d/config/linux/ppc64/config.h
-new file mode 100644
-index 000000000..9fbbf75cc
---- /dev/null
-+++ b/third_party/dav1d/config/linux/ppc64/config.h
-@@ -0,0 +1,39 @@
-+/*
-+ * Autogenerated by the Meson build system.
-+ * Do not edit, your changes will be lost.
-+ */
-+
-+#pragma once
-+
-+#define ARCH_AARCH64 0
-+
-+#define ARCH_ARM 0
-+
-+#define ARCH_PPC64LE 1
-+
-+#define ARCH_X86 0
-+
-+#define ARCH_X86_32 0
-+
-+#define ARCH_X86_64 0
-+
-+#define CONFIG_16BPC 1
-+
-+#define CONFIG_8BPC 1
-+
-+// #define CONFIG_LOG 1 -- Logging is controlled by Chromium
-+
-+#define ENDIANNESS_BIG 0
-+
-+#define HAVE_ASM 1
-+
-+#define HAVE_CLOCK_GETTIME 1
-+
-+#define HAVE_DLSYM 1
-+
-+#define HAVE_GETAUXVAL 1
-+
-+#define HAVE_POSIX_MEMALIGN 1
-+
-+#define HAVE_UNISTD_H 1
-+
-diff --git a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-index 0b4bd72f0..a0caa5e71 100644
---- a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-+++ b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-@@ -51,4 +51,19 @@
- #define u16l_to_i32(v) ((i32x4) vec_mergel((u16x8) v, vec_splat_u16(0)))
- #define i16l_to_i32(v) ((i32x4) vec_unpackl((i16x8)v))
-
-+#if defined(__clang__)
-+#undef vec_splats
-+#define vec_splats(N) \
-+ _Generic((N), \
-+ unsigned char: ((u8x16)(N)), \
-+ signed char: ((i8x16)(N)), \
-+ unsigned short: ((u16x8)(N)), \
-+ signed short: ((i16x8)(N)), \
-+ unsigned int: ((u32x4)(N)), \
-+ signed int: ((i32x4)(N)), \
-+ unsigned long long: ((u64x2)(N)), \
-+ signed long long: ((i64x2)(N)) \
-+ )
-+#endif
-+
- #endif /* DAV1D_SRC_PPC_TYPES_H */
-diff --git a/third_party/eigen3/BUILD.gn b/third_party/eigen3/BUILD.gn
-index 0d4e184..f2ce484 100644
---- a/third_party/eigen3/BUILD.gn
-+++ b/third_party/eigen3/BUILD.gn
-@@ -22,4 +22,8 @@ config("eigen_includes") {
- # for this component on Windows on Arm due to compilation errors.
- defines += [ "EIGEN_DONT_VECTORIZE" ]
- }
-+
-+ if (target_cpu == "ppc64") {
-+ defines += [ "EIGEN_DONT_VECTORIZE" ]
-+ }
- }
-
-diff --git a/third_party/libaom/BUILD.gn b/third_party/libaom/BUILD.gn
-index 9b065bd..df3af02 100644
---- a/third_party/libaom/BUILD.gn
-+++ b/third_party/libaom/BUILD.gn
-@@ -40,6 +40,8 @@
- cpu_arch_full = "generic"
- } else if (current_cpu == "loong64") {
- cpu_arch_full = "generic"
-+} else if (current_cpu == "ppc64") {
-+ cpu_arch_full = "generic"
- } else {
- cpu_arch_full = current_cpu
- }
-diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h
-index e4ac22644..1c57015db 100644
---- a/third_party/lss/linux_syscall_support.h
-+++ b/third_party/lss/linux_syscall_support.h
-@@ -3947,7 +3947,7 @@ struct kernel_statfs {
- LSS_REG(2, buf);
- LSS_BODY(void*, mmap2, "0"(__r2));
- }
--#else
-+#elif !defined(__powerpc64__) /* ppc64 doesn't have mmap2 */
- #define __NR__mmap2 __NR_mmap2
- LSS_INLINE _syscall6(void*, _mmap2, void*, s,
- size_t, l, int, p,
-@@ -4058,7 +4058,7 @@ struct kernel_statfs {
- #if defined(__i386__) || \
- defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \
- (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \
-- defined(__PPC__) || \
-+ (defined(__PPC__) && !defined(__powerpc64__)) || \
- (defined(__s390__) && !defined(__s390x__))
- /* On these architectures, implement mmap() with mmap2(). */
- LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d,
-@@ -4872,11 +4872,11 @@ struct kernel_statx {
- LSS_SC_BODY(4, int, 8, d, type, protocol, sv);
- }
- #endif
-- #if defined(__NR_recvmsg)
-+ #if defined(__NR_recvmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, recvmsg, int, s, struct kernel_msghdr*, msg,
- int, flags)
- #endif
-- #if defined(__NR_sendmsg)
-+ #if defined(__NR_sendmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, sendmsg, int, s, const struct kernel_msghdr*,
- msg, int, flags)
- #endif
-@@ -4885,13 +4885,13 @@ struct kernel_statx {
- int, flags, const struct kernel_sockaddr*, to,
- unsigned int, tolen)
- #endif
-- #if defined(__NR_shutdown)
-+ #if defined(__NR_shutdown) && !defined(__PPC__)
- LSS_INLINE _syscall2(int, shutdown, int, s, int, how)
- #endif
-- #if defined(__NR_socket)
-+ #if defined(__NR_socket) && !defined(__PPC__)
- LSS_INLINE _syscall3(int, socket, int, domain, int, type, int, protocol)
- #endif
-- #if defined(__NR_socketpair)
-+ #if defined(__NR_socketpair) && !defined(__PPC__)
- LSS_INLINE _syscall4(int, socketpair, int, d, int, type, int, protocol,
- int*, sv)
- #endif
-diff --git a/third_party/pdfium/third_party/libpng16/pngpriv.h b/third_party/pdfium/third_party/libpng16/pngpriv.h
-index 583c26f..e03d697 100644
---- a/third_party/pdfium/third_party/libpng16/pngpriv.h
-+++ b/third_party/pdfium/third_party/libpng16/pngpriv.h
-@@ -196,11 +196,7 @@
- #endif
-
- #ifndef PNG_POWERPC_VSX_OPT
--# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
--# define PNG_POWERPC_VSX_OPT 2
--# else
--# define PNG_POWERPC_VSX_OPT 0
--# endif
-+# define PNG_POWERPC_VSX_OPT 0
- #endif
-
- #ifndef PNG_INTEL_SSE_OPT
-diff --git a/third_party/pffft/src/pffft.c b/third_party/pffft/src/pffft.c
-index bdac4d784..51e0f2cac 100644
---- a/third_party/pffft/src/pffft.c
-+++ b/third_party/pffft/src/pffft.c
-@@ -100,6 +100,7 @@
- Altivec support macros
- */
- #if !defined(PFFFT_SIMD_DISABLE) && (defined(__ppc__) || defined(__ppc64__))
-+#include <altivec.h>
- typedef vector float v4sf;
- # define SIMD_SZ 4
- # define VZERO() ((vector float) vec_splat_u8(0))
-diff --git a/third_party/sqlite/src/amalgamation/sqlite3.c b/third_party/sqlite/src/amalgamation/sqlite3.c
-index 6b4a7899d..b8c7fe414 100644
---- a/third_party/sqlite/src/amalgamation/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation/sqlite3.c
-@@ -14474,7 +14474,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/amalgamation_dev/sqlite3.c b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-index d30c9b7de..cf75a69d9 100644
---- a/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-@@ -14487,7 +14487,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/ext/rtree/rtree.c b/third_party/sqlite/src/ext/rtree/rtree.c
-index f5b57a5e2..80a2d0ad8 100644
---- a/third_party/sqlite/src/ext/rtree/rtree.c
-+++ b/third_party/sqlite/src/ext/rtree/rtree.c
-@@ -450,7 +450,7 @@ struct RtreeMatchArg {
- #if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__arm__)
-+ defined(__arm__) || defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- #elif defined(sparc) || defined(__ppc__)
- # define SQLITE_BYTEORDER 4321
-diff --git a/third_party/sqlite/src/src/sqliteInt.h b/third_party/sqlite/src/src/sqliteInt.h
-index 245070d4f..b25164e95 100644
---- a/third_party/sqlite/src/src/sqliteInt.h
-+++ b/third_party/sqlite/src/src/sqliteInt.h
-@@ -877,7 +877,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/webrtc/rtc_base/system/arch.h b/third_party/webrtc/rtc_base/system/arch.h
-index be2367b85..be4ee4233 100644
---- a/third_party/webrtc/rtc_base/system/arch.h
-+++ b/third_party/webrtc/rtc_base/system/arch.h
-@@ -79,6 +79,18 @@
- #elif defined(__EMSCRIPTEN__)
- #define WEBRTC_ARCH_32_BITS
- #define WEBRTC_ARCH_LITTLE_ENDIAN
-+#elif defined(__PPC__)
-+#define WEBRTC_ARCH_PPC_FAMILY
-+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-+#define WEBRTC_ARCH_LITTLE_ENDIAN
-+#else
-+#define WEBRTC_ARCH_BIG_ENDIAN
-+#endif
-+#if defined(__LP64__)
-+#define WEBRTC_ARCH_64_BITS
-+#else
-+#define WEBRTC_ARCH_32_BITS
-+#endif
- #else
- #error Please add support for your architecture in rtc_base/system/arch.h
- #endif
-diff --git a/v8/BUILD.gn b/v8/BUILD.gn
-index f39529a3a..e84fc449e 100644
---- a/v8/BUILD.gn
-+++ b/v8/BUILD.gn
-@@ -850,6 +850,12 @@ config("toolchain") {
- }
- if (host_byteorder == "little") {
- defines += [ "V8_TARGET_ARCH_PPC_LE" ]
-+ cflags += [
-+ # Enable usage of AltiVec, VSX, and other POWER8 and higher features
-+ "-mcpu=power8",
-+ "-maltivec",
-+ "-mvsx",
-+ ]
- } else if (host_byteorder == "big") {
- defines += [ "V8_TARGET_ARCH_PPC_BE" ]
- if (current_os == "aix") {
---- a/ui/gl/features.gni
-+++ b/ui/gl/features.gni
-@@ -33,5 +33,5 @@
- is_chromeos_ash || is_fuchsia) &&
- (target_cpu == "x86" || target_cpu == "x64" || target_cpu == "arm" ||
- target_cpu == "arm64" || target_cpu == "mipsel" ||
-- target_cpu == "mips64el" || target_cpu == "riscv64")
-+ target_cpu == "mips64el" || target_cpu == "riscv64" || target_cpu == "ppc64")
- }
-diff --git a/v8/test/BUILD.gn b/v8/test/BUILD.gn
-index fb872ad39..45fc585dd 100644
---- a/v8/test/BUILD.gn
-+++ b/v8/test/BUILD.gn
-@@ -42,7 +42,7 @@ group("gn_all") {
- "benchmarks/cpp:gn_all",
- "cctest:cctest",
- "unittests:generate-bytecode-expectations",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
- }
- }
-@@ -84,7 +84,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- "webkit:v8_webkit",
- ]
-
-@@ -109,7 +109,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
-
- if (v8_enable_webassembly) {
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch b/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
deleted file mode 100644
index df453f491d8c..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-+++ b/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-@@ -574,6 +574,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCAsmInfoCOFF.cpp",
- "llvm/lib/MC/MCAsmInfoDarwin.cpp",
- "llvm/lib/MC/MCAsmInfoELF.cpp",
-+ "llvm/lib/MC/MCAsmInfoXCOFF.cpp",
- "llvm/lib/MC/MCAsmMacro.cpp",
- "llvm/lib/MC/MCAsmStreamer.cpp",
- "llvm/lib/MC/MCAssembler.cpp",
-@@ -629,6 +630,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCWinCOFFStreamer.cpp",
- "llvm/lib/MC/MCWinEH.cpp",
- "llvm/lib/MC/MCXCOFFStreamer.cpp",
-+ "llvm/lib/MC/MCXCOFFObjectTargetWriter.cpp",
- "llvm/lib/MC/MachObjectWriter.cpp",
- "llvm/lib/MC/StringTableBuilder.cpp",
- "llvm/lib/MC/SubtargetFeature.cpp",
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 7dea8bbe50d3..50b9a3aec409 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -1,7 +1,7 @@
# Template file for 'chromium'
pkgname=chromium
# See https://chromiumdash.appspot.com/releases?platform=Linux for the latest version
-version=108.0.5359.124
+version=109.0.5414.74
revision=1
archs="i686* x86_64* aarch64* armv7l* ppc64le*"
hostmakedepends="
@@ -28,7 +28,7 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://www.chromium.org/"
distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz"
-checksum=d48dfac2a61b14a5d7d2f460b09b70ef3ab88e27b82e3173938cb54eaa612a75
+checksum=eded233c26ab631be325ad49cb306c338513b6a6528197d42653e66187548e5d
lib32disabled=yes
@@ -220,9 +220,6 @@ do_configure() {
'icu_use_data_file=true'
- 'use_allocator="none"'
- 'use_allocator_shim=false'
-
'enable_widevine=true'
'enable_hangout_services_extension=true'
@@ -318,13 +315,13 @@ do_configure() {
do_build() {
_setup_toolchain
- CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver chrome_crashpad_handler
+ CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver.unstripped chrome_crashpad_handler
}
do_install() {
vinstall out/Release/chrome 755 usr/lib/${pkgname} ${pkgname}
vinstall out/Release/chrome_crashpad_handler 755 usr/lib/${pkgname} chrome_crashpad_handler
- vinstall out/Release/chromedriver 755 usr/lib/${pkgname} chromedriver
+ vinstall out/Release/chromedriver.unstripped 755 usr/lib/${pkgname} chromedriver
vinstall out/Release/libEGL.so 755 usr/lib/${pkgname} libEGL.so
vinstall out/Release/libGLESv2.so 755 usr/lib/${pkgname} libGLESv2.so
vinstall out/Release/libvk_swiftshader.so 755 usr/lib/${pkgname} libvk_swiftshader.so
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] chromium: update to 109.0.5414.74.
2023-01-11 1:12 [PR PATCH] chromium: update to 109.0.5414.74 Duncaen
@ 2023-01-11 14:05 ` Duncaen
2023-01-11 14:05 ` Duncaen
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Duncaen @ 2023-01-11 14:05 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]
There is an updated pull request by Duncaen against master on the void-packages repository
https://github.com/Duncaen/void-packages chromium-109
https://github.com/void-linux/void-packages/pull/41570
chromium: update to 109.0.5414.74.
[ci skip]
* [ ] x86_64-glibc
* [ ] x86_64-musl
* [ ] aarch64-musl
* [ ] i686
A patch file from https://github.com/void-linux/void-packages/pull/41570.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-chromium-109-41570.patch --]
[-- Type: text/x-diff, Size: 180073 bytes --]
From 50da97ad22034197f74ebc9191fb2fb3c0fa65e2 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Wed, 11 Jan 2023 01:28:40 +0100
Subject: [PATCH] chromium: update to 109.0.5414.74.
---
.../musl-patches/xxx-ppc64le-support.patch | 187 -
.../patches/build-add-use_cxx17.patch | 38 +-
.../patches/fix-build-with-old-clang.patch | 20 +
.../patches/fix-constexpr-narrowing.patch | 21 +
.../patches/fix-musl-pthread-stacksize.patch | 40 -
.../chromium/patches/fix-narrowing-cast.patch | 53 -
.../patches/fix-nasm-musl-config.patch | 12 -
srcpkgs/chromium/patches/narrowing-cast.patch | 21 +
...uild-error-on-linux-with-system-zlib.patch | 41 -
.../patches/remove-strip_binary.patch | 32 -
.../patches/xxx-ppc64le-4k-pages.patch | 60 -
.../chromium/patches/xxx-ppc64le-libvpx.patch | 33 -
.../xxx-ppc64le-sandbox-linux-stat.patch | 31 -
.../patches/xxx-ppc64le-support.patch | 3590 -----------------
.../patches/xxx-ppc64le-swiftshader.patch | 18 -
srcpkgs/chromium/template | 11 +-
16 files changed, 83 insertions(+), 4125 deletions(-)
delete mode 100644 srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
create mode 100644 srcpkgs/chromium/patches/fix-build-with-old-clang.patch
create mode 100644 srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
delete mode 100644 srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
delete mode 100644 srcpkgs/chromium/patches/fix-narrowing-cast.patch
delete mode 100644 srcpkgs/chromium/patches/fix-nasm-musl-config.patch
create mode 100644 srcpkgs/chromium/patches/narrowing-cast.patch
delete mode 100644 srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
delete mode 100644 srcpkgs/chromium/patches/remove-strip_binary.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-support.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
diff --git a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 555f69c072c8..000000000000
--- a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,187 +0,0 @@
-diff --git sandbox/linux/bpf_dsl/seccomp_macros.h sandbox/linux/bpf_dsl/seccomp_macros.h
-index a6aec544e..2a4a7f1bc 100644
---- sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,7 +16,7 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
--#elif defined(__powerpc64__)
-+#elif defined(__powerpc64__) && defined(__GLIBC__)
- // Manually define greg_t on ppc64
- typedef unsigned long long greg_t;
- #endif
-@@ -361,11 +361,11 @@ typedef struct pt_regs regs_struct;
- #define SECCOMP_ARCH AUDIT_ARCH_PPC64
- #endif
-
--#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+#define SECCOMP_REG(_ctx, _reg) (((struct pt_regs *)(_ctx)->uc_mcontext.regs)->gpr[_reg])
-
- #define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
--#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_IP(_ctx) ((struct pt_regs *)(_ctx)->uc_mcontext.regs)->nip
- #define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
- #define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-diff --git sandbox/linux/seccomp-bpf/syscall.cc sandbox/linux/seccomp-bpf/syscall.cc
-index d53a7ff56..c290f0e92 100644
---- sandbox/linux/seccomp-bpf/syscall.cc
-+++ sandbox/linux/seccomp-bpf/syscall.cc
-@@ -499,9 +499,9 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // Same as MIPS, need to invert ret and set error register (cr0.SO)
- if (ret_val <= -1 && ret_val >= -4095) {
- ret_val = -ret_val;
-- ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr |= (1 << 28);
- } else {
-- ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr &= ~(1 << 28);
- }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
---- third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-+++ third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-@@ -22,6 +22,7 @@
- // The following platforms have an implementation of a hardware counter.
- #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
- defined(__powerpc__) || defined(__ppc__) || defined(__riscv) || \
-+ ((defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__)) || defined(__riscv) || \
- defined(_M_IX86) || (defined(_M_X64) && !defined(_M_ARM64EC))
- #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1
- #else
---- third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-+++ third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-@@ -64,7 +64,7 @@
- #elif defined(__i386__) || defined(__x86_64__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_x86-inl.inc"
--#elif defined(__ppc__) || defined(__PPC__)
-+#elif (defined(__ppc__) || defined(__PPC__)) && defined(__GLIBC__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_powerpc-inl.inc"
- #elif defined(__aarch64__)
-diff --git third_party/breakpad/BUILD.gn third_party/breakpad/BUILD.gn
-index f9a60e37..25f3a0b7 100644
---- third_party/breakpad/BUILD.gn
-+++ third_party/breakpad/BUILD.gn
-@@ -637,6 +637,7 @@ if (is_linux || is_android) {
-
- if (current_cpu == "ppc64") {
- defines = [ "HAVE_GETCONTEXT" ]
-+ libs += [ "ucontext" ]
- } else {
- sources += [
- "breakpad/src/common/linux/breakpad_getcontext.S"
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index 03afec7a..0264ecf1 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -273,6 +273,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t ThreadInfo::GetInstructionPointer() const {
- return mcontext.gp_regs[PT_NIP];
- }
-@@ -290,9 +293,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->ctr = mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] = \
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 1090470f..e580233d 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -257,6 +257,9 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
- return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
- }
-@@ -280,9 +283,9 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&uc->uc_mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&uc->uc_mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] =
-diff --git third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index 5a7ab50c..ee8b858c 100644
---- third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -105,6 +105,11 @@
- #define PR_SET_PTRACER 0x59616d61
- #endif
-
-+/* musl hack, can't include asm/ptrace.h as that causes conflicts */
-+#if defined(__powerpc64__) && !defined(PT_NIP)
-+#define PT_NIP 32
-+#endif
-+
- namespace google_breakpad {
-
- namespace {
-diff --git third_party/crashpad/crashpad/snapshot/linux/signal_context.h third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 8e335a09..b2a0f155 100644
---- third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -469,7 +469,7 @@ struct MContext64 {
- SignalThreadContext64 gp_regs;
- SignalFloatContext64 fp_regs;
- SignalVectorContext64 *v_regs;
-- int64_t vmx_reserve[69];
-+ int64_t vmx_reserve[101];
- };
-
- struct ContextTraits64 : public Traits64 {
-diff --git third_party/crashpad/crashpad/util/linux/thread_info.h third_party/crashpad/crashpad/util/linux/thread_info.h
-index dea0d1f3..b203e5b2 100644
---- third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -30,6 +30,7 @@
-
- #if defined(ARCH_CPU_PPC64_FAMILY)
- #include <sys/ucontext.h>
-+#include <asm/ptrace.h>
- #endif
-
- namespace crashpad {
-diff --git third_party/lss/linux_syscall_support.h third_party/lss/linux_syscall_support.h
-index 9955ce44..4c1cc488 100644
---- third_party/lss/linux_syscall_support.h
-+++ third_party/lss/linux_syscall_support.h
-@@ -4216,9 +4216,13 @@ struct kernel_statfs {
- }
- #endif
- #if defined(__NR_fstatat64)
-+ // musl does #define fstatat64 fstatat
-+ #undef fstatat64
- LSS_INLINE _syscall4(int, fstatat64, int, d,
- const char *, p,
- struct kernel_stat64 *, b, int, f)
-+ // set it back like it was
-+ #define fstatat64 fstatat
- #endif
- #if defined(__NR_waitpid)
- // waitpid is polyfilled below when not available.
diff --git a/srcpkgs/chromium/patches/build-add-use_cxx17.patch b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
index 091b1c553727..b50825fb7e2c 100644
--- a/srcpkgs/chromium/patches/build-add-use_cxx17.patch
+++ b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
@@ -1,26 +1,22 @@
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
-@@ -167,6 +167,10 @@
- # Enable -H, which prints the include tree during compilation.
- # For use by tools/clang/scripts/analyze_includes.py
- show_includes = false
-+
-+ # Allow projects that wish to stay on C++17 to override Chromium's default.
-+ # TODO(crbug.com/1402249): evaluate removing this end of 2023
-+ use_cxx17 = false
+@@ -191,6 +191,10 @@
+ current_cpu == "x64"))))
}
- declare_args() {
-@@ -596,7 +600,11 @@
- } else if (is_linux) {
- # TODO(crbug.com/1284275): Switch to C++20 on all platforms.
- if (is_clang) {
-- cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ if (use_cxx17) {
-+ cflags_cc += [ "-std=${standard_prefix}++17" ]
-+ } else {
-+ cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ }
++declare_args() {
++ use_cxx17 = false
++}
++
+ if (is_android || (is_chromeos_ash && is_chromeos_device)) {
+ # Set the path to use orderfile for linking Chrome
+ # Note that this is for using only one orderfile for linking
+@@ -605,7 +609,7 @@
+ cflags_cc += [ "-fno-trigraphs" ]
+ }
+ } else if (is_clang) {
+- if (is_chromeos_device) {
++ if (is_chromeos_device || use_cxx17) {
+ # TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
+ cflags_cc += [ "-std=${standard_prefix}++17" ]
} else {
- # The gcc bots are currently using GCC 9, which is not new enough to
- # support "c++20"/"gnu++20".
diff --git a/srcpkgs/chromium/patches/fix-build-with-old-clang.patch b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
new file mode 100644
index 000000000000..f23218e71e4d
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
@@ -0,0 +1,20 @@
+--- a/build/config/compiler/BUILD.gn
++++ b/build/config/compiler/BUILD.gn
+@@ -805,17 +805,6 @@
+ cflags += [ "-fcomplete-member-pointers" ]
+ }
+
+- # Use DWARF simple template names, with the following exceptions:
+- #
+- # * Windows is not supported as it doesn't use DWARF.
+- # * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
+- # lldb doesn't have the needed changes yet.
+- # * Fuchsia isn't supported as zxdb doesn't support simple template names yet.
+- # TODO(crbug.com/1379070): Remove if the upstream default ever changes.
+- if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
+- cflags_cc += [ "-gsimple-template-names" ]
+- }
+-
+ # MLGO specific flags. These flags enable an ML-based inliner trained on
+ # Chrome on Android (arm32) with ThinLTO enabled, optimizing for size.
+ # The "release" ML model is embedded into clang as part of its build.
diff --git a/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch b/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
new file mode 100644
index 000000000000..00f662a194a7
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
@@ -0,0 +1,21 @@
+--- third_party/blink/renderer/platform/media/web_media_player_impl.cc.orig
++++ third_party/blink/renderer/platform/media/web_media_player_impl.cc
+@@ -3881,15 +3881,15 @@
+ const T&... values) {
+ std::string strkey = std::string(key);
+
+- if constexpr (Flags & kEncrypted) {
++ if constexpr (Flags & kEncrypted != 0) {
+ if (is_encrypted_)
+ UmaFunction(strkey + ".EME", values...);
+ }
+
+- if constexpr (Flags & kTotal)
++ if constexpr (Flags & kTotal != 0)
+ UmaFunction(strkey + ".All", values...);
+
+- if constexpr (Flags & kPlaybackType) {
++ if constexpr (Flags & kPlaybackType != 0) {
+ auto demuxer_type = GetDemuxerType();
+ if (!demuxer_type.has_value())
+ return;
diff --git a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch b/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
deleted file mode 100644
index cd5533190db9..000000000000
--- a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- a/base/threading/platform_thread_linux.cc
-+++ b/base/threading/platform_thread_linux.cc
-@@ -436,8 +436,13 @@
-
- size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
- #if !defined(THREAD_SANITIZER)
-+#if defined(__GLIBC__)
- return 0;
- #else
-+ // musl libcs default is too small, use 8mb like glibc
-+ return (1 << 23);
-+#endif
-+#else
- // ThreadSanitizer bloats the stack heavily. Evidence has been that the
- // default stack size isn't enough for some browser tests.
- return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux).
---- a/chrome/browser/shutdown_signal_handlers_posix.cc
-+++ b/chrome/browser/shutdown_signal_handlers_posix.cc
-@@ -188,11 +188,21 @@
- g_shutdown_pipe_read_fd = pipefd[0];
- g_shutdown_pipe_write_fd = pipefd[1];
- #if !defined(ADDRESS_SANITIZER)
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
- #else
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 * 8;
-+#endif
-+#else
- // ASan instrumentation bloats the stack frames, so we need to increase the
- // stack size to avoid hitting the guard page.
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
-+#else
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 * 8;
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+#endif
- #endif
- ShutdownDetector* detector = new ShutdownDetector(
- g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);
diff --git a/srcpkgs/chromium/patches/fix-narrowing-cast.patch b/srcpkgs/chromium/patches/fix-narrowing-cast.patch
deleted file mode 100644
index afd42a1489ae..000000000000
--- a/srcpkgs/chromium/patches/fix-narrowing-cast.patch
+++ /dev/null
@@ -1,53 +0,0 @@
---- a/base/files/file_util_linux.cc
-+++ b/base/files/file_util_linux.cc
-@@ -23,14 +23,14 @@
-
- // Not all possible |statfs_buf.f_type| values are in linux/magic.h.
- // Missing values are copied from the statfs man page.
-- switch (statfs_buf.f_type) {
-+ switch (static_cast<uintmax_t>(statfs_buf.f_type)) {
- case 0:
- *type = FILE_SYSTEM_0;
- break;
- case EXT2_SUPER_MAGIC: // Also ext3 and ext4
- case MSDOS_SUPER_MAGIC:
- case REISERFS_SUPER_MAGIC:
-- case static_cast<int>(BTRFS_SUPER_MAGIC):
-+ case BTRFS_SUPER_MAGIC:
- case 0x5346544E: // NTFS
- case 0x58465342: // XFS
- case 0x3153464A: // JFS
-@@ -40,14 +40,14 @@
- *type = FILE_SYSTEM_NFS;
- break;
- case SMB_SUPER_MAGIC:
-- case static_cast<int>(0xFF534D42): // CIFS
-+ case 0xFF534D42: // CIFS
- *type = FILE_SYSTEM_SMB;
- break;
- case CODA_SUPER_MAGIC:
- *type = FILE_SYSTEM_CODA;
- break;
-- case static_cast<int>(HUGETLBFS_MAGIC):
-- case static_cast<int>(RAMFS_MAGIC):
-+ case HUGETLBFS_MAGIC:
-+ case RAMFS_MAGIC:
- case TMPFS_MAGIC:
- *type = FILE_SYSTEM_MEMORY;
- break;
---- a/base/system/sys_info_posix.cc
-+++ b/base/system/sys_info_posix.cc
-@@ -100,10 +100,10 @@
- if (HANDLE_EINTR(statfs(path.value().c_str(), &stats)) != 0)
- return false;
-
-- switch (stats.f_type) {
-+ switch (static_cast<uintmax_t>(stats.f_type)) {
- case TMPFS_MAGIC:
-- case static_cast<int>(HUGETLBFS_MAGIC):
-- case static_cast<int>(RAMFS_MAGIC):
-+ case HUGETLBFS_MAGIC:
-+ case RAMFS_MAGIC:
- return true;
- }
- return false;
diff --git a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch b/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
deleted file mode 100644
index 7a0337f3bf3b..000000000000
--- a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/third_party/nasm/config/config-linux.h
-+++ b/third_party/nasm/config/config-linux.h
-@@ -139,7 +139,9 @@
- #define HAVE_ACCESS 1
-
- /* Define to 1 if you have the `canonicalize_file_name' function. */
-+#ifdef __GLIBC__
- #define HAVE_CANONICALIZE_FILE_NAME 1
-+#endif
-
- /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
- /* #undef HAVE_CPU_TO_LE16 */
diff --git a/srcpkgs/chromium/patches/narrowing-cast.patch b/srcpkgs/chromium/patches/narrowing-cast.patch
new file mode 100644
index 000000000000..d10940eb7e89
--- /dev/null
+++ b/srcpkgs/chromium/patches/narrowing-cast.patch
@@ -0,0 +1,21 @@
+from the manpage for statfs:
+
+The __fsword_t type used for various fields in the statfs structure
+definition is a glibc internal type, not intended for public use. This
+leaves the programmer in a bit of a conundrum when trying to copy or
+compare these fields to local variables in a program. Using
+unsigned int for such variables suffices on most systems.
+
+--- a/base/system/sys_info_posix.cc
++++ b/base/system/sys_info_posix.cc
+@@ -64,8 +64,8 @@
+
+ switch (stats.f_type) {
+ case TMPFS_MAGIC:
+- case static_cast<int>(HUGETLBFS_MAGIC):
+- case static_cast<int>(RAMFS_MAGIC):
++ case static_cast<unsigned int>(HUGETLBFS_MAGIC):
++ case static_cast<unsigned int>(RAMFS_MAGIC):
+ return true;
+ }
+ return false;
diff --git a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch b/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
deleted file mode 100644
index 13d504d3e792..000000000000
--- a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From dda01a706453ded8c01c41775707cb5ef4e316f8 Mon Sep 17 00:00:00 2001
-From: Andres Salomon <dilinger@queued.net>
-Date: Tue, 25 Oct 2022 21:11:46 +0000
-Subject: [PATCH] Re-fix TFLite build error on linux when using the system zlib
-
-In commit ae0f9adb7e14c0d19ca695ef6ad40b321a8cb64c, I fixed some build
-errors related to minizip patch inclusion in TFLite. However, after that
-when TFLite Support was rolled to HEAD, a small part of that patch got
-dropped. The result is the following build error with 107.0.5304.62:
-
-../../third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc:22:10: fatal error: 'contrib/minizip/ioapi.h' file not found
- ^~~~~~~~~~~~~~~~~~~~~~~~~
-1 error generated.
-
-This commit re-adds the lost fix.
-
-R=junzou@chromium.org
-
-Change-Id: Ie96c3571894b5100a1e2a2771da29699eff0beb3
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3972087
-Reviewed-by: Robert Ogden <robertogden@chromium.org>
-Commit-Queue: Robert Ogden <robertogden@chromium.org>
-Auto-Submit: Andres Salomon <dilinger@queued.net>
-Cr-Commit-Position: refs/heads/main@{#1063478}
----
- .../metadata/cc/utils/zip_readonly_mem_file.cc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-index 392b6b411fe..525ae4a2b45 100644
---- a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-+++ b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-@@ -19,7 +19,7 @@ limitations under the License.
- #include <cstdio>
-
- #include "absl/strings/string_view.h" // from @com_google_absl
--#include "contrib/minizip/ioapi.h"
-+#include "third_party/zlib/contrib/minizip/ioapi.h"
-
- namespace tflite {
- namespace metadata {
diff --git a/srcpkgs/chromium/patches/remove-strip_binary.patch b/srcpkgs/chromium/patches/remove-strip_binary.patch
deleted file mode 100644
index 8b13c6a056a8..000000000000
--- a/srcpkgs/chromium/patches/remove-strip_binary.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/chrome/test/chromedriver/BUILD.gn.orig
-+++ b/chrome/test/chromedriver/BUILD.gn
-@@ -308,11 +308,7 @@
- }
- }
-
--if (is_linux) {
-- chromedriver_output = "chromedriver.unstripped"
--} else {
-- chromedriver_output = "chromedriver"
--}
-+chromedriver_output = "chromedriver"
-
- executable("$chromedriver_output") {
- testonly = true
-@@ -336,16 +332,6 @@
- }
- }
-
--if (is_linux) {
-- strip_binary("chromedriver") {
-- testonly = true
-- binary_input = "$root_out_dir/$chromedriver_output"
-- symbol_output = "$root_out_dir/chromedriver.debug"
-- stripped_binary_output = "$root_out_dir/chromedriver"
-- deps = [ ":$chromedriver_output" ]
-- }
--}
--
- python_library("chromedriver_py_tests") {
- testonly = true
- deps = [
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch b/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
deleted file mode 100644
index 28c4ad35f14e..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-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;
-
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch b/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
deleted file mode 100644
index 0c03ad4a65eb..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-commit 981437bc846fcdb854062e89fd3d86f112e5f426
-Author: q66 <daniel@octaforge.org>
-Date: Sat Jun 25 12:35:37 2022 +0200
-
- Use generic target for now.
-
- This is because the source tree is missing vsx optimizations that
- then do not get included and result in failed linking such as:
-
- ld.lld: error: undefined symbol: vpx_mse16x16_vsx
-
-diff --git a/third_party/libvpx/generate_gni.sh b/third_party/libvpx/generate_gni.sh
-index 7429080..43ee29a 100755
---- a/third_party/libvpx/generate_gni.sh
-+++ b/third_party/libvpx/generate_gni.sh
-@@ -405,7 +405,7 @@
- gen_config_files linux/mips64el "--target=mips64-linux-gcc ${all_platforms}"
- gen_config_files linux/loongarch \
- "--target=loongarch64-linux-gcc ${all_platforms}"
--gen_config_files linux/ppc64 "--target=ppc64le-linux-gcc ${all_platforms}"
-+gen_config_files linux/ppc64 "--target=generic-gnu ${all_platforms}"
- gen_config_files linux/generic "--target=generic-gnu $HIGHBD ${all_platforms}"
- gen_config_files win/arm64 \
- "--target=arm64-win64-vs15 ${all_platforms} ${HIGHBD}"
-@@ -468,7 +468,7 @@
- gen_rtcd_header linux/mipsel mipsel
- gen_rtcd_header linux/mips64el mips64el
- gen_rtcd_header linux/loongarch loongarch
--gen_rtcd_header linux/ppc64 ppc
-+gen_rtcd_header linux/ppc64 generic
- gen_rtcd_header linux/generic generic
- gen_rtcd_header win/arm64 armv8
- gen_rtcd_header win/ia32 x86 "${require_sse2}"
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch b/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
deleted file mode 100644
index 4bfb5d494b06..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/sandbox/linux/system_headers/linux_stat.h
-+++ b/sandbox/linux/system_headers/linux_stat.h
-@@ -155,6 +155,28 @@ struct kernel_stat {
- unsigned int __unused4;
- unsigned int __unused5;
- };
-+#elif defined(__powerpc64__)
-+struct kernel_stat {
-+ unsigned long st_dev;
-+ unsigned long st_ino;
-+ unsigned long st_nlink;
-+ unsigned int st_mode;
-+ unsigned int st_uid;
-+ unsigned int st_gid;
-+ unsigned long st_rdev;
-+ long st_size;
-+ unsigned long st_blksize;
-+ unsigned long st_blocks;
-+ unsigned long st_atime_;
-+ unsigned long st_atime_nsec_;
-+ unsigned long st_mtime_;
-+ unsigned long st_mtime_nsec_;
-+ unsigned long st_ctime_;
-+ unsigned long st_ctime_nsec_;
-+ unsigned long __unused4;
-+ unsigned long __unused5;
-+ unsigned long __unused6;
-+};
- #endif
-
- // On 32-bit systems, we default to the 64-bit stat struct like libc
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 0bc505358916..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,3590 +0,0 @@
-commit 2c013a317b1114ef67cdbbc30824b28907b9ea94
-Author: Daniel Kolesa <daniel@octaforge.org>
-Date: Wed Mar 3 19:08:29 2021 +0100
-
- ppc64le support
-
-diff --git a/build/download_nacl_toolchains.py b/build/download_nacl_toolchains.py
-index 286a92a27..ec36a85d3 100755
---- a/build/download_nacl_toolchains.py
-+++ b/build/download_nacl_toolchains.py
-@@ -13,6 +13,10 @@ import sys
-
-
- def Main(args):
-+ # If `disable_nacl=1` is in GYP_DEFINES, exit
-+ if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''):
-+ return 0
-+
- script_dir = os.path.dirname(os.path.abspath(__file__))
- src_dir = os.path.dirname(script_dir)
- nacl_dir = os.path.join(src_dir, 'native_client')
---- a/chrome/installer/linux/BUILD.gn
-+++ b/chrome/installer/linux/BUILD.gn
-@@ -97,8 +97,6 @@
- "$root_out_dir/xdg-mime",
- "$root_out_dir/xdg-settings",
- "$root_out_dir/locales/en-US.pak",
-- "$root_out_dir/MEIPreload/manifest.json",
-- "$root_out_dir/MEIPreload/preloaded_data.pb",
- ]
-
- action_foreach("calculate_deb_dependencies") {
-@@ -377,7 +377,6 @@
- "//chrome",
- "//chrome:packed_resources",
- "//chrome/browser/enterprise/connectors/device_trust/key_management/installer/management_service:chrome_management_service",
-- "//chrome/browser/resources/media/mei_preload:component",
- "//components/crash/core/app:chrome_crashpad_handler",
- "//sandbox/linux:chrome_sandbox",
- ]
-diff --git a/sandbox/features.gni b/sandbox/features.gni
-index db30ae6d6..9dc09bf53 100644
---- a/sandbox/features.gni
-+++ b/sandbox/features.gni
-@@ -11,7 +11,8 @@ import("//build/config/nacl/config.gni")
- use_seccomp_bpf = (is_linux || is_chromeos || is_android) &&
- (current_cpu == "x86" || current_cpu == "x64" ||
- current_cpu == "arm" || current_cpu == "arm64" ||
-- current_cpu == "mipsel" || current_cpu == "mips64el")
-+ current_cpu == "mipsel" || current_cpu == "mips64el" ||
-+ current_cpu == "ppc64")
-
- use_seccomp_bpf = use_seccomp_bpf || is_nacl_nonsfi
-
-diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn
-index e9a94b461..cca1a5da5 100644
---- a/sandbox/linux/BUILD.gn
-+++ b/sandbox/linux/BUILD.gn
-@@ -427,6 +427,8 @@ component("sandbox_services") {
-
- source_set("sandbox_services_headers") {
- sources = [
-+ "system_headers/ppc64_linux_syscalls.h",
-+ "system_headers/ppc64_linux_ucontext.h",
- "system_headers/arm64_linux_syscalls.h",
- "system_headers/arm_linux_syscalls.h",
- "system_headers/arm_linux_ucontext.h",
-diff --git a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-index 313511f22..0ca3a326f 100644
---- a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-+++ b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-@@ -56,6 +56,13 @@
- #define MAX_PUBLIC_SYSCALL __NR_syscalls
- #define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-
-+#elif defined(__powerpc64__)
-+
-+#include <asm-generic/unistd.h>
-+#define MIN_SYSCALL 0u
-+#define MAX_PUBLIC_SYSCALL __NR_syscalls
-+#define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-+
- #else
- #error "Unsupported architecture"
- #endif
-diff --git a/sandbox/linux/bpf_dsl/seccomp_macros.h b/sandbox/linux/bpf_dsl/seccomp_macros.h
-index 1a407b952..a6aec544e 100644
---- a/sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ b/sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,6 +16,9 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
-+#elif defined(__powerpc64__)
-+// Manually define greg_t on ppc64
-+typedef unsigned long long greg_t;
- #endif
- #endif
-
-@@ -346,6 +349,51 @@ struct regs_struct {
- #define SECCOMP_PT_PARM4(_regs) (_regs).regs[3]
- #define SECCOMP_PT_PARM5(_regs) (_regs).regs[4]
- #define SECCOMP_PT_PARM6(_regs) (_regs).regs[5]
-+
-+#elif defined(__powerpc64__)
-+#include <asm/ptrace.h>
-+
-+typedef struct pt_regs regs_struct;
-+
-+#ifdef ARCH_CPU_LITTLE_ENDIAN
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64LE
-+#else
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64
-+#endif
-+
-+#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+
-+#define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
-+#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
-+#define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-+#define SECCOMP_PARM4(_ctx) SECCOMP_REG(_ctx, 6)
-+#define SECCOMP_PARM5(_ctx) SECCOMP_REG(_ctx, 7)
-+#define SECCOMP_PARM6(_ctx) SECCOMP_REG(_ctx, 8)
-+
-+#define SECCOMP_NR_IDX (offsetof(struct arch_seccomp_data, nr))
-+#define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch))
-+#define SECCOMP_IP_MSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 4)
-+#define SECCOMP_IP_LSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 0)
-+#define SECCOMP_ARG_MSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 4)
-+#define SECCOMP_ARG_LSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 0)
-+
-+#define SECCOMP_PT_RESULT(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_SYSCALL(_regs) (_regs).gpr[0]
-+#define SECCOMP_PT_IP(_regs) (_regs).nip
-+#define SECCOMP_PT_PARM1(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_PARM2(_regs) (_regs).gpr[4]
-+#define SECCOMP_PT_PARM3(_regs) (_regs).gpr[5]
-+#define SECCOMP_PT_PARM4(_regs) (_regs).gpr[6]
-+#define SECCOMP_PT_PARM5(_regs) (_regs).gpr[7]
-+#define SECCOMP_PT_PARM6(_regs) (_regs).gpr[8]
-+
- #else
- #error Unsupported target platform
-
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-index 6a1ec2389..f20c582dd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-@@ -88,7 +88,8 @@ bool IsBaselinePolicyWatched(int sysno) {
- SyscallSets::IsPrctl(sysno) ||
- SyscallSets::IsProcessGroupOrSession(sysno) ||
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- SyscallSets::IsSocketCall(sysno) ||
- #endif
- #if defined(__arm__)
-@@ -227,7 +228,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_mmap)
- return RestrictMmapFlags();
- #endif
-@@ -245,7 +246,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- return RestrictPrctl();
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_socketpair) {
- // Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen.
- static_assert(AF_UNIX == PF_UNIX,
-@@ -285,7 +286,8 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- if (SyscallSets::IsSocketCall(sysno))
- return RestrictSocketcallCommand();
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:11:10.481579470 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:12:43.524831376 -0400
-@@ -302,7 +302,7 @@
- TEST_BASELINE_SIGSYS(__NR_syslog)
- TEST_BASELINE_SIGSYS(__NR_timer_create)
-
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- TEST_BASELINE_SIGSYS(__NR_inotify_init)
- TEST_BASELINE_SIGSYS(__NR_vserver)
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-@@ -358,7 +358,16 @@
- if (args.nr == __NR_fstatat_default) {
- if (*reinterpret_cast<const char*>(args.args[1]) == '\0' &&
- args.args[3] == static_cast<uint64_t>(AT_EMPTY_PATH)) {
-- return syscall(__NR_fstat_default, static_cast<int>(args.args[0]),
-+ int fd = static_cast<int>(args.args[0]);
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO: Investigate the root cause and fix in glibc
-+ if (fd < 0)
-+ fd = -fd;
-+#endif
-+ return syscall(__NR_fstat_default, fd,
- reinterpret_cast<default_stat_struct*>(args.args[2]));
- }
- return -reinterpret_cast<intptr_t>(fs_denied_errno);
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
-index 2a97d3916..8e81aa6cf 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-14 14:41:08.000000000 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-15 13:17:57.808715733 -0400
-@@ -37,7 +37,8 @@
-
- #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
- !defined(__arm__) && !defined(__aarch64__) && \
-- !defined(PTRACE_GET_THREAD_AREA)
-+ !defined(PTRACE_GET_THREAD_AREA) && \
-+ !defined(__powerpc64__)
- // Also include asm/ptrace-abi.h since ptrace.h in older libc (for instance
- // the one in Ubuntu 16.04 LTS) is missing PTRACE_GET_THREAD_AREA.
- // asm/ptrace-abi.h doesn't exist on arm32 and PTRACE_GET_THREAD_AREA isn't
-@@ -45,6 +46,11 @@
- #include <asm/ptrace-abi.h>
- #endif
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- #if BUILDFLAG(IS_ANDROID)
-
- #if !defined(F_DUPFD_CLOEXEC)
-@@ -99,6 +105,14 @@
- return true;
- #else
- return false;
-+#endif
-+}
-+
-+inline bool IsArchitecturePPC64() {
-+#if defined(__powerpc64__)
-+ return true;
-+#else
-+ return false;
- #endif
- }
-
-@@ -239,6 +254,8 @@
- uint64_t kOLargeFileFlag = O_LARGEFILE;
- if (IsArchitectureX86_64() || IsArchitectureI386() || IsArchitectureMips())
- kOLargeFileFlag = 0100000;
-+ else if (IsArchitecturePPC64())
-+ kOLargeFileFlag = 0200000;
-
- const Arg<int> cmd(1);
- const Arg<long> long_arg(2);
-@@ -256,7 +273,16 @@
- F_SETLKW,
- F_GETLK,
- F_DUPFD,
-- F_DUPFD_CLOEXEC),
-+ F_DUPFD_CLOEXEC
-+#if defined(__powerpc64__)
-+// On PPC64, F_SETLK, F_GETLK, F_SETLKW are defined as the 64-bit variants
-+// but glibc will sometimes still use the 32-bit versions. Allow both.
-+ ,
-+ 5, /* F_GETLK (32) */
-+ 6, /* F_SETLK (32) */
-+ 7 /* F_SETLKW (32) */
-+#endif
-+ ),
- Allow())
- .Case(F_SETFL,
- If((long_arg & ~kAllowedMask) == 0, Allow()).Else(CrashSIGSYS()))
-@@ -266,7 +292,7 @@
- // clang-format on
- }
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- ResultExpr RestrictSocketcallCommand() {
- // Unfortunately, we are unable to restrict the first parameter to
- // socketpair(2). Whilst initially sounding bad, it's noteworthy that very
-@@ -419,7 +445,7 @@
- #endif
- return Switch(request)
- .CASES((
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- PTRACE_GETREGS, PTRACE_GETFPREGS, PTRACE_GET_THREAD_AREA,
- PTRACE_GETREGSET,
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-index ba4289f05..9a4d5ab2d 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-@@ -48,7 +48,7 @@ SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictMprotectFlags();
- // O_NONBLOCK | O_SYNC | O_LARGEFILE | O_CLOEXEC | O_NOATIME.
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictFcntlCommands();
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- // Restrict socketcall(2) to only allow socketpair(2), send(2), recv(2),
- // sendto(2), recvfrom(2), shutdown(2), sendmsg(2) and recvmsg(2).
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictSocketcallCommand();
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-index 642df7207..34f47eb73 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-@@ -29,7 +29,8 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- switch (sysno) {
- case __NR_gettimeofday:
- #if defined(__i386__) || defined(__x86_64__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_time:
- #endif
- return true;
-@@ -52,12 +53,14 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- case __NR_clock_nanosleep_time64: // Parameters filtered by RestrictClockID().
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ftime: // Obsolete.
- #endif
- case __NR_settimeofday: // Privileged.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stime:
- #endif
- default:
-@@ -135,7 +138,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_faccessat: // EPERM not a valid errno.
- case __NR_fchmodat:
- case __NR_fchownat: // Should be called chownat ?
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat: // fstatat(). EPERM not a valid errno.
- #elif defined(__i386__) || defined(__arm__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-@@ -154,7 +157,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_memfd_create:
- case __NR_mkdirat:
- case __NR_mknodat:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldlstat:
- case __NR_oldstat:
- #endif
-@@ -168,7 +171,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- #endif
- case __NR_statfs: // EPERM not a valid errno.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_statfs64:
- #endif
- case __NR_symlinkat:
-@@ -178,7 +182,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_truncate64:
- #endif
- case __NR_unlinkat:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_utime:
- #endif
- case __NR_utimensat: // New.
-@@ -203,7 +208,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- #endif
- return true;
- // TODO(jln): these should be denied gracefully as well (moved below).
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_fadvise64: // EPERM not a valid errno.
- #endif
- #if defined(__i386__)
-@@ -216,11 +222,12 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_flock: // EPERM not a valid errno.
- case __NR_fstatfs: // Give information about the whole filesystem.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_fstatfs64:
- #endif
- case __NR_fsync: // EPERM not a valid errno.
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldfstat:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-@@ -228,6 +235,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_sync_file_range: // EPERM not a valid errno.
- #elif defined(__arm__)
- case __NR_arm_sync_file_range: // EPERM not a valid errno.
-+#elif defined(__powerpc64__)
-+ case __NR_sync_file_range2: // EPERM not a valid errno.
- #endif
- default:
- return false;
-@@ -248,7 +257,8 @@ bool SyscallSets::IsDeniedFileSystemAccessViaFd(int sysno) {
- #endif
- case __NR_getdents64: // EPERM not a valid errno.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_readdir:
- #endif
- return true;
-@@ -289,7 +299,7 @@ bool SyscallSets::IsGetSimpleId(int sysno) {
- bool SyscallSets::IsProcessPrivilegeChange(int sysno) {
- switch (sysno) {
- case __NR_capset:
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_ioperm: // Intel privilege.
- case __NR_iopl: // Intel privilege.
- #endif
-@@ -340,8 +350,11 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- case __NR_rt_sigreturn:
- case __NR_rt_sigtimedwait:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
-+#ifndef __powerpc64__
- case __NR_rt_sigtimedwait_time64:
-+#endif
- case __NR_sigaction:
- case __NR_sigprocmask:
- case __NR_sigreturn:
-@@ -357,7 +370,8 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- #endif
- case __NR_signalfd4:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_sigpending:
- case __NR_sigsuspend:
- #endif
-@@ -381,7 +395,7 @@ bool SyscallSets::IsAllowedOperationOnFd(int sysno) {
- #endif
- case __NR_dup3:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_shutdown:
- #endif
- return true;
-@@ -414,7 +428,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- case __NR_exit_group:
- case __NR_wait4:
- case __NR_waitid:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_waitpid:
- #endif
- return true;
-@@ -431,7 +445,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- #endif
- case __NR_set_tid_address:
- case __NR_unshare:
--#if !defined(__mips__) && !defined(__aarch64__)
-+#if !defined(__mips__) && !defined(__aarch64__) || defined(__powerpc64__)
- case __NR_vfork:
- #endif
- default:
-@@ -484,7 +498,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- return true;
- default:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_socketpair: // We will want to inspect its argument.
- #endif
- return false;
-@@ -494,7 +508,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- switch (sysno) {
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_accept:
- case __NR_accept4:
- case __NR_bind:
-@@ -509,7 +523,8 @@ bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- bool SyscallSets::IsSocketCall(int sysno) {
- switch (sysno) {
-@@ -523,7 +538,8 @@ bool SyscallSets::IsSocketCall(int sysno) {
- }
- #endif
-
--#if defined(__x86_64__) || defined(__arm__) || defined(__mips__)
-+#if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- bool SyscallSets::IsNetworkSocketInformation(int sysno) {
- switch (sysno) {
- case __NR_getpeername:
-@@ -548,7 +564,7 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
- case __NR_mincore:
- case __NR_mlockall:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_mmap:
- #endif
- #if defined(__i386__) || defined(__arm__) || \
-@@ -578,7 +594,8 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- switch (sysno) {
- case __NR_lseek:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR__llseek:
- #endif
- #if !defined(__aarch64__)
-@@ -598,26 +615,28 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- case __NR_readv:
- case __NR_pread64:
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_recv:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_recvfrom: // Could specify source.
- case __NR_recvmsg: // Could specify source.
- #endif
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_select:
- #endif
--#if defined(__i386__) || defined(__arm__) || defined(__mips__)
-+#if defined(__i386__) || defined(__arm__) || defined(__mips__) || defined(__powerpc64__)
- case __NR__newselect:
- #endif
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_send:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_sendmsg: // Could specify destination.
- case __NR_sendto: // Could specify destination.
- #endif
-@@ -673,7 +692,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- return true;
- case __NR_getpriority:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_nice:
- #endif
- case __NR_setpriority:
-@@ -685,7 +705,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- bool SyscallSets::IsAdminOperation(int sysno) {
- switch (sysno) {
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_bdflush:
- #endif
- case __NR_kexec_load:
-@@ -701,7 +722,8 @@ bool SyscallSets::IsAdminOperation(int sysno) {
-
- bool SyscallSets::IsKernelModule(int sysno) {
- switch (sysno) {
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_create_module:
- case __NR_get_kernel_syms: // Should ENOSYS.
- case __NR_query_module:
-@@ -734,7 +756,8 @@ bool SyscallSets::IsFsControl(int sysno) {
- case __NR_swapoff:
- case __NR_swapon:
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_umount:
- #endif
- case __NR_umount2:
-@@ -750,7 +773,7 @@ bool SyscallSets::IsNuma(int sysno) {
- case __NR_getcpu:
- case __NR_mbind:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_migrate_pages:
- #endif
- case __NR_move_pages:
-@@ -785,14 +808,15 @@ bool SyscallSets::IsGlobalProcessEnvironment(int sysno) {
- switch (sysno) {
- case __NR_acct: // Privileged.
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
--#if defined(__i386__) || defined(__arm__)
-+#if defined(__i386__) || defined(__arm__) || defined(__powerpc64__)
- case __NR_ugetrlimit:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ulimit:
- #endif
- case __NR_getrusage:
-@@ -826,7 +850,7 @@ bool SyscallSets::IsGlobalSystemStatus(int sysno) {
- #endif
- case __NR_sysinfo:
- case __NR_uname:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_olduname:
- case __NR_oldolduname:
- #endif
-@@ -892,8 +916,16 @@ bool SyscallSets::IsSystemVSemaphores(int sysno) {
- }
- #endif
-
-+/* shitty hack around Void's 4.19 kernel headers missing those numbers */
-+#if defined(__powerpc64__) && !defined(__NR_shmget)
-+#define __NR_shmget 395
-+#define __NR_shmctl 396
-+#define __NR_shmat 397
-+#define __NR_shmdt 398
-+#endif
-+
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- bool SyscallSets::IsSystemVSharedMemory(int sysno) {
-@@ -925,7 +957,8 @@ bool SyscallSets::IsSystemVMessageQueue(int sysno) {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- bool SyscallSets::IsSystemVIpc(int sysno) {
- switch (sysno) {
-@@ -945,7 +978,8 @@ bool SyscallSets::IsAnySystemV(int sysno) {
- return IsSystemVMessageQueue(sysno) || IsSystemVSemaphores(sysno) ||
- IsSystemVSharedMemory(sysno);
- #elif defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- return IsSystemVIpc(sysno);
- #endif
- }
-@@ -1002,7 +1036,8 @@ bool SyscallSets::IsFaNotify(int sysno) {
- bool SyscallSets::IsTimer(int sysno) {
- switch (sysno) {
- case __NR_getitimer:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_alarm:
- #endif
- case __NR_setitimer:
-@@ -1084,18 +1119,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_syncfs:
- case __NR_vhangup:
- // The system calls below are not implemented.
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_afs_syscall:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_break:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_getpmsg:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_gtty:
- case __NR_idle:
- case __NR_lock:
-@@ -1103,20 +1142,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_prof:
- case __NR_profil:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_putpmsg:
- #endif
- #if defined(__x86_64__)
- case __NR_security:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stty:
- #endif
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- case __NR_tuxcall:
- #endif
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- case __NR_vserver:
- #endif
- return true;
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-index 923533ec9..411f72acd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-@@ -43,13 +43,14 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsDeniedGetOrModifySocket(int sysno);
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- static bool IsSocketCall(int sysno);
- #endif
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- static bool IsNetworkSocketInformation(int sysno);
- #endif
-
-@@ -76,7 +77,7 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsSystemVSemaphores(int sysno);
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- static bool IsSystemVSharedMemory(int sysno);
-@@ -88,7 +89,8 @@ class SANDBOX_EXPORT SyscallSets {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- static bool IsSystemVIpc(int sysno);
- #endif
-diff --git a/sandbox/linux/seccomp-bpf/syscall.cc b/sandbox/linux/seccomp-bpf/syscall.cc
-index e47e98bf5..d53a7ff56 100644
---- a/sandbox/linux/seccomp-bpf/syscall.cc
-+++ b/sandbox/linux/seccomp-bpf/syscall.cc
-@@ -18,7 +18,7 @@ namespace sandbox {
- namespace {
-
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined (ARCH_CPU_PPC64_FAMILY)
- // Number that's not currently used by any Linux kernel ABIs.
- const int kInvalidSyscallNumber = 0x351d3;
- #else
-@@ -310,12 +310,56 @@ asm(// We need to be able to tell the kernel exactly where we made a
- // Enter the kernel
- "svc 0\n"
- "2:ret\n"
-+ ".cfi_endproc\n"
-+ ".size SyscallAsm, .-SyscallAsm\n"
-+#elif defined(__powerpc64__)
-+ ".text\n"
-+ ".align 4\n"
-+ ".type SyscallAsm @function\n"
-+ "SyscallAsm:\n"
-+ ".cfi_startproc\n"
-+
-+ // Check if r3 is negative
-+ "cmpdi 3, 0\n"
-+ "bgt 2f\n"
-+
-+ // Load address of 3f into r3 and return
-+ "mflr 10\n"
-+ "bl 1f\n"
-+ "1: mflr 3\n"
-+ "mtlr 10\n"
-+ "addi 3, 3, 4*13\n"
-+ "blr\n"
-+
-+ // Load arguments from array into r3-8
-+ // save param 3 in r10
-+ "2:\n"
-+ "mr 0, 3\n"
-+ "ld 3, 0(4)\n"
-+ "ld 5, 16(4)\n"
-+ "ld 6, 24(4)\n"
-+ "ld 7, 32(4)\n"
-+ "ld 8, 40(4)\n"
-+ "ld 4, 8(4)\n"
-+ "li 9, 0\n"
-+
-+ // Enter kernel
-+ "sc\n"
-+
-+ // Magic return address
-+ "3:\n"
-+ // Like MIPS, ppc64 return values are always positive.
-+ // Check for error in cr0.SO and negate upon error
-+ "bc 4, 3, 4f\n"
-+ "neg 3, 3\n"
-+ "4: blr\n"
-+
- ".cfi_endproc\n"
- ".size SyscallAsm, .-SyscallAsm\n"
- #endif
- ); // asm
-
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- extern "C" {
- intptr_t SyscallAsm(intptr_t nr, const intptr_t args[6]);
- }
-@@ -429,6 +473,8 @@ intptr_t Syscall::Call(int nr,
- ret = inout;
- }
-
-+#elif defined(__powerpc64__)
-+ intptr_t ret = SyscallAsm(nr, args);
- #else
- #error "Unimplemented architecture"
- #endif
-@@ -445,8 +491,18 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // needs to be changed back.
- ret_val = -ret_val;
- SECCOMP_PARM4(ctx) = 1;
-- } else
-+ } else {
- SECCOMP_PARM4(ctx) = 0;
-+ }
-+#endif
-+#if defined(__powerpc64__)
-+ // Same as MIPS, need to invert ret and set error register (cr0.SO)
-+ if (ret_val <= -1 && ret_val >= -4095) {
-+ ret_val = -ret_val;
-+ ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ } else {
-+ ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
- }
-diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc
-index f5b86a73a..5e6c4a068 100644
---- a/sandbox/linux/seccomp-bpf/trap.cc
-+++ b/sandbox/linux/seccomp-bpf/trap.cc
-@@ -232,6 +232,20 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
- SetIsInSigHandler();
- }
-
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO(shawn@anastas.io): investigate this issue further
-+ auto nr = SECCOMP_SYSCALL(ctx);
-+ if (nr == __NR_openat || nr == __NR_mkdirat || nr == __NR_faccessat || nr == __NR_readlinkat ||
-+ nr == __NR_renameat || nr == __NR_renameat2 || nr == __NR_newfstatat || nr == __NR_unlinkat) {
-+ if (static_cast<int>(SECCOMP_PARM1(ctx)) > 0) {
-+ SECCOMP_PARM1(ctx) = -SECCOMP_PARM1(ctx);
-+ }
-+ }
-+#endif
-+
- // Copy the seccomp-specific data into a arch_seccomp_data structure. This
- // is what we are showing to TrapFnc callbacks that the system call
- // evaluator registered with the sandbox.
-diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc
-index d7b5d8c44..4adc6d0d4 100644
---- a/sandbox/linux/services/credentials.cc
-+++ b/sandbox/linux/services/credentials.cc
-@@ -81,7 +81,7 @@ bool ChrootToSafeEmptyDir() {
- pid_t pid = -1;
- alignas(16) char stack_buf[PTHREAD_STACK_MIN];
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // The stack grows downward.
- void* stack = stack_buf + sizeof(stack_buf);
- #else
-@@ -90,7 +90,9 @@
-
- int clone_flags = CLONE_FS | LINUX_SIGCHLD;
- void* tls = nullptr;
--#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
-+// RAJA this might be it...
-+#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY) || \
-+ defined(ARCH_CPU_PPC64_FAMILY)) && \
- !defined(MEMORY_SANITIZER)
- // Use CLONE_VM | CLONE_VFORK as an optimization to avoid copying page tables.
- // Since clone writes to the new child's TLS before returning, we must set a
-@@ -98,6 +100,11 @@
- // glibc performs syscalls by calling a function pointer in TLS, so we do not
- // attempt this optimization.
- // TODO(crbug.com/1247458) Broken in MSan builds after LLVM f1bb30a4956f.
-+ //
-+ // NOTE: Without CLONE_VM, fontconfig will attempt to reload configuration
-+ // in every thread. Since the rendered threads are sandboxed without
-+ // filesystem access (e.g. to /etc/fonts/fonts.conf) this will cause font
-+ // configuraiton loading failures and no fonts will be displayed!
- clone_flags |= CLONE_VM | CLONE_VFORK | CLONE_SETTLS;
-
- char tls_buf[PTHREAD_STACK_MIN] = {0};
-diff --git a/sandbox/linux/services/syscall_wrappers.cc b/sandbox/linux/services/syscall_wrappers.cc
-index fcfd2aa12..f6eb32fb7 100644
---- a/sandbox/linux/services/syscall_wrappers.cc
-+++ b/sandbox/linux/services/syscall_wrappers.cc
-@@ -58,7 +58,7 @@ long sys_clone(unsigned long flags,
- #if defined(ARCH_CPU_X86_64)
- return syscall(__NR_clone, flags, child_stack, ptid, ctid, tls);
- #elif defined(ARCH_CPU_X86) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // CONFIG_CLONE_BACKWARDS defined.
- return syscall(__NR_clone, flags, child_stack, ptid, tls, ctid);
- #endif
-diff --git a/sandbox/linux/syscall_broker/broker_process.cc b/sandbox/linux/syscall_broker/broker_process.cc
-index d72c9d238..77f1d95f5 100644
---- a/sandbox/linux/syscall_broker/broker_process.cc
-+++ b/sandbox/linux/syscall_broker/broker_process.cc
-@@ -169,7 +169,7 @@ bool BrokerProcess::IsSyscallBrokerable(int sysno, bool fast_check) const {
- #if defined(__NR_fstatat64)
- case __NR_fstatat64:
- #endif
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat:
- #endif
- return !fast_check || allowed_command_set_.test(COMMAND_STAT);
-diff --git a/sandbox/linux/system_headers/linux_seccomp.h b/sandbox/linux/system_headers/linux_seccomp.h
-index 1fa47ed09..39cc9ab53 100644
---- a/sandbox/linux/system_headers/linux_seccomp.h
-+++ b/sandbox/linux/system_headers/linux_seccomp.h
-@@ -41,6 +41,9 @@
- #ifndef EM_AARCH64
- #define EM_AARCH64 183
- #endif
-+#ifndef EM_PPC64
-+#define EM_PPC64 21
-+#endif
-
- #ifndef __AUDIT_ARCH_64BIT
- #define __AUDIT_ARCH_64BIT 0x80000000
-@@ -73,6 +76,12 @@
- #ifndef AUDIT_ARCH_AARCH64
- #define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
- #endif
-+#ifndef AUDIT_ARCH_PPC64
-+#define AUDIT_ARCH_PPC64 (EM_PPC64 | __AUDIT_ARCH_64BIT)
-+#endif
-+#ifndef AUDIT_ARCH_PPC64LE
-+#define AUDIT_ARCH_PPC64LE (EM_PPC64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
-+#endif
-
- // For prctl.h
- #ifndef PR_SET_SECCOMP
-diff --git a/sandbox/linux/system_headers/linux_signal.h b/sandbox/linux/system_headers/linux_signal.h
-index f5a736761..515b21a5f 100644
---- a/sandbox/linux/system_headers/linux_signal.h
-+++ b/sandbox/linux/system_headers/linux_signal.h
-@@ -13,7 +13,7 @@
- // (not undefined, but defined different values and in different memory
- // layouts). So, fill the gap here.
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
-
- #define LINUX_SIGHUP 1
- #define LINUX_SIGINT 2
-diff --git a/sandbox/linux/system_headers/linux_syscalls.h b/sandbox/linux/system_headers/linux_syscalls.h
-index 2b78a0cc3..0a70f5ea5 100644
---- a/sandbox/linux/system_headers/linux_syscalls.h
-+++ b/sandbox/linux/system_headers/linux_syscalls.h
-@@ -35,5 +35,9 @@
- #include "sandbox/linux/system_headers/arm64_linux_syscalls.h"
- #endif
-
-+#if defined(__powerpc64__)
-+#include "sandbox/linux/system_headers/ppc64_linux_syscalls.h"
-+#endif
-+
- #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SYSCALLS_H_
-
-diff --git a/sandbox/linux/system_headers/ppc64_linux_syscalls.h b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-new file mode 100644
-index 000000000..ccacffe22
---- /dev/null
-+++ b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-@@ -0,0 +1,12 @@
-+// Copyright 2014 The Chromium Authors. All rights reserved.
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+#define SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+
-+#include <asm/unistd.h>
-+
-+//TODO: is it necessary to redefine syscall numbers for PPC64?
-+
-+#endif // SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-diff --git a/sandbox/policy/linux/bpf_utility_policy_linux.cc b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_utility_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-@@ -34,7 +34,7 @@
- case __NR_fdatasync:
- case __NR_fsync:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
- #if defined(__i386__) || defined(__arm__)
-diff --git a/sandbox/policy/linux/bpf_renderer_policy_linux.cc b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-@@ -15,6 +15,11 @@
- #include "sandbox/linux/system_headers/linux_syscalls.h"
- #include "sandbox/policy/linux/sandbox_linux.h"
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- // TODO(vignatti): replace the local definitions below with #include
- // <linux/dma-buf.h> once kernel version 4.6 becomes widely used.
- #include <linux/types.h>
-@@ -77,7 +77,7 @@
- case __NR_ftruncate64:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- case __NR_setrlimit:
- // We allow setrlimit to dynamically adjust the address space limit as
-diff --git a/third_party/angle/src/compiler/translator/InfoSink.h b/third_party/angle/src/compiler/translator/InfoSink.h
-index 3a807e1e3..5258617a7 100644
---- a/third_party/angle/src/compiler/translator/InfoSink.h
-+++ b/third_party/angle/src/compiler/translator/InfoSink.h
-@@ -92,7 +92,16 @@ class TInfoSinkBase
- stream.precision(8);
- stream << f;
- }
-- sink.append(stream.str());
-+
-+ // Hack to work around a bug where negative floating point values
-+ // are rendered like '.0.5' instead of '-0.5'
-+ std::string res(stream.str());
-+
-+ if (signbit(f)) { // test if f is negative
-+ res[0] = '-';
-+ }
-+
-+ sink.append(res);
- return *this;
- }
- // Write boolean values as their names instead of integral value.
-diff --git a/third_party/angle/src/libANGLE/Constants.h b/third_party/angle/src/libANGLE/Constants.h
-index fcbc9246a..39ae66148 100644
---- a/third_party/angle/src/libANGLE/Constants.h
-+++ b/third_party/angle/src/libANGLE/Constants.h
-@@ -9,6 +9,7 @@
- #ifndef LIBANGLE_CONSTANTS_H_
- #define LIBANGLE_CONSTANTS_H_
-
-+#include <cstddef>
- #include "common/platform.h"
-
- #include <stdint.h>
-diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
-index 17cf9cda9..8ce96bd32 100644
---- a/third_party/boringssl/BUILD.gn
-+++ b/third_party/boringssl/BUILD.gn
-@@ -103,6 +103,13 @@ if (is_win && !is_msan && current_cpu != "arm64") {
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-+ } else if (current_cpu == "ppc64") {
-+ if (is_linux) {
-+ # TODO: ppc64 (be) check
-+ sources += crypto_sources_linux_ppc64le
-+ } else {
-+ public_configs = [ ":no_asm_config" ]
-+ }
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-diff --git a/third_party/breakpad/BUILD.gn b/third_party/breakpad/BUILD.gn
-index 4af3d7bbf..adbf54159 100644
---- a/third_party/breakpad/BUILD.gn
-+++ b/third_party/breakpad/BUILD.gn
-@@ -596,7 +596,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/minidump_file_writer.h",
- "breakpad/src/common/convert_UTF.cc",
- "breakpad/src/common/convert_UTF.h",
-- "breakpad/src/common/linux/breakpad_getcontext.S",
- "breakpad/src/common/linux/elf_core_dump.cc",
- "breakpad/src/common/linux/elf_core_dump.h",
- "breakpad/src/common/linux/elfutils.cc",
-@@ -634,6 +633,14 @@ if (is_linux || is_chromeos || is_android) {
-
- libs = [ "dl" ]
-
-+ if (current_cpu == "ppc64") {
-+ defines = [ "HAVE_GETCONTEXT" ]
-+ } else {
-+ sources += [
-+ "breakpad/src/common/linux/breakpad_getcontext.S"
-+ ]
-+ }
-+
- include_dirs = [
- ".",
- "breakpad/src",
-@@ -682,7 +689,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc",
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
- "breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
-- "breakpad/src/common/linux/breakpad_getcontext_unittest.cc",
- "breakpad/src/common/linux/elf_core_dump_unittest.cc",
- "breakpad/src/common/linux/file_id_unittest.cc",
- "breakpad/src/common/linux/linux_libc_support_unittest.cc",
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-index 07d9171a0..9aed4cb36 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-@@ -44,6 +44,8 @@ typedef MDRawContextARM RawContextCPU;
- typedef MDRawContextARM64_Old RawContextCPU;
- #elif defined(__mips__)
- typedef MDRawContextMIPS RawContextCPU;
-+#elif defined(__powerpc64__)
-+typedef MDRawContextPPC64 RawContextCPU;
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index aae1dc13b..03afec7a5 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -270,7 +270,42 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->float_save.fir = mcontext.fpc_eir;
- #endif
- }
--#endif // __mips__
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t ThreadInfo::GetInstructionPointer() const {
-+ return mcontext.gp_regs[PT_NIP];
-+}
-+
-+void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = mcontext.gp_regs[i];
-+
-+ out->lr = mcontext.gp_regs[PT_LNK];
-+ out->srr0 = mcontext.gp_regs[PT_NIP];
-+ out->srr1 = mcontext.gp_regs[PT_MSR];
-+ out->cr = mcontext.gp_regs[PT_CCR];
-+ out->xer = mcontext.gp_regs[PT_XER];
-+ out->ctr = mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] = \
-+ {(((uint64_t)vregs.vrregs[i][0]) << 32)
-+ | vregs.vrregs[i][1],
-+ (((uint64_t)vregs.vrregs[i][2]) << 32)
-+ | vregs.vrregs[i][3]};
-+
-+ out->vrsave = vregs.vrsave;
-+ out->vector_save.save_vscr = {0, vregs.vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+#endif // __powerpc64__
-
- void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- assert(gp_regs || size);
-@@ -279,6 +314,11 @@ void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- *gp_regs = mcontext.gregs;
- if (size)
- *size = sizeof(mcontext.gregs);
-+#elif defined(__powerpc64__)
-+ if (gp_regs)
-+ *gp_regs = mcontext.gp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.gp_regs);
- #else
- if (gp_regs)
- *gp_regs = ®s;
-@@ -294,6 +334,11 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- *fp_regs = &mcontext.fpregs;
- if (size)
- *size = sizeof(mcontext.fpregs);
-+#elif defined(__powerpc64__)
-+ if (fp_regs)
-+ *fp_regs = &mcontext.fp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.fp_regs);
- #else
- if (fp_regs)
- *fp_regs = &fpregs;
-@@ -302,4 +347,13 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- #endif
- }
-
-+#if defined(__powerpc64__)
-+void ThreadInfo::GetVectorRegisters(void** v_regs, size_t* size) {
-+ if (v_regs)
-+ *v_regs = &vregs;
-+ if (size)
-+ *size = sizeof(vregs);
-+}
-+#endif
-+
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-index fb216fa6d..593aac822 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-@@ -68,6 +68,10 @@ struct ThreadInfo {
- // Use the structures defined in <sys/user.h>
- struct user_regs_struct regs;
- struct user_fpsimd_struct fpregs;
-+#elif defined(__powerpc64__)
-+ // Use the structures defined in <sys/ucontext.h>.
-+ mcontext_t mcontext;
-+ vrregset_t vregs;
- #elif defined(__mips__)
- // Use the structure defined in <sys/ucontext.h>.
- mcontext_t mcontext;
-@@ -84,6 +88,11 @@ struct ThreadInfo {
-
- // Returns the pointer and size of float point register area.
- void GetFloatingPointRegisters(void** fp_regs, size_t* size);
-+
-+#if defined(__powerpc64__)
-+ // Returns the pointer and size of the vector register area. (PPC64 only)
-+ void GetVectorRegisters(void** v_regs, size_t* size);
-+#endif
- };
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 6eec1be24..741983a1a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -254,6 +254,48 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc) {
- out->float_save.fir = uc->uc_mcontext.fpc_eir; // Unused.
- #endif
- }
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
-+}
-+
-+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[PT_NIP];
-+}
-+
-+void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
-+ const vrregset_t* vregs) {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = uc->uc_mcontext.gp_regs[i];
-+
-+ out->lr = uc->uc_mcontext.gp_regs[PT_LNK];
-+ out->srr0 = uc->uc_mcontext.gp_regs[PT_NIP];
-+ out->srr1 = uc->uc_mcontext.gp_regs[PT_MSR];
-+ out->cr = uc->uc_mcontext.gp_regs[PT_CCR];
-+ out->xer = uc->uc_mcontext.gp_regs[PT_XER];
-+ out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] =
-+ {(((uint64_t)vregs->vrregs[i][0]) << 32)
-+ | vregs->vrregs[i][1],
-+ (((uint64_t)vregs->vrregs[i][2]) << 32)
-+ | vregs->vrregs[i][3]};
-+
-+ out->vrsave = vregs->vrsave;
-+ out->vector_save.save_vscr = {0, vregs->vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+
- #endif
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-index 7d4100881..c122ac92e 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-@@ -55,6 +55,9 @@ struct UContextReader {
- #elif defined(__aarch64__)
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- const struct fpsimd_context* fpregs);
-+#elif defined(__powerpc64__)
-+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
-+ const vrregset_t* vregs);
- #else
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc);
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index a6cb5f984..ae16b64d9 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -461,9 +461,16 @@ bool ExceptionHandler::HandleSignal(int /*sig*/, siginfo_t* info, void* uc) {
- memcpy(&g_crash_context_.float_state, fp_ptr,
- sizeof(g_crash_context_.float_state));
- }
-+#elif defined(__powerpc64__)
-+ // On PPC64, we must copy VR state
-+ ucontext_t* uc_ptr = (ucontext_t*)uc;
-+ if (uc_ptr->uc_mcontext.v_regs) {
-+ memcpy(&g_crash_context_.vector_state, uc_ptr->uc_mcontext.v_regs,
-+ sizeof(g_crash_context_.vector_state));
-+ }
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- // FP state is not part of user ABI on ARM Linux.
-- // In case of MIPS Linux FP state is already part of ucontext_t
-+ // In case of MIPS, Linux FP state is already part of ucontext_t
- // and 'float_state' is not a member of CrashContext.
- ucontext_t* uc_ptr = (ucontext_t*)uc;
- if (uc_ptr->uc_mcontext.fpregs) {
-@@ -708,11 +715,19 @@ bool ExceptionHandler::WriteMinidump() {
- }
- #endif
-
--#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__)
-+#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__) \
-+ && !defined(__powerpc64__)
- // FPU state is not part of ARM EABI ucontext_t.
- memcpy(&context.float_state, context.context.uc_mcontext.fpregs,
- sizeof(context.float_state));
- #endif
-+
-+#if defined(__powerpc64__)
-+ // Vector registers must be copied on PPC64
-+ memcpy(&context.vector_state, context.context.uc_mcontext.v_regs,
-+ sizeof(context.vector_state));
-+#endif
-+
- context.tid = sys_gettid();
-
- // Add an exception stream to the minidump for better reporting.
-@@ -733,6 +748,9 @@ bool ExceptionHandler::WriteMinidump() {
- #elif defined(__mips__)
- context.siginfo.si_addr =
- reinterpret_cast<void*>(context.context.uc_mcontext.pc);
-+#elif defined(__powerpc64__)
-+ context.siginfo.si_addr =
-+ reinterpret_cast<void*>(context.context.uc_mcontext.gp_regs[PT_NIP]);
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-index f80843ea7..260dd10f7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-@@ -192,7 +192,11 @@ class ExceptionHandler {
- siginfo_t siginfo;
- pid_t tid; // the crashing thread.
- ucontext_t context;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ // PPC64's FP state is a part of ucontext_t like MIPS but the vector
-+ // state is not, so a struct is needed.
-+ vstate_t vector_state;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- // #ifdef this out because FP state is not part of user ABI for Linux ARM.
- // In case of MIPS Linux FP state is already part of ucontext_t so
- // 'float_state' is not required.
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-index 35dcbfd4d..7934370fd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-@@ -307,7 +307,7 @@ TEST(ExceptionHandlerTest, ParallelChildCrashesDontHang) {
- }
-
- // Wait a while until the child should have crashed.
-- usleep(1000000);
-+ usleep(2000000);
- // Kill the child if it is still running.
- kill(child, SIGKILL);
-
-@@ -559,6 +559,8 @@ const unsigned char kIllegalInstruction[] = {
- #if defined(__mips__)
- // mfc2 zero,Impl - usually illegal in userspace.
- 0x48, 0x00, 0x00, 0x48
-+#elif defined(__powerpc64__)
-+ 0x01, 0x01, 0x01, 0x01 // Crashes on a tested POWER9 cpu
- #else
- // This crashes with SIGILL on x86/x86-64/arm.
- 0xff, 0xff, 0xff, 0xff
-@@ -754,10 +756,10 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
-
- // These are defined here so the parent can use them to check the
- // data from the minidump afterwards.
-- // Use 4k here because the OS will hand out a single page even
-+ // Use the page size here because the OS will hand out a single page even
- // if a smaller size is requested, and this test wants to
- // test the upper bound of the memory range.
-- const uint32_t kMemorySize = 4096; // bytes
-+ const uint32_t kMemorySize = getpagesize(); // bytes
- const int kOffset = kMemorySize - sizeof(kIllegalInstruction);
-
- const pid_t child = fork();
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-index fa3c1713a..6ce709e2f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-@@ -138,7 +138,9 @@ class MicrodumpWriter {
- const MicrodumpExtraInfo& microdump_extra_info,
- LinuxDumper* dumper)
- : ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -337,6 +339,8 @@ class MicrodumpWriter {
- # else
- # error "This mips ABI is currently not supported (n32)"
- #endif
-+#elif defined(__powerpc64__)
-+ const char kArch[] = "ppc64";
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -409,7 +413,9 @@ class MicrodumpWriter {
- void DumpCPUState() {
- RawContextCPU cpu;
- my_memset(&cpu, 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(&cpu, ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(&cpu, ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(&cpu, ucontext_);
-@@ -605,7 +611,9 @@ class MicrodumpWriter {
- void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); }
-
- const ucontext_t* const ucontext_;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_;
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-index 6339ac0cd..291af106b 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-@@ -279,10 +279,19 @@ TEST(MicrodumpWriterTest, BasicWithMappings) {
- CrashAndGetMicrodump(mappings, MicrodumpExtraInfo(), &buf);
- ASSERT_TRUE(ContainsMicrodump(buf));
-
-+ int page_size = getpagesize();
- #ifdef __LP64__
-- ASSERT_NE(std::string::npos,
-- buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-- "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ // This test is only available for the following page sizes
-+ ASSERT_TRUE((page_size == 4096) || (page_size == 65536));
-+ if (page_size == 4096) {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ } else {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000010000 000000000000002A 0000000000010000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ }
- #else
- ASSERT_NE(std::string::npos,
- buf.find("M 00001000 0000002A 00001000 "
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-index 415068983..b93e4afcf 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-@@ -112,6 +112,9 @@ bool LinuxCoreDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-@@ -197,7 +200,10 @@ bool LinuxCoreDumper::EnumerateThreads() {
- memset(&info, 0, sizeof(ThreadInfo));
- info.tgid = status->pr_pgrp;
- info.ppid = status->pr_ppid;
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ for (int i = 0; i < 31; i++)
-+ info.mcontext.gp_regs[i] = status->pr_reg[i];
-+#elif defined(__mips__)
- #if defined(__ANDROID__)
- for (int i = EF_R0; i <= EF_R31; i++)
- info.mcontext.gregs[i - EF_R0] = status->pr_reg[i];
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-index 7fd6532ad..199cbfffd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-@@ -765,7 +765,9 @@ bool LinuxDumper::GetStackInfo(const void** stack, size_t* stack_len,
- reinterpret_cast<uint8_t*>(int_stack_pointer & ~(page_size - 1));
-
- // The number of bytes of stack which we try to capture.
-- static const ptrdiff_t kStackToCapture = 32 * 1024;
-+ // This now depends on page_size to avoid missing data
-+ // on systems with larger page sizes.
-+ static const ptrdiff_t kStackToCapture = 8 * page_size;
-
- const MappingInfo* mapping = FindMapping(stack_pointer);
- if (!mapping)
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-index 7bee160f1..07bb2b81a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-@@ -63,7 +63,8 @@ namespace google_breakpad {
- (defined(__mips__) && _MIPS_SIM == _ABIO32)
- typedef Elf32_auxv_t elf_aux_entry;
- #elif defined(__x86_64) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM != _ABIO32)
-+ (defined(__mips__) && _MIPS_SIM != _ABIO32) || \
-+ defined(__powerpc64__)
- typedef Elf64_auxv_t elf_aux_entry;
- #endif
-
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-index 331f4bb34..3f722947f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-@@ -51,6 +51,8 @@
- #define TID_PTR_REGISTER "rcx"
- #elif defined(__mips__)
- #define TID_PTR_REGISTER "$1"
-+#elif defined(__powerpc64__)
-+#define TID_PTR_REGISTER "r8"
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-index e3ddb81a6..fa28575ef 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-@@ -149,19 +149,27 @@ bool LinuxPtraceDumper::CopyFromProcess(void* dest, pid_t child,
- return true;
- }
-
--bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid)
--{
-+bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid) {
- #ifdef PTRACE_GETREGSET
- struct iovec io;
- info->GetGeneralPurposeRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
- return false;
- }
-
- info->GetFloatingPointRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
- return false;
- }
-+
-+#if defined(__powerpc64__)
-+ // Grab the vector registers on PPC64 too
-+ info->GetVectorRegisters(&io.iov_base, &io.iov_len);
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PPC_VMX, (void*)&io) == -1) {
-+ return false;
-+ }
-+#endif // defined(__powerpc64__)
-+
- return true;
- #else
- return false;
-@@ -298,6 +306,9 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-index da71e15dc..12bfb317a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-@@ -462,6 +462,9 @@ TEST(LinuxPtraceDumperTest, VerifyStackReadWithMultipleThreads) {
- #elif defined(__mips__)
- pid_t* process_tid_location =
- reinterpret_cast<pid_t*>(one_thread.mcontext.gregs[1]);
-+#elif defined(__powerpc64__)
-+ pid_t* process_tid_location =
-+ reinterpret_cast<pid_t*>(one_thread.mcontext.gp_regs[8]);
- #else
- #error This test has not been ported to this platform.
- #endif
-@@ -559,6 +562,8 @@ TEST_F(LinuxPtraceDumperTest, SanitizeStackCopy) {
- uintptr_t heap_addr = thread_info.regs.rcx;
- #elif defined(__mips__)
- uintptr_t heap_addr = thread_info.mcontext.gregs[1];
-+#elif defined(__powerpc64__)
-+ uintptr_t heap_addr = thread_info.mcontext.gp_regs[8];
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-index 32634ef00..2a56948de 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-@@ -136,7 +136,9 @@ class MinidumpWriter {
- : fd_(minidump_fd),
- path_(minidump_path),
- ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -468,7 +470,9 @@ class MinidumpWriter {
- if (!cpu.Allocate())
- return false;
- my_memset(cpu.get(), 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(cpu.get(), ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(cpu.get(), ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(cpu.get(), ucontext_);
-@@ -897,7 +901,7 @@ class MinidumpWriter {
- dirent->location.rva = 0;
- }
-
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || defined(__powerpc64__)
- bool WriteCPUInformation(MDRawSystemInfo* sys_info) {
- char vendor_id[sizeof(sys_info->cpu.x86_cpu_info.vendor_id) + 1] = {0};
- static const char vendor_id_name[] = "vendor_id";
-@@ -917,7 +921,9 @@ class MinidumpWriter {
-
- // processor_architecture should always be set, do this first
- sys_info->processor_architecture =
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ MD_CPU_ARCHITECTURE_PPC64;
-+#elif defined(__mips__)
- # if _MIPS_SIM == _ABIO32
- MD_CPU_ARCHITECTURE_MIPS;
- # elif _MIPS_SIM == _ABI64
-@@ -1333,7 +1339,9 @@ class MinidumpWriter {
- const char* path_; // Path to the file where the minidum should be written.
-
- const ucontext_t* const ucontext_; // also from the signal handler
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_; // ditto
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-index e3b0b16da..ccd8aa0a4 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-@@ -48,6 +48,8 @@ class ExceptionHandler;
-
- #if defined(__aarch64__)
- typedef struct fpsimd_context fpstate_t;
-+#elif defined(__powerpc64__)
-+typedef vrregset_t vstate_t;
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- typedef std::remove_pointer<fpregset_t>::type fpstate_t;
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-index d192e5cbb..fc1bfa8d7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-@@ -715,6 +715,9 @@ TEST(MinidumpWriterTest, InvalidStackPointer) {
- #elif defined(__mips__)
- context.context.uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP] =
- invalid_stack_pointer;
-+#elif defined(__powerpc64__)
-+ context.context.uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP] =
-+ invalid_stack_pointer;
- #else
- # error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-index 99362945c..c54ba7145 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-@@ -65,8 +65,7 @@ bool MemoryMappedFile::Map(const char* path, size_t offset) {
- }
-
- #if defined(__x86_64__) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM == _ABI64)
--
-+ (defined(__mips__) && _MIPS_SIM == _ABI64) || defined(__powerpc64__)
- struct kernel_stat st;
- if (sys_fstat(fd, &st) == -1 || st.st_size < 0) {
- #else
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-index fad59f40c..616496d67 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-@@ -176,9 +176,10 @@ TEST_F(MemoryMappedFileTest, RemapAfterMap) {
- TEST_F(MemoryMappedFileTest, MapWithOffset) {
- // Put more data in the test file this time. Offsets can only be
- // done on page boundaries, so we need a two page file to test this.
-- const int page_size = 4096;
-- char data1[2 * page_size];
-- size_t data1_size = sizeof(data1);
-+ const int page_size = getpagesize();
-+ char *data1 = static_cast<char*>(malloc(2 * page_size));
-+ EXPECT_TRUE(data1 != NULL);
-+ size_t data1_size = (2 * page_size);
- for (size_t i = 0; i < data1_size; ++i) {
- data1[i] = i & 0x7f;
- }
-diff --git a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-index 5803b90d5..2a1cf14f0 100644
---- a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-@@ -57,8 +57,9 @@ TEST(PageAllocatorTest, LargeObject) {
-
- EXPECT_EQ(0U, allocator.pages_allocated());
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(10000));
-+ uint64_t expected_pages = 1 + ((10000 - 1) / getpagesize());
- ASSERT_FALSE(p == NULL);
-- EXPECT_EQ(3U, allocator.pages_allocated());
-+ EXPECT_EQ(expected_pages, allocator.pages_allocated());
- for (unsigned i = 1; i < 10; ++i) {
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(i));
- ASSERT_FALSE(p == NULL);
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-index 798056dfa..22bd81fff 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-@@ -202,12 +202,14 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) {
- // Check architecture and set architecture variable to corresponding flag
- // in objdump.
- switch (context->GetContextCPU()) {
-+#if defined(__i386) || defined(__x86_64)
- case MD_CONTEXT_X86:
- architecture = "i386";
- break;
- case MD_CONTEXT_AMD64:
- architecture = "i386:x86-64";
- break;
-+#endif
- default:
- // Unsupported architecture. Note that ARM architectures are not
- // supported because objdump does not support ARM.
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-index 528ee5f21..72764d6c1 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-@@ -104,6 +104,8 @@ ExploitabilityFor(const string& filename) {
- }
-
- TEST(ExploitabilityTest, TestWindowsEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("ascii_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -136,9 +138,12 @@ TEST(ExploitabilityTest, TestWindowsEngine) {
- ExploitabilityFor("read_av_clobber_write.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_LOW,
- ExploitabilityFor("read_av_conditional.dmp"));
-+#endif
- }
-
- TEST(ExploitabilityTest, TestLinuxEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if defined(__i386) || defined(__x86_64)
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_null_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -171,7 +176,8 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_executable_heap.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_jmp_to_module_not_exe_region.dmp"));
--#ifndef _WIN32
-+#endif
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_write_to_nonwritable_module.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -182,10 +188,10 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_write_to_outside_module_via_math.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_write_to_under_4k.dmp"));
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (!defined(__i386) && !defined(__x86_64))
- }
-
--#ifndef _WIN32
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- TEST(ExploitabilityLinuxUtilsTest, DisassembleBytesTest) {
- ASSERT_FALSE(ExploitabilityLinuxTest::DisassembleBytes("", NULL, 5, NULL));
- uint8_t bytes[6] = {0xc7, 0x0, 0x5, 0x0, 0x0, 0x0};
-@@ -301,6 +307,7 @@ TEST(ExploitabilityLinuxUtilsTest, CalculateAddressTest) {
- context,
- &write_address));
- }
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
-+
-
- } // namespace
-diff --git a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-index aade82c99..195aa73f3 100644
---- a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-+++ b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-@@ -77,6 +77,8 @@
- #define ELF_ARCH EM_MIPS
- #elif defined(__aarch64__)
- #define ELF_ARCH EM_AARCH64
-+#elif defined(__powerpc64__)
-+ #define ELF_ARCH EM_PPC64
- #endif
-
- #if defined(__arm__)
-@@ -87,6 +89,8 @@ typedef user_regs user_regs_struct;
- #elif defined (__mips__)
- // This file-local typedef simplifies the source code.
- typedef gregset_t user_regs_struct;
-+#elif defined(__powerpc64__)
-+typedef struct pt_regs user_regs_struct;
- #endif
-
- using google_breakpad::MDTypeHelper;
-@@ -321,6 +325,9 @@ struct CrashedProcess {
- #endif
- #if defined(__aarch64__)
- user_fpsimd_struct fpregs;
-+#endif
-+#if defined(__powerpc64__)
-+ mcontext_t mcontext;
- #endif
- uintptr_t stack_addr;
- const uint8_t* stack;
-@@ -535,6 +542,38 @@ ParseThreadRegisters(CrashedProcess::Thread* thread,
- thread->mcontext.fpc_eir = rawregs->float_save.fir;
- #endif
- }
-+#elif defined(__powerpc64__)
-+static void
-+ParseThreadRegisters(CrashedProcess::Thread* thread,
-+ const MinidumpMemoryRange& range) {
-+ const MDRawContextPPC64* rawregs = range.GetData<MDRawContextPPC64>(0);
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ thread->mcontext.gp_regs[i] = rawregs->gpr[i];
-+
-+ thread->mcontext.gp_regs[PT_LNK] = rawregs->lr;
-+ thread->mcontext.gp_regs[PT_NIP] = rawregs->srr0;
-+ thread->mcontext.gp_regs[PT_MSR] = rawregs->srr1;
-+ thread->mcontext.gp_regs[PT_CCR] = rawregs->cr;
-+ thread->mcontext.gp_regs[PT_XER] = rawregs->xer;
-+ thread->mcontext.gp_regs[PT_CTR] = rawregs->ctr;
-+ thread->mcontext.v_regs->vrsave = rawregs->vrsave;
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ thread->mcontext.fp_regs[i] = rawregs->float_save.fpregs[i];
-+
-+ thread->mcontext.fp_regs[NFPREG-1] = rawregs->float_save.fpscr;
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++) {
-+ thread->mcontext.v_regs->vrregs[i][0] = rawregs->vector_save.save_vr[i].high >> 32;
-+ thread->mcontext.v_regs->vrregs[i][1] = rawregs->vector_save.save_vr[i].high;
-+ thread->mcontext.v_regs->vrregs[i][2] = rawregs->vector_save.save_vr[i].low >> 32;
-+ thread->mcontext.v_regs->vrregs[i][3] = rawregs->vector_save.save_vr[i].low;
-+ }
-+
-+ thread->mcontext.v_regs->vscr.vscr_word = rawregs->vector_save.save_vscr.low & 0xFFFFFFFF;
-+}
-+
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -623,6 +662,12 @@ ParseSystemInfo(const Options& options, CrashedProcess* crashinfo,
- # else
- # error "This mips ABI is currently not supported (n32)"
- # endif
-+#elif defined(__powerpc64__)
-+ if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_PPC64) {
-+ fprintf(stderr,
-+ "This version of minidump-2-core only supports PPC64.\n");
-+ exit(1);
-+ }
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-diff --git a/third_party/crashpad/crashpad/CONTRIBUTORS b/third_party/crashpad/crashpad/CONTRIBUTORS
-index 8724b7f32..8e29424ef 100644
---- a/third_party/crashpad/crashpad/CONTRIBUTORS
-+++ b/third_party/crashpad/crashpad/CONTRIBUTORS
-@@ -13,3 +13,4 @@ Mark Mentovai <mark@chromium.org>
- Robert Sesek <rsesek@chromium.org>
- Scott Graham <scottmg@chromium.org>
- Joshua Peraza <jperaza@chromium.org>
-+Shawn Anastasio <shawn@anastas.io>
-diff --git a/third_party/crashpad/crashpad/compat/linux/sys/user.h b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-index 6ed77a98e..1fd83469a 100644
---- a/third_party/crashpad/crashpad/compat/linux/sys/user.h
-+++ b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_COMPAT_LINUX_SYS_USER_H_
- #define CRASHPAD_COMPAT_LINUX_SYS_USER_H_
-
-+#include <cstddef>
- #include_next <sys/user.h>
-
- #include <features.h>
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context.h b/third_party/crashpad/crashpad/minidump/minidump_context.h
-index 3a3e603cb..3118d9e9f 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context.h
-@@ -592,6 +592,70 @@ struct MinidumpContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief ppc64-specific flags for MinidumpPPC64::context_flags
-+//! Based on minidump_cpu_ppc64.h from breakpad
-+enum MinidumpContextPPC64Flags : uint32_t {
-+ //! \brief Identifies the context as PPC64.
-+ kMinidumpContextPPC64 = 0x01000000,
-+
-+ //! \brief Indicates the validity of general purpose registers.
-+ //!
-+ //! Registers `r0`-`r31`, `nip`, `msr`, `lr`, etc. are valid.
-+ kMinidumpContextPPC64Base = kMinidumpContextPPC64 | 0x00000001,
-+
-+ //! \brief Indicates the validity of floating point registers.
-+ //!
-+ //! Registers `fp0`-`fp31`, `fpscr` are valid.
-+ kMinidumpContextPPC64Floating = kMinidumpContextPPC64 | 0x00000008,
-+
-+ //! \brief Indicates the validity of Altivec/VMX registers.
-+ //!
-+ //! Registers `v0`-`v31`, `vscr`, `vrsave`.
-+ kMinidumpContextPPC64Vector = kMinidumpContextPPC64 | 0x00000020,
-+
-+ //! \brief Indicates the validity of all registers
-+ kMinidumpContextPPC64All = kMinidumpContextPPC64Base |
-+ kMinidumpContextPPC64Floating |
-+ kMinidumpContextPPC64Vector
-+};
-+
-+//! \brief A PPC64 CPU context carried in a minidump file.
-+//! Based on minidump_cpu_ppc64.h from breakpad.
-+struct MinidumpContextPPC64 {
-+ uint64_t context_flags;
-+
-+ //! \brief General purpose registers.
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+
-+ //! \brief Floating point registers.
-+ double fpregs[32];
-+
-+ //! \brief FPU status register.
-+ double fpscr;
-+
-+ //! \brief Altivec/VMX vector registers.
-+ struct {
-+ //! \brief Vector registers are 128bits.
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad5[4];
-+
-+ //! \brief VRSAVE register.
-+ uint32_t save_vrsave;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad6[7];
-+ } vregs;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-index d7e53a493..d89eb9e01 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-@@ -101,6 +101,13 @@ MinidumpContextWriter::CreateFromSnapshot(const CPUContext* context_snapshot) {
- break;
- }
-
-+ case kCPUArchitecturePPC64: {
-+ context = std::make_unique<MinidumpContextPPC64Writer>();
-+ reinterpret_cast<MinidumpContextPPC64Writer*>(context.get())
-+ ->InitalizeFromSnapshot(context_snapshot->ppc64);
-+ break;
-+ }
-+
- default: {
- LOG(ERROR) << "unknown context architecture "
- << context_snapshot->architecture;
-@@ -453,4 +460,47 @@ size_t MinidumpContextMIPS64Writer::ContextSize() const {
- return sizeof(context_);
- }
-
-+MinidumpContextPPC64Writer::MinidumpContextPPC64Writer()
-+ : MinidumpContextWriter(), context_() {
-+ context_.context_flags = kMinidumpContextPPC64;
-+}
-+
-+MinidumpContextPPC64Writer::~MinidumpContextPPC64Writer() = default;
-+
-+void MinidumpContextPPC64Writer::InitalizeFromSnapshot(
-+ const CPUContextPPC64* context_snapshot) {
-+ DCHECK_EQ(state(), kStateMutable);
-+ DCHECK_EQ(context_.context_flags, kMinidumpContextPPC64);
-+
-+ context_.context_flags = kMinidumpContextPPC64All;
-+
-+ memcpy(context_.regs, context_snapshot->regs, sizeof(context_.regs));
-+ context_.nip = context_snapshot->nip;
-+ context_.msr = context_snapshot->msr;
-+ context_.ccr = context_snapshot->ccr;
-+ context_.xer = context_snapshot->xer;
-+ context_.lnk = context_snapshot->lnk;
-+ context_.ctr = context_snapshot->ctr;
-+
-+ memcpy(context_.fpregs, context_snapshot->fpregs, sizeof(context_.fpregs));
-+ context_.fpscr = context_snapshot->fpscr;
-+
-+ memcpy(context_.vregs.save_vr, context_snapshot->vregs.save_vr,
-+ sizeof(context_.vregs.save_vr));
-+ memcpy(&context_.vregs.save_vscr, &context_snapshot->vregs.save_vscr,
-+ sizeof(context_.vregs.save_vscr));
-+ context_.vregs.save_vrsave = context_snapshot->vregs.save_vrsave;
-+}
-+
-+bool MinidumpContextPPC64Writer::WriteObject(
-+ FileWriterInterface* file_writer) {
-+ DCHECK_EQ(state(), kStateWritable);
-+ return file_writer->Write(&context_, sizeof(context_));
-+}
-+
-+size_t MinidumpContextPPC64Writer::ContextSize() const {
-+ DCHECK_GE(state(), kStateFrozen);
-+ return sizeof(context_);
-+}
-+
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-index d4ab936ee..1d22fc59c 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-@@ -315,6 +315,43 @@ class MinidumpContextMIPS64Writer final : public MinidumpContextWriter {
- MinidumpContextMIPS64 context_;
- };
-
-+class MinidumpContextPPC64Writer final : public MinidumpContextWriter {
-+ public:
-+ MinidumpContextPPC64Writer();
-+ ~MinidumpContextPPC64Writer() override;
-+
-+ //! \brief Initalizes the MinidumpContextPPC64 based on \a context_snapshot.
-+ //!
-+ //! \param[in] context_snapshot The context snapshot to use as source data.
-+ //!
-+ //! \note Valid in #kStateMutable. No mutation of context() may be done before
-+ //! calling this method, and it is not normally necessary to alter
-+ //! context() after calling this method.
-+ void InitalizeFromSnapshot(const CPUContextPPC64* context_snapshot);
-+
-+ //! \brief Returns a pointer to the context structure that this object will
-+ //! write.
-+ //!
-+ //! \attention This returns a non-`const` pointer to this object’s private
-+ //! data so that a caller can populate the context structure directly.
-+ //! This is done because providing setter interfaces to each field in the
-+ //! context structure would be unwieldy and cumbersome. Care must be taken
-+ //! to populate the context structure correctly. The context structure
-+ //! must only be modified while this object is in the #kStateMutable
-+ //! state.
-+ MinidumpContextPPC64* context() { return &context_; }
-+
-+ protected:
-+ // MinidumpWritable:
-+ bool WriteObject(FileWriterInterface* file_writer) override;
-+
-+ // MinidumpContextWriter:
-+ size_t ContextSize() const override;
-+
-+ private:
-+ MinidumpContextPPC64 context_;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_WRITER_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-index 3216a906b..a9fcbe9d8 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-@@ -213,6 +213,21 @@ TEST(MinidumpContextWriter, MIPS64_FromSnapshot) {
- context, ExpectMinidumpContextMIPS64, kSeed);
- }
-
-+TEST(MinidumpContextWriter, PPC64_Zeros) {
-+ EmptyContextTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ ExpectMinidumpContextPPC64);
-+}
-+
-+TEST(MinidumpContextWriter, PPC64_FromSnapshot) {
-+ constexpr uint32_t kSeed = 64;
-+ CPUContextPPC64 context_ppc64;
-+ CPUContext context;
-+ context.ppc64 = &context_ppc64;
-+ InitializeCPUContextPPC64(&context, kSeed);
-+ FromSnapshotTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ context, ExpectMinidumpContextPPC64, kSeed);
-+}
-+
- } // namespace
- } // namespace test
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-index 0974e3ddf..b71ec5880 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-@@ -135,6 +135,8 @@ std::string MinidumpMiscInfoDebugBuildString() {
- static constexpr char kCPU[] = "mips";
- #elif defined(ARCH_CPU_MIPS64EL)
- static constexpr char kCPU[] = "mips64";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kCPU[] = "ppc64";
- #else
- #error define kCPU for this CPU
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/capture_memory.cc b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-index 7a1b2763c..beda8da9e 100644
---- a/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-+++ b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-@@ -112,6 +112,11 @@ void CaptureMemory::PointedToByContext(const CPUContext& context,
- for (size_t i = 0; i < std::size(context.mipsel->regs); ++i) {
- MaybeCaptureMemoryAround(delegate, context.mipsel->regs[i]);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->nip);
-+ for (size_t i = 0; i < std::size(context.ppc64->regs); ++i) {
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->regs[i]);
-+ }
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-index 811a72095..f4f83981d 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-@@ -43,7 +43,10 @@ enum CPUArchitecture {
- kCPUArchitectureMIPSEL,
-
- //! \brief 64-bit MIPSEL.
-- kCPUArchitectureMIPS64EL
-+ kCPUArchitectureMIPS64EL,
-+
-+ //! \brief 64-bit PPC64.
-+ kCPUArchitecturePPC64
- };
-
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.cc b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-index c75b5555e..aeade577a 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-@@ -169,6 +169,8 @@ uint64_t CPUContext::InstructionPointer() const {
- return arm->pc;
- case kCPUArchitectureARM64:
- return arm64->pc;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->nip;
- default:
- NOTREACHED();
- return ~0ull;
-@@ -185,6 +187,8 @@ uint64_t CPUContext::StackPointer() const {
- return arm->sp;
- case kCPUArchitectureARM64:
- return arm64->sp;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->regs[1];
- default:
- NOTREACHED();
- return ~0ull;
-@@ -196,6 +200,7 @@ bool CPUContext::Is64Bit() const {
- case kCPUArchitectureX86_64:
- case kCPUArchitectureARM64:
- case kCPUArchitectureMIPS64EL:
-+ case kCPUArchitecturePPC64:
- return true;
- case kCPUArchitectureX86:
- case kCPUArchitectureARM:
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.h b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-index fb23c4679..eebede63c 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-@@ -352,6 +352,24 @@ struct CPUContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief A context structure carrying PPC64 CPU state.
-+struct CPUContextPPC64 {
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+ double fpregs[32];
-+ double fpscr;
-+ struct {
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+ uint32_t save_vrsave;
-+ } vregs;
-+};
-+
- //! \brief A context structure capable of carrying the context of any supported
- //! CPU architecture.
- struct CPUContext {
-@@ -382,6 +400,7 @@ struct CPUContext {
- CPUContextARM64* arm64;
- CPUContextMIPS* mipsel;
- CPUContextMIPS64* mips64;
-+ CPUContextPPC64* ppc64;
- };
- };
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-index 9f46a4897..aa677c4eb 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
- #define CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
-
-+#include <cstring>
- #include "build/build_config.h"
- #include "snapshot/cpu_context.h"
- #include "snapshot/linux/signal_context.h"
-@@ -174,6 +175,78 @@ void InitializeCPUContextMIPS(
-
- #endif // ARCH_CPU_MIPS_FAMILY || DOXYGEN
-
-+#if defined(ARCH_CPU_PPC64_FAMILY) || DOXYGEN
-+
-+//! \brief Initalizes a CPUContextPPC64 structure from native context
-+//! structures on Linux.
-+//!
-+//! \param[in] thread_context The native thread context.
-+//! \param[in] float_context The native float context.
-+//! \param[in] vector_context The native vector context.
-+//! \param[out] context The CPUContextPPC64 structure to initalize.
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const ThreadContext::t64_t& thread_context,
-+ const FloatContext::f64_t& float_context,
-+ const VectorContext::v64_t& vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.gpr, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.fpregs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const SignalThreadContext64 &thread_context,
-+ const SignalFloatContext64 &float_context,
-+ const SignalVectorContext64 &vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.regs, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.regs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+
-+#endif
-+
- } // namespace internal
- } // namespace crashpad
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-index d32bd1937..2dd538c2b 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-@@ -192,6 +192,8 @@ void TestAgainstTarget(PtraceConnection* connection) {
- device == 0 && inode == 0 && mapping_name == "[vdso]";
- #if defined(ARCH_CPU_X86)
- static constexpr char kPrefix[] = "linux-gate.so.";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kPrefix[] = "linux-vdso64.so.";
- #else
- static constexpr char kPrefix[] = "linux-vdso.so.";
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-index cd40b3b12..6bcf23b6f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-@@ -323,6 +323,69 @@ bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
- reader, context_address, context_.mips64);
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+template <typename Traits>
-+static bool ReadContext(ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address,
-+ typename Traits::CPUContext* dest_context) {
-+ const ProcessMemory* memory = reader->Memory();
-+
-+ LinuxVMAddress gp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, gp_regs);
-+
-+ typename Traits::SignalThreadContext thread_context;
-+ if (!memory->Read(gp_regs_address, sizeof(thread_context), &thread_context)) {
-+ LOG(ERROR) << "Couldn't read gp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress fp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, fp_regs);
-+
-+ typename Traits::SignalFloatContext fp_context;
-+ if (!memory->Read(fp_regs_address, sizeof(fp_context), &fp_context)) {
-+ LOG(ERROR) << "Couldn't read fp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress v_regs_ptr_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, vmx_reserve) + 8;
-+
-+ typename Traits::SignalVectorContext v_context;
-+ if (!memory->Read(v_regs_ptr_address, sizeof(v_context), &v_context)) {
-+ LOG(ERROR) << "Couldn't read v_regs!";
-+ return false;
-+ }
-+
-+ InitializeCPUContextPPC64<ContextTraits64>(thread_context, fp_context,
-+ v_context, dest_context);
-+
-+ return true;
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+
-+ return internal::ReadContext<ContextTraits64>(
-+ reader, context_address, context_.ppc64);
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits32>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ // PPC64 is 64-bit
-+ return false;
-+}
-+
- #endif // ARCH_CPU_X86_FAMILY
-
- bool ExceptionSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-index ea0cd2106..e42df520f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-@@ -84,6 +84,8 @@ class ExceptionSnapshotLinux final : public ExceptionSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #endif
- } context_union_;
- CPUContext context_;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-index c17170b43..b6a714cc6 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-@@ -296,7 +296,28 @@ void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
- 0);
- #undef CPU_ARCH_NAME
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+using NativeCPUContext = ucontext_t;
-+
-+void InitializeContext(NativeCPUContext* context) {
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ context->uc_mcontext.gp_regs[reg] = reg;
-+ }
-+
-+ memset(&context->uc_mcontext.fp_regs, 44,
-+ sizeof(context->uc_mcontext.fp_regs));
-+}
-
-+void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
-+ EXPECT_EQ(actual.architecture, kCPUArchitecturePPC64);
-+
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ EXPECT_EQ(actual.ppc64->regs[reg], expected.uc_mcontext.gp_regs[reg]);
-+ }
-+
-+ EXPECT_EQ(memcmp(actual.ppc64->fpregs, expected.uc_mcontext.fp_regs,
-+ sizeof(actual.ppc64->fpregs)), 0);
-+}
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-index ee246e8bc..9555dce04 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-@@ -108,6 +108,8 @@ void ProcessReaderLinux::Thread::InitializeStack(ProcessReaderLinux* reader) {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- stack_pointer = reader->Is64Bit() ? thread_info.thread_context.t64.regs[29]
- : thread_info.thread_context.t32.regs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ stack_pointer = thread_info.thread_context.t64.gpr[1];
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 110024680..a1f2da259 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -422,6 +422,89 @@ static_assert(offsetof(UContext<ContextTraits64>, mcontext.fpregs) ==
- "context offset mismatch");
- #endif
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+struct SignalThreadContext64 {
-+ uint64_t regs[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_r3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
-+ uint64_t dscr;
-+ uint64_t fpr0[3];
-+};
-+
-+struct SignalFloatContext64 {
-+ double regs[32];
-+ double fpscr;
-+};
-+
-+struct SignalVectorContext64 {
-+ int32_t vrregs[32][4];
-+ struct {
-+ int32_t __pad[3];
-+ int32_t vscr_word;
-+ } vscr;
-+ int32_t vrsave;
-+ int32_t __pad[3];
-+} __attribute__((__aligned__(16)));
-+
-+
-+#pragma pack(pop)
-+struct MContext64 {
-+ uint64_t reserved[4];
-+ int32_t signal;
-+ int32_t __pad0;
-+ uint64_t handler;
-+ uint64_t oldmask;
-+ uint64_t pt_regs_ptr;
-+ SignalThreadContext64 gp_regs;
-+ SignalFloatContext64 fp_regs;
-+ SignalVectorContext64 *v_regs;
-+ int64_t vmx_reserve[69];
-+};
-+
-+struct ContextTraits64 : public Traits64 {
-+ using MContext = MContext64;
-+ using SignalThreadContext = SignalThreadContext64;
-+ using SignalFloatContext = SignalFloatContext64;
-+ using SignalVectorContext = SignalVectorContext64;
-+ using CPUContext = CPUContextPPC64;
-+};
-+
-+struct ContextTraits32 : public Traits32 {};
-+
-+struct UContext {
-+ uint64_t flags;
-+ uint64_t link;
-+ SignalStack<ContextTraits64> stack;
-+ Sigset<ContextTraits64> sigmask;
-+ MContext64 mcontext;
-+};
-+#pragma pack(push, 1)
-+
-+static_assert(sizeof(UContext) == sizeof(ucontext_t),
-+ "ucontext_t size mismatch");
-+static_assert(sizeof(MContext64) == sizeof(mcontext_t),
-+ "mcontext_t size mismatch");
-+static_assert(sizeof(SignalThreadContext64) == sizeof(gregset_t),
-+ "gregset_t size mismatch");
-+static_assert(sizeof(SignalFloatContext64) == sizeof(fpregset_t),
-+ "fpregset_t size mismatch");
-+static_assert(sizeof(SignalVectorContext64) == sizeof(vrregset_t),
-+ "vrregset_t size mismatch");
-+static_assert(offsetof(UContext, mcontext) ==
-+ offsetof(ucontext_t, uc_mcontext), "mcontext offset mismatch");
-+static_assert(offsetof(MContext64, gp_regs) ==
-+ offsetof(mcontext_t, gp_regs), "gp_regs offset mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-index a99da3e4b..03b973083 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-@@ -204,6 +204,8 @@ CPUArchitecture SystemSnapshotLinux::GetCPUArchitecture() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return process_reader_->Is64Bit() ? kCPUArchitectureMIPS64EL
- : kCPUArchitectureMIPSEL;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return kCPUArchitecturePPC64;
- #else
- #error port to your architecture
- #endif
-@@ -219,6 +221,9 @@ uint32_t SystemSnapshotLinux::CPURevision() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return 0;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return 0;
- #else
- #error port to your architecture
- #endif
-@@ -239,6 +244,9 @@ std::string SystemSnapshotLinux::CPUVendor() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return std::string();
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return std::string();
- #else
- #error port to your architecture
- #endif
-@@ -372,6 +380,9 @@ bool SystemSnapshotLinux::NXEnabled() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return false;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return false;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-index b2450c206..7ba78b2ae 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-@@ -110,6 +110,8 @@ bool WriteTestModule(const base::FilePath& module_path,
- module.ehdr.e_machine = EM_AARCH64;
- #elif defined(ARCH_CPU_MIPSEL) || defined(ARCH_CPU_MIPS64EL)
- module.ehdr.e_machine = EM_MIPS;
-+#elif defined(ARCH_CPU_PPC64)
-+ module.ehdr.e_machine = EM_PPC64;
- #endif
-
- module.ehdr.e_version = EV_CURRENT;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-index e3e2bebdd..8ef43752e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-@@ -186,6 +186,14 @@ bool ThreadSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
- thread.thread_info.float_context.f32,
- context_.mipsel);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+ InitializeCPUContextPPC64<ContextTraits64>(
-+ thread.thread_info.thread_context.t64,
-+ thread.thread_info.float_context.f64,
-+ thread.thread_info.vector_context.v64,
-+ context_.ppc64);
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-index 44cc6f6d9..d4136461e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-@@ -68,6 +68,8 @@ class ThreadSnapshotLinux final : public ThreadSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
---- a/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-+++ b/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-@@ -236,6 +236,12 @@
- #elif defined(ARCH_CPU_BIG_ENDIAN)
- static constexpr char arch[] = "aarch64_be";
- #endif
-+#elif defined(__powerpc64__)
-+#if defined(ARCH_CPU_LITTLE_ENDIAN)
-+ static constexpr char arch[] = "ppc64le";
-+#elif defined(ARCH_CPU_BIG_ENDIAN)
-+ static constexpr char arch[] = "ppc64";
-+#endif
- #else
- #error Port
- #endif
-diff --git a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-index d3d5ebdfb..3fd730cb5 100644
---- a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-+++ b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-@@ -56,6 +56,11 @@ bool AuxiliaryVector::Read(PtraceConnection* connection) {
- if (type == AT_IGNORE) {
- continue;
- }
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ if (type == AT_IGNOREPPC) {
-+ continue;
-+ }
-+#endif
- if (!MapInsertOrReplace(&values_, type, value, nullptr)) {
- LOG(ERROR) << "duplicate auxv entry";
- return false;
-diff --git a/third_party/crashpad/crashpad/util/linux/ptracer.cc b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-index 557e0d363..08ae434b8 100644
---- a/third_party/crashpad/crashpad/util/linux/ptracer.cc
-+++ b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-@@ -398,6 +398,64 @@ bool GetThreadArea64(pid_t tid,
- return true;
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+// PPC64 has had HAVE_ARCH_TRACEHOOK set since 2.6.27 (even before x86 had it).
-+// That means we can simply use PTRACE_GETREGESET.
-+
-+template <typename Destination>
-+bool GetRegisterSet(pid_t tid, int set, Destination* dest, bool can_log) {
-+ iovec iov;
-+ iov.iov_base = reinterpret_cast<void*>(dest);
-+ iov.iov_len = sizeof(*dest);
-+ if (ptrace(PTRACE_GETREGSET, tid, reinterpret_cast<void*>(set), &iov) != 0) {
-+ PLOG_IF(ERROR, can_log) << "ptrace";
-+ return false;
-+ }
-+ if (iov.iov_len != sizeof(*dest)) {
-+ LOG_IF(ERROR, can_log) << "Unexpected registers size";
-+ return false;
-+ }
-+ return true;
-+}
-+
-+bool GetVectorRegisters64(pid_t tid,
-+ VectorContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PPC_VMX, &context->v64, can_log);
-+}
-+
-+bool GetFloatingPointRegisters64(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PRFPREG, &context->f64, can_log);
-+}
-+
-+bool GetThreadArea64(pid_t tid,
-+ const ThreadContext& context,
-+ LinuxVMAddress* address,
-+ bool can_log) {
-+ // PPC64 doesn't have PTRACE_GET_THREAD_AREA since the thread pointer
-+ // is stored in GPR 13.
-+ ThreadContext::t64_t tc;
-+ if (!GetRegisterSet(tid, NT_PRSTATUS, &tc, can_log)) {
-+ LOG_IF(ERROR, can_log) << "Unable to get thread pointer!";
-+ return false;
-+ }
-+
-+ *address = tc.gpr[13];
-+
-+ return true;
-+}
-+
-+// Stubs for 32-bit functions not applicable on PPC64
-+bool GetFloatingPointRegisters32(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) { return false; }
-+bool GetThreadArea32(pid_t tid,
-+ const ThreadContext &context,
-+ LinuxVMAddress *address,
-+ bool can_log) { return false; }
-+
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -494,6 +552,9 @@ bool Ptracer::GetThreadInfo(pid_t tid, ThreadInfo* info) {
- if (is_64_bit_) {
- return GetGeneralPurposeRegisters64(tid, &info->thread_context, can_log_) &&
- GetFloatingPointRegisters64(tid, &info->float_context, can_log_) &&
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ GetVectorRegisters64(tid, &info->vector_context, can_log_) &&
-+#endif
- GetThreadArea64(tid,
- info->thread_context,
- &info->thread_specific_data_address,
-diff --git a/third_party/crashpad/crashpad/util/linux/thread_info.h b/third_party/crashpad/crashpad/util/linux/thread_info.h
-index 5b55c24a7..dea0d1f39 100644
---- a/third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ b/third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -28,6 +28,10 @@
- #include <android/api-level.h>
- #endif
-
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+#include <sys/ucontext.h>
-+#endif
-+
- namespace crashpad {
-
- //! \brief The set of general purpose registers for an architecture family.
-@@ -79,6 +83,8 @@ union ThreadContext {
- uint32_t cp0_status;
- uint32_t cp0_cause;
- uint32_t padding1_;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // PPC64 is 64-bit
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -132,6 +138,21 @@ union ThreadContext {
- uint64_t cp0_badvaddr;
- uint64_t cp0_status;
- uint64_t cp0_cause;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects struct pt_regs in asm/ptrace.h.
-+ uint64_t gpr[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_gpr3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -143,6 +164,8 @@ union ThreadContext {
- using NativeThreadContext = user_regs;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate NativeThreadsContext type available for MIPS
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ using NativeThreadContext = struct pt_regs;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY || ARCH_CPU_ARM64
-@@ -218,6 +241,9 @@ union FloatContext {
- } fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Crashpad's PPC support is 64-bit only, so this
-+ // 32bit-only struct is declared as empty.
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -252,6 +278,10 @@ union FloatContext {
- double fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects fpregset_t in sys/ucontext.h
-+ double fpregs[32];
-+ double fpscr;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -280,6 +310,8 @@ union FloatContext {
- static_assert(sizeof(f64) == sizeof(user_fpsimd_struct), "Size mismatch");
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate floating point context native type for available MIPS.
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ static_assert(sizeof(f64) == sizeof(fpregset_t), "Size mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86
-@@ -287,6 +319,26 @@ union FloatContext {
- static_assert(std::is_standard_layout<FloatContext>::value,
- "Not standard layout");
-
-+//! \brief The vector registers used for an architecture family
-+union VectorContext {
-+ struct v32_t {} v32;
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ __attribute__((__aligned__(16))) // Vector context must be doubleword aligned.
-+#endif
-+ struct v64_t {
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects vrregset_t in sys/ucontext.h
-+ uint32_t vrregs[32][4];
-+ struct {
-+ uint32_t __pad[3];
-+ uint32_t vscr_word;
-+ } vscr;
-+ uint32_t vrsave;
-+ uint32_t __pad[3];
-+#endif
-+ } v64;
-+};
-+
- //! \brief A collection of `ptrace`-able information about a thread.
- struct ThreadInfo {
- ThreadInfo();
-@@ -298,6 +350,9 @@ struct ThreadInfo {
- //! \brief The floating point registers for the thread.
- FloatContext float_context;
-
-+ //! \brief (Optional) The vector registers used for the thread.
-+ VectorContext vector_context;
-+
- //! \brief The thread-local storage address for the thread.
- LinuxVMAddress thread_specific_data_address;
- };
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context.h b/third_party/crashpad/crashpad/util/misc/capture_context.h
-index d21a24f19..acc325349 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context.h
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context.h
-@@ -69,6 +69,7 @@ using NativeCPUContext = ucontext_t;
- //! macOS/Linux/Fuchsia | x86_64 | `%%rdi`
- //! Linux | ARM/ARM64 | `r0`/`x0`
- //! Linux | MIPS/MIPS64 | `$a0`
-+//! Linux | PPC64 | `r3`
- //!
- //! Additionally, the value `LR` on ARM/ARM64 will be the return address of
- //! this function.
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-index 52215ee5d..b3e4a3ec7 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-@@ -32,7 +32,7 @@
- .balign 4, 0x0
- .type CAPTURECONTEXT_SYMBOL, %function
- .type CAPTURECONTEXT_SYMBOL2, %function
--#elif defined(__mips__)
-+#elif defined(__mips__) || defined(__powerpc64__)
- .balign 4, 0x0
- #endif
-
-@@ -423,4 +423,214 @@ CAPTURECONTEXT_SYMBOL2:
- jr $ra
-
- .set at
-+#elif defined(__powerpc64__)
-+ // Store r0-r31
-+ std 0, 0xe8(3) // context->uc_mcontext.gp_regs[0]
-+ std 1, 0xf0(3) // context->uc_mcontext.gp_regs[1]
-+ std 2, 0xf8(3) // context->uc_mcontext.gp_regs[2]
-+ // note that r3's original value was lost
-+ std 3, 0x100(3) // context->uc_mcontext.gp_regs[3]
-+ std 4, 0x108(3) // context->uc_mcontext.gp_regs[4]
-+ std 5, 0x110(3) // context->uc_mcontext.gp_regs[5]
-+ std 6, 0x118(3) // context->uc_mcontext.gp_regs[6]
-+ std 7, 0x120(3) // context->uc_mcontext.gp_regs[7]
-+ std 8, 0x128(3) // context->uc_mcontext.gp_regs[8]
-+ std 9, 0x130(3) // context->uc_mcontext.gp_regs[9]
-+ std 10, 0x138(3) // context->uc_mcontext.gp_regs[10]
-+ std 11, 0x140(3) // context->uc_mcontext.gp_regs[11]
-+ std 12, 0x148(3) // context->uc_mcontext.gp_regs[12]
-+ std 13, 0x150(3) // context->uc_mcontext.gp_regs[13]
-+ std 14, 0x158(3) // context->uc_mcontext.gp_regs[14]
-+ std 15, 0x160(3) // context->uc_mcontext.gp_regs[15]
-+ std 16, 0x168(3) // context->uc_mcontext.gp_regs[16]
-+ std 17, 0x170(3) // context->uc_mcontext.gp_regs[17]
-+ std 18, 0x178(3) // context->uc_mcontext.gp_regs[18]
-+ std 19, 0x180(3) // context->uc_mcontext.gp_regs[19]
-+ std 20, 0x188(3) // context->uc_mcontext.gp_regs[20]
-+ std 21, 0x190(3) // context->uc_mcontext.gp_regs[21]
-+ std 22, 0x198(3) // context->uc_mcontext.gp_regs[22]
-+ std 23, 0x1a0(3) // context->uc_mcontext.gp_regs[23]
-+ std 24, 0x1a8(3) // context->uc_mcontext.gp_regs[24]
-+ std 25, 0x1b0(3) // context->uc_mcontext.gp_regs[25]
-+ std 26, 0x1b8(3) // context->uc_mcontext.gp_regs[26]
-+ std 27, 0x1c0(3) // context->uc_mcontext.gp_regs[27]
-+ std 28, 0x1c8(3) // context->uc_mcontext.gp_regs[28]
-+ std 29, 0x1d0(3) // context->uc_mcontext.gp_regs[29]
-+ std 30, 0x1d8(3) // context->uc_mcontext.gp_regs[30]
-+ std 31, 0x1e0(3) // context->uc_mcontext.gp_regs[31]
-+
-+ // For NIP, we can use the value in the link register
-+ mflr 0
-+ std 0, 0x1e8(3) // context->uc_mcontext.gp_regs[PT_NIP]
-+
-+ // CTR
-+ mfctr 0
-+ std 0, 0x200(3) // context->uc_mcontext.gp_regs[PT_CTR]
-+
-+ // For LNK, we'll use the caller's LR save area (2 stack frames up).
-+ // r4 can be used as a scratch register since it has already been saved.
-+ ld 4, 0(1)
-+ ld 4, 16(4)
-+ std 4, 0x208(3) // context->uc_mcontext.gp_regs[PT_LNK]
-+
-+ // XER
-+ mfxer 0
-+ std 0, 0x210(3) // context->uc_mcontext.gp_regs[PT_XER]
-+
-+ // CCR
-+ mfcr 0
-+ std 0, 0x218(3) // context->uc_mcontext.gp_regs[PT_CCR]
-+
-+ // MSR, orig_r3, MQ, TRAP, DAR, DSISR, RESULT, DSCR,
-+ // not used or not relevant, zero them out.
-+ li 4, 0
-+ std 4, 0x1f0(3) // context->uc_mcontext.gp_regs[PT_MSR]
-+ std 4, 0x1f8(3) // context->uc_mcontext.gp_regs[PT_ORIG_R3]
-+ std 4, 0x220(3) // context->uc_mcontext.gp_regs[PT_MQ]
-+ std 4, 0x228(3) // context->uc_mcontext.gp_regs[PT_TRAP]
-+ std 4, 0x230(3) // context->uc_mcontext.gp_regs[PT_DAR]
-+ std 4, 0x238(3) // context->uc_mcontext.gp_regs[PT_DSISR]
-+ std 4, 0x240(3) // context->uc_mcontext.gp_regs[PT_RESULT]
-+ std 4, 0x248(3) // context->uc_mcontext.gp_regs[PT_DSCR]
-+
-+ // Update context->uc_mcontext.regs to point to gp_regs
-+ addi 0, 3, 0xe8
-+ std 0, 0xe0(3)
-+
-+ // Save floating point registers 0-31
-+ stfd 0, 0x268(3) // context->uc_mcontext.fp_regs[0]
-+ stfd 1, 0x270(3) // context->uc_mcontext.fp_regs[1]
-+ stfd 2, 0x278(3) // context->uc_mcontext.fp_regs[2]
-+ stfd 3, 0x280(3) // context->uc_mcontext.fp_regs[3]
-+ stfd 4, 0x288(3) // context->uc_mcontext.fp_regs[4]
-+ stfd 5, 0x290(3) // context->uc_mcontext.fp_regs[5]
-+ stfd 6, 0x298(3) // context->uc_mcontext.fp_regs[6]
-+ stfd 7, 0x2a0(3) // context->uc_mcontext.fp_regs[7]
-+ stfd 8, 0x2a8(3) // context->uc_mcontext.fp_regs[8]
-+ stfd 9, 0x2b0(3) // context->uc_mcontext.fp_regs[9]
-+ stfd 10, 0x2b8(3) // context->uc_mcontext.fp_regs[10]
-+ stfd 11, 0x2c0(3) // context->uc_mcontext.fp_regs[11]
-+ stfd 12, 0x2c8(3) // context->uc_mcontext.fp_regs[12]
-+ stfd 13, 0x2d0(3) // context->uc_mcontext.fp_regs[13]
-+ stfd 14, 0x2d8(3) // context->uc_mcontext.fp_regs[14]
-+ stfd 15, 0x2e0(3) // context->uc_mcontext.fp_regs[15]
-+ stfd 16, 0x2e8(3) // context->uc_mcontext.fp_regs[16]
-+ stfd 17, 0x2f0(3) // context->uc_mcontext.fp_regs[17]
-+ stfd 18, 0x2f8(3) // context->uc_mcontext.fp_regs[18]
-+ stfd 19, 0x300(3) // context->uc_mcontext.fp_regs[19]
-+ stfd 20, 0x308(3) // context->uc_mcontext.fp_regs[20]
-+ stfd 21, 0x310(3) // context->uc_mcontext.fp_regs[21]
-+ stfd 22, 0x318(3) // context->uc_mcontext.fp_regs[22]
-+ stfd 23, 0x320(3) // context->uc_mcontext.fp_regs[23]
-+ stfd 24, 0x328(3) // context->uc_mcontext.fp_regs[24]
-+ stfd 25, 0x330(3) // context->uc_mcontext.fp_regs[25]
-+ stfd 26, 0x338(3) // context->uc_mcontext.fp_regs[26]
-+ stfd 27, 0x340(3) // context->uc_mcontext.fp_regs[27]
-+ stfd 28, 0x348(3) // context->uc_mcontext.fp_regs[28]
-+ stfd 29, 0x350(3) // context->uc_mcontext.fp_regs[29]
-+ stfd 30, 0x358(3) // context->uc_mcontext.fp_regs[30]
-+ stfd 31, 0x360(3) // context->uc_mcontext.fp_regs[31]
-+
-+ // FPSCR
-+ mffs 0
-+ stfd 0, 0x368(3) // context->uc_mcontext.fp_regs[32]
-+
-+ // Save VMX Vector registers
-+ // Update r4 to contain the base address of vmx_reserve
-+ addi 4, 3, 0x378
-+ // Ensure that it is quadword aligned
-+ andi. 5, 4, 0xF
-+ beq 1f // No alignment is necessary
-+ // Address is doubleword aligned and not quadword aligned, add 8
-+ addi 4, 4, 8
-+
-+1:
-+ // Store VMX registers 0-31
-+ // r4 will contain the base address
-+ // r5 will contain the index
-+ li 5, 0
-+ stvx 0, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 0]
-+ addi 5, 5, 16
-+ stvx 1, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 1]
-+ addi 5, 5, 16
-+ stvx 2, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 2]
-+ addi 5, 5, 16
-+ stvx 3, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 3]
-+ addi 5, 5, 16
-+ stvx 4, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 4]
-+ addi 5, 5, 16
-+ stvx 5, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 5]
-+ addi 5, 5, 16
-+ stvx 6, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 6]
-+ addi 5, 5, 16
-+ stvx 7, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 7]
-+ addi 5, 5, 16
-+ stvx 8, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 8]
-+ addi 5, 5, 16
-+ stvx 9, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 9]
-+ addi 5, 5, 16
-+ stvx 10, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 10]
-+ addi 5, 5, 16
-+ stvx 11, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 11]
-+ addi 5, 5, 16
-+ stvx 12, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 12]
-+ addi 5, 5, 16
-+ stvx 13, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 13]
-+ addi 5, 5, 16
-+ stvx 14, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 14]
-+ addi 5, 5, 16
-+ stvx 15, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 15]
-+ addi 5, 5, 16
-+ stvx 16, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 16]
-+ addi 5, 5, 16
-+ stvx 17, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 17]
-+ addi 5, 5, 16
-+ stvx 18, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 18]
-+ addi 5, 5, 16
-+ stvx 19, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 19]
-+ addi 5, 5, 16
-+ stvx 20, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 20]
-+ addi 5, 5, 16
-+ stvx 21, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 21]
-+ addi 5, 5, 16
-+ stvx 22, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 22]
-+ addi 5, 5, 16
-+ stvx 23, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 23]
-+ addi 5, 5, 16
-+ stvx 24, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 24]
-+ addi 5, 5, 16
-+ stvx 25, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 25]
-+ addi 5, 5, 16
-+ stvx 26, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 26]
-+ addi 5, 5, 16
-+ stvx 27, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 27]
-+ addi 5, 5, 16
-+ stvx 28, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 28]
-+ addi 5, 5, 16
-+ stvx 29, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 29]
-+ addi 5, 5, 16
-+ stvx 30, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 30]
-+ addi 5, 5, 16
-+ stvx 31, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 31]
-+ addi 5, 5, 16
-+
-+ // VSCR
-+ mfvscr 0
-+ stvx 0, 4, 5
-+ addi 5, 5, 16
-+
-+ // VRSAVE
-+ mfvrsave 0
-+ stwx 0, 4, 5
-+
-+ // Update context->uc_mcontext.v_regs to point to vmx_reserve + alignment.
-+ std 4, 0x370(3)
-+
-+ // Zero out all unused fields
-+ li 4, 0
-+ std 4, 0xc8(3) // context->uc_mcontext.signal
-+ std 4, 0xd0(3) // context->uc_mcontext.handler
-+ std 4, 0xd8(3) // context->uc_mcontext.oldmask
-+
-+ blr
- #endif // __i386__
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-index cf23c2def..5f264bc92 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-@@ -57,7 +57,7 @@ void TestCaptureContext() {
- uintptr_t pc = ProgramCounterFromContext(context_1);
-
- #if !defined(ADDRESS_SANITIZER) && !defined(ARCH_CPU_MIPS_FAMILY) && \
-- !defined(MEMORY_SANITIZER)
-+ !defined(MEMORY_SANITIZER) && !defined(ARCH_CPU_PPC64_FAMILY)
- // Sanitizers can cause enough code bloat that the “nearby” check would
- // likely fail.
- const uintptr_t kReferencePC =
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-index 30a2ab21d..60509f21d 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-@@ -35,6 +35,8 @@ void SanityCheckContext(const NativeCPUContext& context) {
- EXPECT_EQ(context.uc_mcontext.regs[0], FromPointerCast<uintptr_t>(&context));
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- EXPECT_EQ(context.uc_mcontext.gregs[4], FromPointerCast<uintptr_t>(&context));
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ EXPECT_EQ(context.uc_mcontext.gp_regs[3], FromPointerCast<uintptr_t>(&context));
- #endif
- }
-
-@@ -49,6 +51,8 @@ uintptr_t ProgramCounterFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.pc;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.pc;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[PT_NIP];
- #endif
- }
-
-@@ -63,6 +67,8 @@ uintptr_t StackPointerFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.sp;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.gregs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[1];
- #endif
- }
-
-diff --git a/third_party/dav1d/config/linux/ppc64/config.h b/third_party/dav1d/config/linux/ppc64/config.h
-new file mode 100644
-index 000000000..9fbbf75cc
---- /dev/null
-+++ b/third_party/dav1d/config/linux/ppc64/config.h
-@@ -0,0 +1,39 @@
-+/*
-+ * Autogenerated by the Meson build system.
-+ * Do not edit, your changes will be lost.
-+ */
-+
-+#pragma once
-+
-+#define ARCH_AARCH64 0
-+
-+#define ARCH_ARM 0
-+
-+#define ARCH_PPC64LE 1
-+
-+#define ARCH_X86 0
-+
-+#define ARCH_X86_32 0
-+
-+#define ARCH_X86_64 0
-+
-+#define CONFIG_16BPC 1
-+
-+#define CONFIG_8BPC 1
-+
-+// #define CONFIG_LOG 1 -- Logging is controlled by Chromium
-+
-+#define ENDIANNESS_BIG 0
-+
-+#define HAVE_ASM 1
-+
-+#define HAVE_CLOCK_GETTIME 1
-+
-+#define HAVE_DLSYM 1
-+
-+#define HAVE_GETAUXVAL 1
-+
-+#define HAVE_POSIX_MEMALIGN 1
-+
-+#define HAVE_UNISTD_H 1
-+
-diff --git a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-index 0b4bd72f0..a0caa5e71 100644
---- a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-+++ b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-@@ -51,4 +51,19 @@
- #define u16l_to_i32(v) ((i32x4) vec_mergel((u16x8) v, vec_splat_u16(0)))
- #define i16l_to_i32(v) ((i32x4) vec_unpackl((i16x8)v))
-
-+#if defined(__clang__)
-+#undef vec_splats
-+#define vec_splats(N) \
-+ _Generic((N), \
-+ unsigned char: ((u8x16)(N)), \
-+ signed char: ((i8x16)(N)), \
-+ unsigned short: ((u16x8)(N)), \
-+ signed short: ((i16x8)(N)), \
-+ unsigned int: ((u32x4)(N)), \
-+ signed int: ((i32x4)(N)), \
-+ unsigned long long: ((u64x2)(N)), \
-+ signed long long: ((i64x2)(N)) \
-+ )
-+#endif
-+
- #endif /* DAV1D_SRC_PPC_TYPES_H */
-diff --git a/third_party/eigen3/BUILD.gn b/third_party/eigen3/BUILD.gn
-index 0d4e184..f2ce484 100644
---- a/third_party/eigen3/BUILD.gn
-+++ b/third_party/eigen3/BUILD.gn
-@@ -22,4 +22,8 @@ config("eigen_includes") {
- # for this component on Windows on Arm due to compilation errors.
- defines += [ "EIGEN_DONT_VECTORIZE" ]
- }
-+
-+ if (target_cpu == "ppc64") {
-+ defines += [ "EIGEN_DONT_VECTORIZE" ]
-+ }
- }
-
-diff --git a/third_party/libaom/BUILD.gn b/third_party/libaom/BUILD.gn
-index 9b065bd..df3af02 100644
---- a/third_party/libaom/BUILD.gn
-+++ b/third_party/libaom/BUILD.gn
-@@ -40,6 +40,8 @@
- cpu_arch_full = "generic"
- } else if (current_cpu == "loong64") {
- cpu_arch_full = "generic"
-+} else if (current_cpu == "ppc64") {
-+ cpu_arch_full = "generic"
- } else {
- cpu_arch_full = current_cpu
- }
-diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h
-index e4ac22644..1c57015db 100644
---- a/third_party/lss/linux_syscall_support.h
-+++ b/third_party/lss/linux_syscall_support.h
-@@ -3947,7 +3947,7 @@ struct kernel_statfs {
- LSS_REG(2, buf);
- LSS_BODY(void*, mmap2, "0"(__r2));
- }
--#else
-+#elif !defined(__powerpc64__) /* ppc64 doesn't have mmap2 */
- #define __NR__mmap2 __NR_mmap2
- LSS_INLINE _syscall6(void*, _mmap2, void*, s,
- size_t, l, int, p,
-@@ -4058,7 +4058,7 @@ struct kernel_statfs {
- #if defined(__i386__) || \
- defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \
- (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \
-- defined(__PPC__) || \
-+ (defined(__PPC__) && !defined(__powerpc64__)) || \
- (defined(__s390__) && !defined(__s390x__))
- /* On these architectures, implement mmap() with mmap2(). */
- LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d,
-@@ -4872,11 +4872,11 @@ struct kernel_statx {
- LSS_SC_BODY(4, int, 8, d, type, protocol, sv);
- }
- #endif
-- #if defined(__NR_recvmsg)
-+ #if defined(__NR_recvmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, recvmsg, int, s, struct kernel_msghdr*, msg,
- int, flags)
- #endif
-- #if defined(__NR_sendmsg)
-+ #if defined(__NR_sendmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, sendmsg, int, s, const struct kernel_msghdr*,
- msg, int, flags)
- #endif
-@@ -4885,13 +4885,13 @@ struct kernel_statx {
- int, flags, const struct kernel_sockaddr*, to,
- unsigned int, tolen)
- #endif
-- #if defined(__NR_shutdown)
-+ #if defined(__NR_shutdown) && !defined(__PPC__)
- LSS_INLINE _syscall2(int, shutdown, int, s, int, how)
- #endif
-- #if defined(__NR_socket)
-+ #if defined(__NR_socket) && !defined(__PPC__)
- LSS_INLINE _syscall3(int, socket, int, domain, int, type, int, protocol)
- #endif
-- #if defined(__NR_socketpair)
-+ #if defined(__NR_socketpair) && !defined(__PPC__)
- LSS_INLINE _syscall4(int, socketpair, int, d, int, type, int, protocol,
- int*, sv)
- #endif
-diff --git a/third_party/pdfium/third_party/libpng16/pngpriv.h b/third_party/pdfium/third_party/libpng16/pngpriv.h
-index 583c26f..e03d697 100644
---- a/third_party/pdfium/third_party/libpng16/pngpriv.h
-+++ b/third_party/pdfium/third_party/libpng16/pngpriv.h
-@@ -196,11 +196,7 @@
- #endif
-
- #ifndef PNG_POWERPC_VSX_OPT
--# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
--# define PNG_POWERPC_VSX_OPT 2
--# else
--# define PNG_POWERPC_VSX_OPT 0
--# endif
-+# define PNG_POWERPC_VSX_OPT 0
- #endif
-
- #ifndef PNG_INTEL_SSE_OPT
-diff --git a/third_party/pffft/src/pffft.c b/third_party/pffft/src/pffft.c
-index bdac4d784..51e0f2cac 100644
---- a/third_party/pffft/src/pffft.c
-+++ b/third_party/pffft/src/pffft.c
-@@ -100,6 +100,7 @@
- Altivec support macros
- */
- #if !defined(PFFFT_SIMD_DISABLE) && (defined(__ppc__) || defined(__ppc64__))
-+#include <altivec.h>
- typedef vector float v4sf;
- # define SIMD_SZ 4
- # define VZERO() ((vector float) vec_splat_u8(0))
-diff --git a/third_party/sqlite/src/amalgamation/sqlite3.c b/third_party/sqlite/src/amalgamation/sqlite3.c
-index 6b4a7899d..b8c7fe414 100644
---- a/third_party/sqlite/src/amalgamation/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation/sqlite3.c
-@@ -14474,7 +14474,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/amalgamation_dev/sqlite3.c b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-index d30c9b7de..cf75a69d9 100644
---- a/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-@@ -14487,7 +14487,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/ext/rtree/rtree.c b/third_party/sqlite/src/ext/rtree/rtree.c
-index f5b57a5e2..80a2d0ad8 100644
---- a/third_party/sqlite/src/ext/rtree/rtree.c
-+++ b/third_party/sqlite/src/ext/rtree/rtree.c
-@@ -450,7 +450,7 @@ struct RtreeMatchArg {
- #if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__arm__)
-+ defined(__arm__) || defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- #elif defined(sparc) || defined(__ppc__)
- # define SQLITE_BYTEORDER 4321
-diff --git a/third_party/sqlite/src/src/sqliteInt.h b/third_party/sqlite/src/src/sqliteInt.h
-index 245070d4f..b25164e95 100644
---- a/third_party/sqlite/src/src/sqliteInt.h
-+++ b/third_party/sqlite/src/src/sqliteInt.h
-@@ -877,7 +877,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/webrtc/rtc_base/system/arch.h b/third_party/webrtc/rtc_base/system/arch.h
-index be2367b85..be4ee4233 100644
---- a/third_party/webrtc/rtc_base/system/arch.h
-+++ b/third_party/webrtc/rtc_base/system/arch.h
-@@ -79,6 +79,18 @@
- #elif defined(__EMSCRIPTEN__)
- #define WEBRTC_ARCH_32_BITS
- #define WEBRTC_ARCH_LITTLE_ENDIAN
-+#elif defined(__PPC__)
-+#define WEBRTC_ARCH_PPC_FAMILY
-+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-+#define WEBRTC_ARCH_LITTLE_ENDIAN
-+#else
-+#define WEBRTC_ARCH_BIG_ENDIAN
-+#endif
-+#if defined(__LP64__)
-+#define WEBRTC_ARCH_64_BITS
-+#else
-+#define WEBRTC_ARCH_32_BITS
-+#endif
- #else
- #error Please add support for your architecture in rtc_base/system/arch.h
- #endif
-diff --git a/v8/BUILD.gn b/v8/BUILD.gn
-index f39529a3a..e84fc449e 100644
---- a/v8/BUILD.gn
-+++ b/v8/BUILD.gn
-@@ -850,6 +850,12 @@ config("toolchain") {
- }
- if (host_byteorder == "little") {
- defines += [ "V8_TARGET_ARCH_PPC_LE" ]
-+ cflags += [
-+ # Enable usage of AltiVec, VSX, and other POWER8 and higher features
-+ "-mcpu=power8",
-+ "-maltivec",
-+ "-mvsx",
-+ ]
- } else if (host_byteorder == "big") {
- defines += [ "V8_TARGET_ARCH_PPC_BE" ]
- if (current_os == "aix") {
---- a/ui/gl/features.gni
-+++ b/ui/gl/features.gni
-@@ -33,5 +33,5 @@
- is_chromeos_ash || is_fuchsia) &&
- (target_cpu == "x86" || target_cpu == "x64" || target_cpu == "arm" ||
- target_cpu == "arm64" || target_cpu == "mipsel" ||
-- target_cpu == "mips64el" || target_cpu == "riscv64")
-+ target_cpu == "mips64el" || target_cpu == "riscv64" || target_cpu == "ppc64")
- }
-diff --git a/v8/test/BUILD.gn b/v8/test/BUILD.gn
-index fb872ad39..45fc585dd 100644
---- a/v8/test/BUILD.gn
-+++ b/v8/test/BUILD.gn
-@@ -42,7 +42,7 @@ group("gn_all") {
- "benchmarks/cpp:gn_all",
- "cctest:cctest",
- "unittests:generate-bytecode-expectations",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
- }
- }
-@@ -84,7 +84,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- "webkit:v8_webkit",
- ]
-
-@@ -109,7 +109,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
-
- if (v8_enable_webassembly) {
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch b/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
deleted file mode 100644
index df453f491d8c..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-+++ b/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-@@ -574,6 +574,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCAsmInfoCOFF.cpp",
- "llvm/lib/MC/MCAsmInfoDarwin.cpp",
- "llvm/lib/MC/MCAsmInfoELF.cpp",
-+ "llvm/lib/MC/MCAsmInfoXCOFF.cpp",
- "llvm/lib/MC/MCAsmMacro.cpp",
- "llvm/lib/MC/MCAsmStreamer.cpp",
- "llvm/lib/MC/MCAssembler.cpp",
-@@ -629,6 +630,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCWinCOFFStreamer.cpp",
- "llvm/lib/MC/MCWinEH.cpp",
- "llvm/lib/MC/MCXCOFFStreamer.cpp",
-+ "llvm/lib/MC/MCXCOFFObjectTargetWriter.cpp",
- "llvm/lib/MC/MachObjectWriter.cpp",
- "llvm/lib/MC/StringTableBuilder.cpp",
- "llvm/lib/MC/SubtargetFeature.cpp",
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 7dea8bbe50d3..50b9a3aec409 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -1,7 +1,7 @@
# Template file for 'chromium'
pkgname=chromium
# See https://chromiumdash.appspot.com/releases?platform=Linux for the latest version
-version=108.0.5359.124
+version=109.0.5414.74
revision=1
archs="i686* x86_64* aarch64* armv7l* ppc64le*"
hostmakedepends="
@@ -28,7 +28,7 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://www.chromium.org/"
distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz"
-checksum=d48dfac2a61b14a5d7d2f460b09b70ef3ab88e27b82e3173938cb54eaa612a75
+checksum=eded233c26ab631be325ad49cb306c338513b6a6528197d42653e66187548e5d
lib32disabled=yes
@@ -220,9 +220,6 @@ do_configure() {
'icu_use_data_file=true'
- 'use_allocator="none"'
- 'use_allocator_shim=false'
-
'enable_widevine=true'
'enable_hangout_services_extension=true'
@@ -318,13 +315,13 @@ do_configure() {
do_build() {
_setup_toolchain
- CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver chrome_crashpad_handler
+ CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver.unstripped chrome_crashpad_handler
}
do_install() {
vinstall out/Release/chrome 755 usr/lib/${pkgname} ${pkgname}
vinstall out/Release/chrome_crashpad_handler 755 usr/lib/${pkgname} chrome_crashpad_handler
- vinstall out/Release/chromedriver 755 usr/lib/${pkgname} chromedriver
+ vinstall out/Release/chromedriver.unstripped 755 usr/lib/${pkgname} chromedriver
vinstall out/Release/libEGL.so 755 usr/lib/${pkgname} libEGL.so
vinstall out/Release/libGLESv2.so 755 usr/lib/${pkgname} libGLESv2.so
vinstall out/Release/libvk_swiftshader.so 755 usr/lib/${pkgname} libvk_swiftshader.so
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] chromium: update to 109.0.5414.74.
2023-01-11 1:12 [PR PATCH] chromium: update to 109.0.5414.74 Duncaen
2023-01-11 14:05 ` [PR PATCH] [Updated] " Duncaen
@ 2023-01-11 14:05 ` Duncaen
2023-01-11 14:18 ` Duncaen
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Duncaen @ 2023-01-11 14:05 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]
There is an updated pull request by Duncaen against master on the void-packages repository
https://github.com/Duncaen/void-packages chromium-109
https://github.com/void-linux/void-packages/pull/41570
chromium: update to 109.0.5414.74.
[ci skip]
* [ ] x86_64-glibc
* [ ] x86_64-musl
* [ ] aarch64-musl
* [ ] i686
A patch file from https://github.com/void-linux/void-packages/pull/41570.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-chromium-109-41570.patch --]
[-- Type: text/x-diff, Size: 180073 bytes --]
From 303a2493d0e136300a49daa21b86d0be9782f3c7 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Wed, 11 Jan 2023 01:28:40 +0100
Subject: [PATCH] chromium: update to 109.0.5414.74.
---
.../musl-patches/xxx-ppc64le-support.patch | 187 -
.../patches/build-add-use_cxx17.patch | 38 +-
.../patches/fix-build-with-old-clang.patch | 20 +
.../patches/fix-constexpr-narrowing.patch | 21 +
.../patches/fix-musl-pthread-stacksize.patch | 40 -
.../chromium/patches/fix-narrowing-cast.patch | 53 -
.../patches/fix-nasm-musl-config.patch | 12 -
srcpkgs/chromium/patches/narrowing-cast.patch | 21 +
...uild-error-on-linux-with-system-zlib.patch | 41 -
.../patches/remove-strip_binary.patch | 32 -
.../patches/xxx-ppc64le-4k-pages.patch | 60 -
.../chromium/patches/xxx-ppc64le-libvpx.patch | 33 -
.../xxx-ppc64le-sandbox-linux-stat.patch | 31 -
.../patches/xxx-ppc64le-support.patch | 3590 -----------------
.../patches/xxx-ppc64le-swiftshader.patch | 18 -
srcpkgs/chromium/template | 11 +-
16 files changed, 83 insertions(+), 4125 deletions(-)
delete mode 100644 srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
create mode 100644 srcpkgs/chromium/patches/fix-build-with-old-clang.patch
create mode 100644 srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
delete mode 100644 srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
delete mode 100644 srcpkgs/chromium/patches/fix-narrowing-cast.patch
delete mode 100644 srcpkgs/chromium/patches/fix-nasm-musl-config.patch
create mode 100644 srcpkgs/chromium/patches/narrowing-cast.patch
delete mode 100644 srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
delete mode 100644 srcpkgs/chromium/patches/remove-strip_binary.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-support.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
diff --git a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 555f69c072c8..000000000000
--- a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,187 +0,0 @@
-diff --git sandbox/linux/bpf_dsl/seccomp_macros.h sandbox/linux/bpf_dsl/seccomp_macros.h
-index a6aec544e..2a4a7f1bc 100644
---- sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,7 +16,7 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
--#elif defined(__powerpc64__)
-+#elif defined(__powerpc64__) && defined(__GLIBC__)
- // Manually define greg_t on ppc64
- typedef unsigned long long greg_t;
- #endif
-@@ -361,11 +361,11 @@ typedef struct pt_regs regs_struct;
- #define SECCOMP_ARCH AUDIT_ARCH_PPC64
- #endif
-
--#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+#define SECCOMP_REG(_ctx, _reg) (((struct pt_regs *)(_ctx)->uc_mcontext.regs)->gpr[_reg])
-
- #define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
--#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_IP(_ctx) ((struct pt_regs *)(_ctx)->uc_mcontext.regs)->nip
- #define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
- #define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-diff --git sandbox/linux/seccomp-bpf/syscall.cc sandbox/linux/seccomp-bpf/syscall.cc
-index d53a7ff56..c290f0e92 100644
---- sandbox/linux/seccomp-bpf/syscall.cc
-+++ sandbox/linux/seccomp-bpf/syscall.cc
-@@ -499,9 +499,9 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // Same as MIPS, need to invert ret and set error register (cr0.SO)
- if (ret_val <= -1 && ret_val >= -4095) {
- ret_val = -ret_val;
-- ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr |= (1 << 28);
- } else {
-- ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr &= ~(1 << 28);
- }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
---- third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-+++ third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-@@ -22,6 +22,7 @@
- // The following platforms have an implementation of a hardware counter.
- #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
- defined(__powerpc__) || defined(__ppc__) || defined(__riscv) || \
-+ ((defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__)) || defined(__riscv) || \
- defined(_M_IX86) || (defined(_M_X64) && !defined(_M_ARM64EC))
- #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1
- #else
---- third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-+++ third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-@@ -64,7 +64,7 @@
- #elif defined(__i386__) || defined(__x86_64__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_x86-inl.inc"
--#elif defined(__ppc__) || defined(__PPC__)
-+#elif (defined(__ppc__) || defined(__PPC__)) && defined(__GLIBC__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_powerpc-inl.inc"
- #elif defined(__aarch64__)
-diff --git third_party/breakpad/BUILD.gn third_party/breakpad/BUILD.gn
-index f9a60e37..25f3a0b7 100644
---- third_party/breakpad/BUILD.gn
-+++ third_party/breakpad/BUILD.gn
-@@ -637,6 +637,7 @@ if (is_linux || is_android) {
-
- if (current_cpu == "ppc64") {
- defines = [ "HAVE_GETCONTEXT" ]
-+ libs += [ "ucontext" ]
- } else {
- sources += [
- "breakpad/src/common/linux/breakpad_getcontext.S"
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index 03afec7a..0264ecf1 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -273,6 +273,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t ThreadInfo::GetInstructionPointer() const {
- return mcontext.gp_regs[PT_NIP];
- }
-@@ -290,9 +293,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->ctr = mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] = \
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 1090470f..e580233d 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -257,6 +257,9 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
- return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
- }
-@@ -280,9 +283,9 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&uc->uc_mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&uc->uc_mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] =
-diff --git third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index 5a7ab50c..ee8b858c 100644
---- third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -105,6 +105,11 @@
- #define PR_SET_PTRACER 0x59616d61
- #endif
-
-+/* musl hack, can't include asm/ptrace.h as that causes conflicts */
-+#if defined(__powerpc64__) && !defined(PT_NIP)
-+#define PT_NIP 32
-+#endif
-+
- namespace google_breakpad {
-
- namespace {
-diff --git third_party/crashpad/crashpad/snapshot/linux/signal_context.h third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 8e335a09..b2a0f155 100644
---- third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -469,7 +469,7 @@ struct MContext64 {
- SignalThreadContext64 gp_regs;
- SignalFloatContext64 fp_regs;
- SignalVectorContext64 *v_regs;
-- int64_t vmx_reserve[69];
-+ int64_t vmx_reserve[101];
- };
-
- struct ContextTraits64 : public Traits64 {
-diff --git third_party/crashpad/crashpad/util/linux/thread_info.h third_party/crashpad/crashpad/util/linux/thread_info.h
-index dea0d1f3..b203e5b2 100644
---- third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -30,6 +30,7 @@
-
- #if defined(ARCH_CPU_PPC64_FAMILY)
- #include <sys/ucontext.h>
-+#include <asm/ptrace.h>
- #endif
-
- namespace crashpad {
-diff --git third_party/lss/linux_syscall_support.h third_party/lss/linux_syscall_support.h
-index 9955ce44..4c1cc488 100644
---- third_party/lss/linux_syscall_support.h
-+++ third_party/lss/linux_syscall_support.h
-@@ -4216,9 +4216,13 @@ struct kernel_statfs {
- }
- #endif
- #if defined(__NR_fstatat64)
-+ // musl does #define fstatat64 fstatat
-+ #undef fstatat64
- LSS_INLINE _syscall4(int, fstatat64, int, d,
- const char *, p,
- struct kernel_stat64 *, b, int, f)
-+ // set it back like it was
-+ #define fstatat64 fstatat
- #endif
- #if defined(__NR_waitpid)
- // waitpid is polyfilled below when not available.
diff --git a/srcpkgs/chromium/patches/build-add-use_cxx17.patch b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
index 091b1c553727..b50825fb7e2c 100644
--- a/srcpkgs/chromium/patches/build-add-use_cxx17.patch
+++ b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
@@ -1,26 +1,22 @@
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
-@@ -167,6 +167,10 @@
- # Enable -H, which prints the include tree during compilation.
- # For use by tools/clang/scripts/analyze_includes.py
- show_includes = false
-+
-+ # Allow projects that wish to stay on C++17 to override Chromium's default.
-+ # TODO(crbug.com/1402249): evaluate removing this end of 2023
-+ use_cxx17 = false
+@@ -191,6 +191,10 @@
+ current_cpu == "x64"))))
}
- declare_args() {
-@@ -596,7 +600,11 @@
- } else if (is_linux) {
- # TODO(crbug.com/1284275): Switch to C++20 on all platforms.
- if (is_clang) {
-- cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ if (use_cxx17) {
-+ cflags_cc += [ "-std=${standard_prefix}++17" ]
-+ } else {
-+ cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ }
++declare_args() {
++ use_cxx17 = false
++}
++
+ if (is_android || (is_chromeos_ash && is_chromeos_device)) {
+ # Set the path to use orderfile for linking Chrome
+ # Note that this is for using only one orderfile for linking
+@@ -605,7 +609,7 @@
+ cflags_cc += [ "-fno-trigraphs" ]
+ }
+ } else if (is_clang) {
+- if (is_chromeos_device) {
++ if (is_chromeos_device || use_cxx17) {
+ # TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
+ cflags_cc += [ "-std=${standard_prefix}++17" ]
} else {
- # The gcc bots are currently using GCC 9, which is not new enough to
- # support "c++20"/"gnu++20".
diff --git a/srcpkgs/chromium/patches/fix-build-with-old-clang.patch b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
new file mode 100644
index 000000000000..f23218e71e4d
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
@@ -0,0 +1,20 @@
+--- a/build/config/compiler/BUILD.gn
++++ b/build/config/compiler/BUILD.gn
+@@ -805,17 +805,6 @@
+ cflags += [ "-fcomplete-member-pointers" ]
+ }
+
+- # Use DWARF simple template names, with the following exceptions:
+- #
+- # * Windows is not supported as it doesn't use DWARF.
+- # * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
+- # lldb doesn't have the needed changes yet.
+- # * Fuchsia isn't supported as zxdb doesn't support simple template names yet.
+- # TODO(crbug.com/1379070): Remove if the upstream default ever changes.
+- if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
+- cflags_cc += [ "-gsimple-template-names" ]
+- }
+-
+ # MLGO specific flags. These flags enable an ML-based inliner trained on
+ # Chrome on Android (arm32) with ThinLTO enabled, optimizing for size.
+ # The "release" ML model is embedded into clang as part of its build.
diff --git a/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch b/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
new file mode 100644
index 000000000000..00f662a194a7
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
@@ -0,0 +1,21 @@
+--- third_party/blink/renderer/platform/media/web_media_player_impl.cc.orig
++++ third_party/blink/renderer/platform/media/web_media_player_impl.cc
+@@ -3881,15 +3881,15 @@
+ const T&... values) {
+ std::string strkey = std::string(key);
+
+- if constexpr (Flags & kEncrypted) {
++ if constexpr (Flags & kEncrypted != 0) {
+ if (is_encrypted_)
+ UmaFunction(strkey + ".EME", values...);
+ }
+
+- if constexpr (Flags & kTotal)
++ if constexpr (Flags & kTotal != 0)
+ UmaFunction(strkey + ".All", values...);
+
+- if constexpr (Flags & kPlaybackType) {
++ if constexpr (Flags & kPlaybackType != 0) {
+ auto demuxer_type = GetDemuxerType();
+ if (!demuxer_type.has_value())
+ return;
diff --git a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch b/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
deleted file mode 100644
index cd5533190db9..000000000000
--- a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- a/base/threading/platform_thread_linux.cc
-+++ b/base/threading/platform_thread_linux.cc
-@@ -436,8 +436,13 @@
-
- size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
- #if !defined(THREAD_SANITIZER)
-+#if defined(__GLIBC__)
- return 0;
- #else
-+ // musl libcs default is too small, use 8mb like glibc
-+ return (1 << 23);
-+#endif
-+#else
- // ThreadSanitizer bloats the stack heavily. Evidence has been that the
- // default stack size isn't enough for some browser tests.
- return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux).
---- a/chrome/browser/shutdown_signal_handlers_posix.cc
-+++ b/chrome/browser/shutdown_signal_handlers_posix.cc
-@@ -188,11 +188,21 @@
- g_shutdown_pipe_read_fd = pipefd[0];
- g_shutdown_pipe_write_fd = pipefd[1];
- #if !defined(ADDRESS_SANITIZER)
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
- #else
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 * 8;
-+#endif
-+#else
- // ASan instrumentation bloats the stack frames, so we need to increase the
- // stack size to avoid hitting the guard page.
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
-+#else
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 * 8;
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+#endif
- #endif
- ShutdownDetector* detector = new ShutdownDetector(
- g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);
diff --git a/srcpkgs/chromium/patches/fix-narrowing-cast.patch b/srcpkgs/chromium/patches/fix-narrowing-cast.patch
deleted file mode 100644
index afd42a1489ae..000000000000
--- a/srcpkgs/chromium/patches/fix-narrowing-cast.patch
+++ /dev/null
@@ -1,53 +0,0 @@
---- a/base/files/file_util_linux.cc
-+++ b/base/files/file_util_linux.cc
-@@ -23,14 +23,14 @@
-
- // Not all possible |statfs_buf.f_type| values are in linux/magic.h.
- // Missing values are copied from the statfs man page.
-- switch (statfs_buf.f_type) {
-+ switch (static_cast<uintmax_t>(statfs_buf.f_type)) {
- case 0:
- *type = FILE_SYSTEM_0;
- break;
- case EXT2_SUPER_MAGIC: // Also ext3 and ext4
- case MSDOS_SUPER_MAGIC:
- case REISERFS_SUPER_MAGIC:
-- case static_cast<int>(BTRFS_SUPER_MAGIC):
-+ case BTRFS_SUPER_MAGIC:
- case 0x5346544E: // NTFS
- case 0x58465342: // XFS
- case 0x3153464A: // JFS
-@@ -40,14 +40,14 @@
- *type = FILE_SYSTEM_NFS;
- break;
- case SMB_SUPER_MAGIC:
-- case static_cast<int>(0xFF534D42): // CIFS
-+ case 0xFF534D42: // CIFS
- *type = FILE_SYSTEM_SMB;
- break;
- case CODA_SUPER_MAGIC:
- *type = FILE_SYSTEM_CODA;
- break;
-- case static_cast<int>(HUGETLBFS_MAGIC):
-- case static_cast<int>(RAMFS_MAGIC):
-+ case HUGETLBFS_MAGIC:
-+ case RAMFS_MAGIC:
- case TMPFS_MAGIC:
- *type = FILE_SYSTEM_MEMORY;
- break;
---- a/base/system/sys_info_posix.cc
-+++ b/base/system/sys_info_posix.cc
-@@ -100,10 +100,10 @@
- if (HANDLE_EINTR(statfs(path.value().c_str(), &stats)) != 0)
- return false;
-
-- switch (stats.f_type) {
-+ switch (static_cast<uintmax_t>(stats.f_type)) {
- case TMPFS_MAGIC:
-- case static_cast<int>(HUGETLBFS_MAGIC):
-- case static_cast<int>(RAMFS_MAGIC):
-+ case HUGETLBFS_MAGIC:
-+ case RAMFS_MAGIC:
- return true;
- }
- return false;
diff --git a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch b/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
deleted file mode 100644
index 7a0337f3bf3b..000000000000
--- a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/third_party/nasm/config/config-linux.h
-+++ b/third_party/nasm/config/config-linux.h
-@@ -139,7 +139,9 @@
- #define HAVE_ACCESS 1
-
- /* Define to 1 if you have the `canonicalize_file_name' function. */
-+#ifdef __GLIBC__
- #define HAVE_CANONICALIZE_FILE_NAME 1
-+#endif
-
- /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
- /* #undef HAVE_CPU_TO_LE16 */
diff --git a/srcpkgs/chromium/patches/narrowing-cast.patch b/srcpkgs/chromium/patches/narrowing-cast.patch
new file mode 100644
index 000000000000..d10940eb7e89
--- /dev/null
+++ b/srcpkgs/chromium/patches/narrowing-cast.patch
@@ -0,0 +1,21 @@
+from the manpage for statfs:
+
+The __fsword_t type used for various fields in the statfs structure
+definition is a glibc internal type, not intended for public use. This
+leaves the programmer in a bit of a conundrum when trying to copy or
+compare these fields to local variables in a program. Using
+unsigned int for such variables suffices on most systems.
+
+--- a/base/system/sys_info_posix.cc
++++ b/base/system/sys_info_posix.cc
+@@ -64,8 +64,8 @@
+
+ switch (stats.f_type) {
+ case TMPFS_MAGIC:
+- case static_cast<int>(HUGETLBFS_MAGIC):
+- case static_cast<int>(RAMFS_MAGIC):
++ case static_cast<unsigned int>(HUGETLBFS_MAGIC):
++ case static_cast<unsigned int>(RAMFS_MAGIC):
+ return true;
+ }
+ return false;
diff --git a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch b/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
deleted file mode 100644
index 13d504d3e792..000000000000
--- a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From dda01a706453ded8c01c41775707cb5ef4e316f8 Mon Sep 17 00:00:00 2001
-From: Andres Salomon <dilinger@queued.net>
-Date: Tue, 25 Oct 2022 21:11:46 +0000
-Subject: [PATCH] Re-fix TFLite build error on linux when using the system zlib
-
-In commit ae0f9adb7e14c0d19ca695ef6ad40b321a8cb64c, I fixed some build
-errors related to minizip patch inclusion in TFLite. However, after that
-when TFLite Support was rolled to HEAD, a small part of that patch got
-dropped. The result is the following build error with 107.0.5304.62:
-
-../../third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc:22:10: fatal error: 'contrib/minizip/ioapi.h' file not found
- ^~~~~~~~~~~~~~~~~~~~~~~~~
-1 error generated.
-
-This commit re-adds the lost fix.
-
-R=junzou@chromium.org
-
-Change-Id: Ie96c3571894b5100a1e2a2771da29699eff0beb3
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3972087
-Reviewed-by: Robert Ogden <robertogden@chromium.org>
-Commit-Queue: Robert Ogden <robertogden@chromium.org>
-Auto-Submit: Andres Salomon <dilinger@queued.net>
-Cr-Commit-Position: refs/heads/main@{#1063478}
----
- .../metadata/cc/utils/zip_readonly_mem_file.cc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-index 392b6b411fe..525ae4a2b45 100644
---- a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-+++ b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-@@ -19,7 +19,7 @@ limitations under the License.
- #include <cstdio>
-
- #include "absl/strings/string_view.h" // from @com_google_absl
--#include "contrib/minizip/ioapi.h"
-+#include "third_party/zlib/contrib/minizip/ioapi.h"
-
- namespace tflite {
- namespace metadata {
diff --git a/srcpkgs/chromium/patches/remove-strip_binary.patch b/srcpkgs/chromium/patches/remove-strip_binary.patch
deleted file mode 100644
index 8b13c6a056a8..000000000000
--- a/srcpkgs/chromium/patches/remove-strip_binary.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/chrome/test/chromedriver/BUILD.gn.orig
-+++ b/chrome/test/chromedriver/BUILD.gn
-@@ -308,11 +308,7 @@
- }
- }
-
--if (is_linux) {
-- chromedriver_output = "chromedriver.unstripped"
--} else {
-- chromedriver_output = "chromedriver"
--}
-+chromedriver_output = "chromedriver"
-
- executable("$chromedriver_output") {
- testonly = true
-@@ -336,16 +332,6 @@
- }
- }
-
--if (is_linux) {
-- strip_binary("chromedriver") {
-- testonly = true
-- binary_input = "$root_out_dir/$chromedriver_output"
-- symbol_output = "$root_out_dir/chromedriver.debug"
-- stripped_binary_output = "$root_out_dir/chromedriver"
-- deps = [ ":$chromedriver_output" ]
-- }
--}
--
- python_library("chromedriver_py_tests") {
- testonly = true
- deps = [
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch b/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
deleted file mode 100644
index 28c4ad35f14e..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-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;
-
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch b/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
deleted file mode 100644
index 0c03ad4a65eb..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-commit 981437bc846fcdb854062e89fd3d86f112e5f426
-Author: q66 <daniel@octaforge.org>
-Date: Sat Jun 25 12:35:37 2022 +0200
-
- Use generic target for now.
-
- This is because the source tree is missing vsx optimizations that
- then do not get included and result in failed linking such as:
-
- ld.lld: error: undefined symbol: vpx_mse16x16_vsx
-
-diff --git a/third_party/libvpx/generate_gni.sh b/third_party/libvpx/generate_gni.sh
-index 7429080..43ee29a 100755
---- a/third_party/libvpx/generate_gni.sh
-+++ b/third_party/libvpx/generate_gni.sh
-@@ -405,7 +405,7 @@
- gen_config_files linux/mips64el "--target=mips64-linux-gcc ${all_platforms}"
- gen_config_files linux/loongarch \
- "--target=loongarch64-linux-gcc ${all_platforms}"
--gen_config_files linux/ppc64 "--target=ppc64le-linux-gcc ${all_platforms}"
-+gen_config_files linux/ppc64 "--target=generic-gnu ${all_platforms}"
- gen_config_files linux/generic "--target=generic-gnu $HIGHBD ${all_platforms}"
- gen_config_files win/arm64 \
- "--target=arm64-win64-vs15 ${all_platforms} ${HIGHBD}"
-@@ -468,7 +468,7 @@
- gen_rtcd_header linux/mipsel mipsel
- gen_rtcd_header linux/mips64el mips64el
- gen_rtcd_header linux/loongarch loongarch
--gen_rtcd_header linux/ppc64 ppc
-+gen_rtcd_header linux/ppc64 generic
- gen_rtcd_header linux/generic generic
- gen_rtcd_header win/arm64 armv8
- gen_rtcd_header win/ia32 x86 "${require_sse2}"
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch b/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
deleted file mode 100644
index 4bfb5d494b06..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/sandbox/linux/system_headers/linux_stat.h
-+++ b/sandbox/linux/system_headers/linux_stat.h
-@@ -155,6 +155,28 @@ struct kernel_stat {
- unsigned int __unused4;
- unsigned int __unused5;
- };
-+#elif defined(__powerpc64__)
-+struct kernel_stat {
-+ unsigned long st_dev;
-+ unsigned long st_ino;
-+ unsigned long st_nlink;
-+ unsigned int st_mode;
-+ unsigned int st_uid;
-+ unsigned int st_gid;
-+ unsigned long st_rdev;
-+ long st_size;
-+ unsigned long st_blksize;
-+ unsigned long st_blocks;
-+ unsigned long st_atime_;
-+ unsigned long st_atime_nsec_;
-+ unsigned long st_mtime_;
-+ unsigned long st_mtime_nsec_;
-+ unsigned long st_ctime_;
-+ unsigned long st_ctime_nsec_;
-+ unsigned long __unused4;
-+ unsigned long __unused5;
-+ unsigned long __unused6;
-+};
- #endif
-
- // On 32-bit systems, we default to the 64-bit stat struct like libc
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 0bc505358916..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,3590 +0,0 @@
-commit 2c013a317b1114ef67cdbbc30824b28907b9ea94
-Author: Daniel Kolesa <daniel@octaforge.org>
-Date: Wed Mar 3 19:08:29 2021 +0100
-
- ppc64le support
-
-diff --git a/build/download_nacl_toolchains.py b/build/download_nacl_toolchains.py
-index 286a92a27..ec36a85d3 100755
---- a/build/download_nacl_toolchains.py
-+++ b/build/download_nacl_toolchains.py
-@@ -13,6 +13,10 @@ import sys
-
-
- def Main(args):
-+ # If `disable_nacl=1` is in GYP_DEFINES, exit
-+ if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''):
-+ return 0
-+
- script_dir = os.path.dirname(os.path.abspath(__file__))
- src_dir = os.path.dirname(script_dir)
- nacl_dir = os.path.join(src_dir, 'native_client')
---- a/chrome/installer/linux/BUILD.gn
-+++ b/chrome/installer/linux/BUILD.gn
-@@ -97,8 +97,6 @@
- "$root_out_dir/xdg-mime",
- "$root_out_dir/xdg-settings",
- "$root_out_dir/locales/en-US.pak",
-- "$root_out_dir/MEIPreload/manifest.json",
-- "$root_out_dir/MEIPreload/preloaded_data.pb",
- ]
-
- action_foreach("calculate_deb_dependencies") {
-@@ -377,7 +377,6 @@
- "//chrome",
- "//chrome:packed_resources",
- "//chrome/browser/enterprise/connectors/device_trust/key_management/installer/management_service:chrome_management_service",
-- "//chrome/browser/resources/media/mei_preload:component",
- "//components/crash/core/app:chrome_crashpad_handler",
- "//sandbox/linux:chrome_sandbox",
- ]
-diff --git a/sandbox/features.gni b/sandbox/features.gni
-index db30ae6d6..9dc09bf53 100644
---- a/sandbox/features.gni
-+++ b/sandbox/features.gni
-@@ -11,7 +11,8 @@ import("//build/config/nacl/config.gni")
- use_seccomp_bpf = (is_linux || is_chromeos || is_android) &&
- (current_cpu == "x86" || current_cpu == "x64" ||
- current_cpu == "arm" || current_cpu == "arm64" ||
-- current_cpu == "mipsel" || current_cpu == "mips64el")
-+ current_cpu == "mipsel" || current_cpu == "mips64el" ||
-+ current_cpu == "ppc64")
-
- use_seccomp_bpf = use_seccomp_bpf || is_nacl_nonsfi
-
-diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn
-index e9a94b461..cca1a5da5 100644
---- a/sandbox/linux/BUILD.gn
-+++ b/sandbox/linux/BUILD.gn
-@@ -427,6 +427,8 @@ component("sandbox_services") {
-
- source_set("sandbox_services_headers") {
- sources = [
-+ "system_headers/ppc64_linux_syscalls.h",
-+ "system_headers/ppc64_linux_ucontext.h",
- "system_headers/arm64_linux_syscalls.h",
- "system_headers/arm_linux_syscalls.h",
- "system_headers/arm_linux_ucontext.h",
-diff --git a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-index 313511f22..0ca3a326f 100644
---- a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-+++ b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-@@ -56,6 +56,13 @@
- #define MAX_PUBLIC_SYSCALL __NR_syscalls
- #define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-
-+#elif defined(__powerpc64__)
-+
-+#include <asm-generic/unistd.h>
-+#define MIN_SYSCALL 0u
-+#define MAX_PUBLIC_SYSCALL __NR_syscalls
-+#define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-+
- #else
- #error "Unsupported architecture"
- #endif
-diff --git a/sandbox/linux/bpf_dsl/seccomp_macros.h b/sandbox/linux/bpf_dsl/seccomp_macros.h
-index 1a407b952..a6aec544e 100644
---- a/sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ b/sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,6 +16,9 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
-+#elif defined(__powerpc64__)
-+// Manually define greg_t on ppc64
-+typedef unsigned long long greg_t;
- #endif
- #endif
-
-@@ -346,6 +349,51 @@ struct regs_struct {
- #define SECCOMP_PT_PARM4(_regs) (_regs).regs[3]
- #define SECCOMP_PT_PARM5(_regs) (_regs).regs[4]
- #define SECCOMP_PT_PARM6(_regs) (_regs).regs[5]
-+
-+#elif defined(__powerpc64__)
-+#include <asm/ptrace.h>
-+
-+typedef struct pt_regs regs_struct;
-+
-+#ifdef ARCH_CPU_LITTLE_ENDIAN
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64LE
-+#else
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64
-+#endif
-+
-+#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+
-+#define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
-+#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
-+#define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-+#define SECCOMP_PARM4(_ctx) SECCOMP_REG(_ctx, 6)
-+#define SECCOMP_PARM5(_ctx) SECCOMP_REG(_ctx, 7)
-+#define SECCOMP_PARM6(_ctx) SECCOMP_REG(_ctx, 8)
-+
-+#define SECCOMP_NR_IDX (offsetof(struct arch_seccomp_data, nr))
-+#define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch))
-+#define SECCOMP_IP_MSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 4)
-+#define SECCOMP_IP_LSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 0)
-+#define SECCOMP_ARG_MSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 4)
-+#define SECCOMP_ARG_LSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 0)
-+
-+#define SECCOMP_PT_RESULT(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_SYSCALL(_regs) (_regs).gpr[0]
-+#define SECCOMP_PT_IP(_regs) (_regs).nip
-+#define SECCOMP_PT_PARM1(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_PARM2(_regs) (_regs).gpr[4]
-+#define SECCOMP_PT_PARM3(_regs) (_regs).gpr[5]
-+#define SECCOMP_PT_PARM4(_regs) (_regs).gpr[6]
-+#define SECCOMP_PT_PARM5(_regs) (_regs).gpr[7]
-+#define SECCOMP_PT_PARM6(_regs) (_regs).gpr[8]
-+
- #else
- #error Unsupported target platform
-
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-index 6a1ec2389..f20c582dd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-@@ -88,7 +88,8 @@ bool IsBaselinePolicyWatched(int sysno) {
- SyscallSets::IsPrctl(sysno) ||
- SyscallSets::IsProcessGroupOrSession(sysno) ||
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- SyscallSets::IsSocketCall(sysno) ||
- #endif
- #if defined(__arm__)
-@@ -227,7 +228,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_mmap)
- return RestrictMmapFlags();
- #endif
-@@ -245,7 +246,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- return RestrictPrctl();
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_socketpair) {
- // Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen.
- static_assert(AF_UNIX == PF_UNIX,
-@@ -285,7 +286,8 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- if (SyscallSets::IsSocketCall(sysno))
- return RestrictSocketcallCommand();
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:11:10.481579470 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:12:43.524831376 -0400
-@@ -302,7 +302,7 @@
- TEST_BASELINE_SIGSYS(__NR_syslog)
- TEST_BASELINE_SIGSYS(__NR_timer_create)
-
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- TEST_BASELINE_SIGSYS(__NR_inotify_init)
- TEST_BASELINE_SIGSYS(__NR_vserver)
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-@@ -358,7 +358,16 @@
- if (args.nr == __NR_fstatat_default) {
- if (*reinterpret_cast<const char*>(args.args[1]) == '\0' &&
- args.args[3] == static_cast<uint64_t>(AT_EMPTY_PATH)) {
-- return syscall(__NR_fstat_default, static_cast<int>(args.args[0]),
-+ int fd = static_cast<int>(args.args[0]);
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO: Investigate the root cause and fix in glibc
-+ if (fd < 0)
-+ fd = -fd;
-+#endif
-+ return syscall(__NR_fstat_default, fd,
- reinterpret_cast<default_stat_struct*>(args.args[2]));
- }
- return -reinterpret_cast<intptr_t>(fs_denied_errno);
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
-index 2a97d3916..8e81aa6cf 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-14 14:41:08.000000000 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-15 13:17:57.808715733 -0400
-@@ -37,7 +37,8 @@
-
- #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
- !defined(__arm__) && !defined(__aarch64__) && \
-- !defined(PTRACE_GET_THREAD_AREA)
-+ !defined(PTRACE_GET_THREAD_AREA) && \
-+ !defined(__powerpc64__)
- // Also include asm/ptrace-abi.h since ptrace.h in older libc (for instance
- // the one in Ubuntu 16.04 LTS) is missing PTRACE_GET_THREAD_AREA.
- // asm/ptrace-abi.h doesn't exist on arm32 and PTRACE_GET_THREAD_AREA isn't
-@@ -45,6 +46,11 @@
- #include <asm/ptrace-abi.h>
- #endif
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- #if BUILDFLAG(IS_ANDROID)
-
- #if !defined(F_DUPFD_CLOEXEC)
-@@ -99,6 +105,14 @@
- return true;
- #else
- return false;
-+#endif
-+}
-+
-+inline bool IsArchitecturePPC64() {
-+#if defined(__powerpc64__)
-+ return true;
-+#else
-+ return false;
- #endif
- }
-
-@@ -239,6 +254,8 @@
- uint64_t kOLargeFileFlag = O_LARGEFILE;
- if (IsArchitectureX86_64() || IsArchitectureI386() || IsArchitectureMips())
- kOLargeFileFlag = 0100000;
-+ else if (IsArchitecturePPC64())
-+ kOLargeFileFlag = 0200000;
-
- const Arg<int> cmd(1);
- const Arg<long> long_arg(2);
-@@ -256,7 +273,16 @@
- F_SETLKW,
- F_GETLK,
- F_DUPFD,
-- F_DUPFD_CLOEXEC),
-+ F_DUPFD_CLOEXEC
-+#if defined(__powerpc64__)
-+// On PPC64, F_SETLK, F_GETLK, F_SETLKW are defined as the 64-bit variants
-+// but glibc will sometimes still use the 32-bit versions. Allow both.
-+ ,
-+ 5, /* F_GETLK (32) */
-+ 6, /* F_SETLK (32) */
-+ 7 /* F_SETLKW (32) */
-+#endif
-+ ),
- Allow())
- .Case(F_SETFL,
- If((long_arg & ~kAllowedMask) == 0, Allow()).Else(CrashSIGSYS()))
-@@ -266,7 +292,7 @@
- // clang-format on
- }
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- ResultExpr RestrictSocketcallCommand() {
- // Unfortunately, we are unable to restrict the first parameter to
- // socketpair(2). Whilst initially sounding bad, it's noteworthy that very
-@@ -419,7 +445,7 @@
- #endif
- return Switch(request)
- .CASES((
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- PTRACE_GETREGS, PTRACE_GETFPREGS, PTRACE_GET_THREAD_AREA,
- PTRACE_GETREGSET,
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-index ba4289f05..9a4d5ab2d 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-@@ -48,7 +48,7 @@ SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictMprotectFlags();
- // O_NONBLOCK | O_SYNC | O_LARGEFILE | O_CLOEXEC | O_NOATIME.
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictFcntlCommands();
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- // Restrict socketcall(2) to only allow socketpair(2), send(2), recv(2),
- // sendto(2), recvfrom(2), shutdown(2), sendmsg(2) and recvmsg(2).
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictSocketcallCommand();
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-index 642df7207..34f47eb73 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-@@ -29,7 +29,8 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- switch (sysno) {
- case __NR_gettimeofday:
- #if defined(__i386__) || defined(__x86_64__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_time:
- #endif
- return true;
-@@ -52,12 +53,14 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- case __NR_clock_nanosleep_time64: // Parameters filtered by RestrictClockID().
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ftime: // Obsolete.
- #endif
- case __NR_settimeofday: // Privileged.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stime:
- #endif
- default:
-@@ -135,7 +138,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_faccessat: // EPERM not a valid errno.
- case __NR_fchmodat:
- case __NR_fchownat: // Should be called chownat ?
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat: // fstatat(). EPERM not a valid errno.
- #elif defined(__i386__) || defined(__arm__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-@@ -154,7 +157,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_memfd_create:
- case __NR_mkdirat:
- case __NR_mknodat:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldlstat:
- case __NR_oldstat:
- #endif
-@@ -168,7 +171,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- #endif
- case __NR_statfs: // EPERM not a valid errno.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_statfs64:
- #endif
- case __NR_symlinkat:
-@@ -178,7 +182,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_truncate64:
- #endif
- case __NR_unlinkat:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_utime:
- #endif
- case __NR_utimensat: // New.
-@@ -203,7 +208,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- #endif
- return true;
- // TODO(jln): these should be denied gracefully as well (moved below).
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_fadvise64: // EPERM not a valid errno.
- #endif
- #if defined(__i386__)
-@@ -216,11 +222,12 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_flock: // EPERM not a valid errno.
- case __NR_fstatfs: // Give information about the whole filesystem.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_fstatfs64:
- #endif
- case __NR_fsync: // EPERM not a valid errno.
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldfstat:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-@@ -228,6 +235,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_sync_file_range: // EPERM not a valid errno.
- #elif defined(__arm__)
- case __NR_arm_sync_file_range: // EPERM not a valid errno.
-+#elif defined(__powerpc64__)
-+ case __NR_sync_file_range2: // EPERM not a valid errno.
- #endif
- default:
- return false;
-@@ -248,7 +257,8 @@ bool SyscallSets::IsDeniedFileSystemAccessViaFd(int sysno) {
- #endif
- case __NR_getdents64: // EPERM not a valid errno.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_readdir:
- #endif
- return true;
-@@ -289,7 +299,7 @@ bool SyscallSets::IsGetSimpleId(int sysno) {
- bool SyscallSets::IsProcessPrivilegeChange(int sysno) {
- switch (sysno) {
- case __NR_capset:
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_ioperm: // Intel privilege.
- case __NR_iopl: // Intel privilege.
- #endif
-@@ -340,8 +350,11 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- case __NR_rt_sigreturn:
- case __NR_rt_sigtimedwait:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
-+#ifndef __powerpc64__
- case __NR_rt_sigtimedwait_time64:
-+#endif
- case __NR_sigaction:
- case __NR_sigprocmask:
- case __NR_sigreturn:
-@@ -357,7 +370,8 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- #endif
- case __NR_signalfd4:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_sigpending:
- case __NR_sigsuspend:
- #endif
-@@ -381,7 +395,7 @@ bool SyscallSets::IsAllowedOperationOnFd(int sysno) {
- #endif
- case __NR_dup3:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_shutdown:
- #endif
- return true;
-@@ -414,7 +428,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- case __NR_exit_group:
- case __NR_wait4:
- case __NR_waitid:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_waitpid:
- #endif
- return true;
-@@ -431,7 +445,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- #endif
- case __NR_set_tid_address:
- case __NR_unshare:
--#if !defined(__mips__) && !defined(__aarch64__)
-+#if !defined(__mips__) && !defined(__aarch64__) || defined(__powerpc64__)
- case __NR_vfork:
- #endif
- default:
-@@ -484,7 +498,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- return true;
- default:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_socketpair: // We will want to inspect its argument.
- #endif
- return false;
-@@ -494,7 +508,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- switch (sysno) {
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_accept:
- case __NR_accept4:
- case __NR_bind:
-@@ -509,7 +523,8 @@ bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- bool SyscallSets::IsSocketCall(int sysno) {
- switch (sysno) {
-@@ -523,7 +538,8 @@ bool SyscallSets::IsSocketCall(int sysno) {
- }
- #endif
-
--#if defined(__x86_64__) || defined(__arm__) || defined(__mips__)
-+#if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- bool SyscallSets::IsNetworkSocketInformation(int sysno) {
- switch (sysno) {
- case __NR_getpeername:
-@@ -548,7 +564,7 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
- case __NR_mincore:
- case __NR_mlockall:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_mmap:
- #endif
- #if defined(__i386__) || defined(__arm__) || \
-@@ -578,7 +594,8 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- switch (sysno) {
- case __NR_lseek:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR__llseek:
- #endif
- #if !defined(__aarch64__)
-@@ -598,26 +615,28 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- case __NR_readv:
- case __NR_pread64:
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_recv:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_recvfrom: // Could specify source.
- case __NR_recvmsg: // Could specify source.
- #endif
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_select:
- #endif
--#if defined(__i386__) || defined(__arm__) || defined(__mips__)
-+#if defined(__i386__) || defined(__arm__) || defined(__mips__) || defined(__powerpc64__)
- case __NR__newselect:
- #endif
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_send:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_sendmsg: // Could specify destination.
- case __NR_sendto: // Could specify destination.
- #endif
-@@ -673,7 +692,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- return true;
- case __NR_getpriority:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_nice:
- #endif
- case __NR_setpriority:
-@@ -685,7 +705,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- bool SyscallSets::IsAdminOperation(int sysno) {
- switch (sysno) {
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_bdflush:
- #endif
- case __NR_kexec_load:
-@@ -701,7 +722,8 @@ bool SyscallSets::IsAdminOperation(int sysno) {
-
- bool SyscallSets::IsKernelModule(int sysno) {
- switch (sysno) {
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_create_module:
- case __NR_get_kernel_syms: // Should ENOSYS.
- case __NR_query_module:
-@@ -734,7 +756,8 @@ bool SyscallSets::IsFsControl(int sysno) {
- case __NR_swapoff:
- case __NR_swapon:
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_umount:
- #endif
- case __NR_umount2:
-@@ -750,7 +773,7 @@ bool SyscallSets::IsNuma(int sysno) {
- case __NR_getcpu:
- case __NR_mbind:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_migrate_pages:
- #endif
- case __NR_move_pages:
-@@ -785,14 +808,15 @@ bool SyscallSets::IsGlobalProcessEnvironment(int sysno) {
- switch (sysno) {
- case __NR_acct: // Privileged.
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
--#if defined(__i386__) || defined(__arm__)
-+#if defined(__i386__) || defined(__arm__) || defined(__powerpc64__)
- case __NR_ugetrlimit:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ulimit:
- #endif
- case __NR_getrusage:
-@@ -826,7 +850,7 @@ bool SyscallSets::IsGlobalSystemStatus(int sysno) {
- #endif
- case __NR_sysinfo:
- case __NR_uname:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_olduname:
- case __NR_oldolduname:
- #endif
-@@ -892,8 +916,16 @@ bool SyscallSets::IsSystemVSemaphores(int sysno) {
- }
- #endif
-
-+/* shitty hack around Void's 4.19 kernel headers missing those numbers */
-+#if defined(__powerpc64__) && !defined(__NR_shmget)
-+#define __NR_shmget 395
-+#define __NR_shmctl 396
-+#define __NR_shmat 397
-+#define __NR_shmdt 398
-+#endif
-+
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- bool SyscallSets::IsSystemVSharedMemory(int sysno) {
-@@ -925,7 +957,8 @@ bool SyscallSets::IsSystemVMessageQueue(int sysno) {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- bool SyscallSets::IsSystemVIpc(int sysno) {
- switch (sysno) {
-@@ -945,7 +978,8 @@ bool SyscallSets::IsAnySystemV(int sysno) {
- return IsSystemVMessageQueue(sysno) || IsSystemVSemaphores(sysno) ||
- IsSystemVSharedMemory(sysno);
- #elif defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- return IsSystemVIpc(sysno);
- #endif
- }
-@@ -1002,7 +1036,8 @@ bool SyscallSets::IsFaNotify(int sysno) {
- bool SyscallSets::IsTimer(int sysno) {
- switch (sysno) {
- case __NR_getitimer:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_alarm:
- #endif
- case __NR_setitimer:
-@@ -1084,18 +1119,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_syncfs:
- case __NR_vhangup:
- // The system calls below are not implemented.
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_afs_syscall:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_break:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_getpmsg:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_gtty:
- case __NR_idle:
- case __NR_lock:
-@@ -1103,20 +1142,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_prof:
- case __NR_profil:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_putpmsg:
- #endif
- #if defined(__x86_64__)
- case __NR_security:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stty:
- #endif
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- case __NR_tuxcall:
- #endif
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- case __NR_vserver:
- #endif
- return true;
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-index 923533ec9..411f72acd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-@@ -43,13 +43,14 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsDeniedGetOrModifySocket(int sysno);
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- static bool IsSocketCall(int sysno);
- #endif
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- static bool IsNetworkSocketInformation(int sysno);
- #endif
-
-@@ -76,7 +77,7 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsSystemVSemaphores(int sysno);
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- static bool IsSystemVSharedMemory(int sysno);
-@@ -88,7 +89,8 @@ class SANDBOX_EXPORT SyscallSets {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- static bool IsSystemVIpc(int sysno);
- #endif
-diff --git a/sandbox/linux/seccomp-bpf/syscall.cc b/sandbox/linux/seccomp-bpf/syscall.cc
-index e47e98bf5..d53a7ff56 100644
---- a/sandbox/linux/seccomp-bpf/syscall.cc
-+++ b/sandbox/linux/seccomp-bpf/syscall.cc
-@@ -18,7 +18,7 @@ namespace sandbox {
- namespace {
-
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined (ARCH_CPU_PPC64_FAMILY)
- // Number that's not currently used by any Linux kernel ABIs.
- const int kInvalidSyscallNumber = 0x351d3;
- #else
-@@ -310,12 +310,56 @@ asm(// We need to be able to tell the kernel exactly where we made a
- // Enter the kernel
- "svc 0\n"
- "2:ret\n"
-+ ".cfi_endproc\n"
-+ ".size SyscallAsm, .-SyscallAsm\n"
-+#elif defined(__powerpc64__)
-+ ".text\n"
-+ ".align 4\n"
-+ ".type SyscallAsm @function\n"
-+ "SyscallAsm:\n"
-+ ".cfi_startproc\n"
-+
-+ // Check if r3 is negative
-+ "cmpdi 3, 0\n"
-+ "bgt 2f\n"
-+
-+ // Load address of 3f into r3 and return
-+ "mflr 10\n"
-+ "bl 1f\n"
-+ "1: mflr 3\n"
-+ "mtlr 10\n"
-+ "addi 3, 3, 4*13\n"
-+ "blr\n"
-+
-+ // Load arguments from array into r3-8
-+ // save param 3 in r10
-+ "2:\n"
-+ "mr 0, 3\n"
-+ "ld 3, 0(4)\n"
-+ "ld 5, 16(4)\n"
-+ "ld 6, 24(4)\n"
-+ "ld 7, 32(4)\n"
-+ "ld 8, 40(4)\n"
-+ "ld 4, 8(4)\n"
-+ "li 9, 0\n"
-+
-+ // Enter kernel
-+ "sc\n"
-+
-+ // Magic return address
-+ "3:\n"
-+ // Like MIPS, ppc64 return values are always positive.
-+ // Check for error in cr0.SO and negate upon error
-+ "bc 4, 3, 4f\n"
-+ "neg 3, 3\n"
-+ "4: blr\n"
-+
- ".cfi_endproc\n"
- ".size SyscallAsm, .-SyscallAsm\n"
- #endif
- ); // asm
-
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- extern "C" {
- intptr_t SyscallAsm(intptr_t nr, const intptr_t args[6]);
- }
-@@ -429,6 +473,8 @@ intptr_t Syscall::Call(int nr,
- ret = inout;
- }
-
-+#elif defined(__powerpc64__)
-+ intptr_t ret = SyscallAsm(nr, args);
- #else
- #error "Unimplemented architecture"
- #endif
-@@ -445,8 +491,18 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // needs to be changed back.
- ret_val = -ret_val;
- SECCOMP_PARM4(ctx) = 1;
-- } else
-+ } else {
- SECCOMP_PARM4(ctx) = 0;
-+ }
-+#endif
-+#if defined(__powerpc64__)
-+ // Same as MIPS, need to invert ret and set error register (cr0.SO)
-+ if (ret_val <= -1 && ret_val >= -4095) {
-+ ret_val = -ret_val;
-+ ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ } else {
-+ ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
- }
-diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc
-index f5b86a73a..5e6c4a068 100644
---- a/sandbox/linux/seccomp-bpf/trap.cc
-+++ b/sandbox/linux/seccomp-bpf/trap.cc
-@@ -232,6 +232,20 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
- SetIsInSigHandler();
- }
-
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO(shawn@anastas.io): investigate this issue further
-+ auto nr = SECCOMP_SYSCALL(ctx);
-+ if (nr == __NR_openat || nr == __NR_mkdirat || nr == __NR_faccessat || nr == __NR_readlinkat ||
-+ nr == __NR_renameat || nr == __NR_renameat2 || nr == __NR_newfstatat || nr == __NR_unlinkat) {
-+ if (static_cast<int>(SECCOMP_PARM1(ctx)) > 0) {
-+ SECCOMP_PARM1(ctx) = -SECCOMP_PARM1(ctx);
-+ }
-+ }
-+#endif
-+
- // Copy the seccomp-specific data into a arch_seccomp_data structure. This
- // is what we are showing to TrapFnc callbacks that the system call
- // evaluator registered with the sandbox.
-diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc
-index d7b5d8c44..4adc6d0d4 100644
---- a/sandbox/linux/services/credentials.cc
-+++ b/sandbox/linux/services/credentials.cc
-@@ -81,7 +81,7 @@ bool ChrootToSafeEmptyDir() {
- pid_t pid = -1;
- alignas(16) char stack_buf[PTHREAD_STACK_MIN];
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // The stack grows downward.
- void* stack = stack_buf + sizeof(stack_buf);
- #else
-@@ -90,7 +90,9 @@
-
- int clone_flags = CLONE_FS | LINUX_SIGCHLD;
- void* tls = nullptr;
--#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
-+// RAJA this might be it...
-+#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY) || \
-+ defined(ARCH_CPU_PPC64_FAMILY)) && \
- !defined(MEMORY_SANITIZER)
- // Use CLONE_VM | CLONE_VFORK as an optimization to avoid copying page tables.
- // Since clone writes to the new child's TLS before returning, we must set a
-@@ -98,6 +100,11 @@
- // glibc performs syscalls by calling a function pointer in TLS, so we do not
- // attempt this optimization.
- // TODO(crbug.com/1247458) Broken in MSan builds after LLVM f1bb30a4956f.
-+ //
-+ // NOTE: Without CLONE_VM, fontconfig will attempt to reload configuration
-+ // in every thread. Since the rendered threads are sandboxed without
-+ // filesystem access (e.g. to /etc/fonts/fonts.conf) this will cause font
-+ // configuraiton loading failures and no fonts will be displayed!
- clone_flags |= CLONE_VM | CLONE_VFORK | CLONE_SETTLS;
-
- char tls_buf[PTHREAD_STACK_MIN] = {0};
-diff --git a/sandbox/linux/services/syscall_wrappers.cc b/sandbox/linux/services/syscall_wrappers.cc
-index fcfd2aa12..f6eb32fb7 100644
---- a/sandbox/linux/services/syscall_wrappers.cc
-+++ b/sandbox/linux/services/syscall_wrappers.cc
-@@ -58,7 +58,7 @@ long sys_clone(unsigned long flags,
- #if defined(ARCH_CPU_X86_64)
- return syscall(__NR_clone, flags, child_stack, ptid, ctid, tls);
- #elif defined(ARCH_CPU_X86) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // CONFIG_CLONE_BACKWARDS defined.
- return syscall(__NR_clone, flags, child_stack, ptid, tls, ctid);
- #endif
-diff --git a/sandbox/linux/syscall_broker/broker_process.cc b/sandbox/linux/syscall_broker/broker_process.cc
-index d72c9d238..77f1d95f5 100644
---- a/sandbox/linux/syscall_broker/broker_process.cc
-+++ b/sandbox/linux/syscall_broker/broker_process.cc
-@@ -169,7 +169,7 @@ bool BrokerProcess::IsSyscallBrokerable(int sysno, bool fast_check) const {
- #if defined(__NR_fstatat64)
- case __NR_fstatat64:
- #endif
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat:
- #endif
- return !fast_check || allowed_command_set_.test(COMMAND_STAT);
-diff --git a/sandbox/linux/system_headers/linux_seccomp.h b/sandbox/linux/system_headers/linux_seccomp.h
-index 1fa47ed09..39cc9ab53 100644
---- a/sandbox/linux/system_headers/linux_seccomp.h
-+++ b/sandbox/linux/system_headers/linux_seccomp.h
-@@ -41,6 +41,9 @@
- #ifndef EM_AARCH64
- #define EM_AARCH64 183
- #endif
-+#ifndef EM_PPC64
-+#define EM_PPC64 21
-+#endif
-
- #ifndef __AUDIT_ARCH_64BIT
- #define __AUDIT_ARCH_64BIT 0x80000000
-@@ -73,6 +76,12 @@
- #ifndef AUDIT_ARCH_AARCH64
- #define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
- #endif
-+#ifndef AUDIT_ARCH_PPC64
-+#define AUDIT_ARCH_PPC64 (EM_PPC64 | __AUDIT_ARCH_64BIT)
-+#endif
-+#ifndef AUDIT_ARCH_PPC64LE
-+#define AUDIT_ARCH_PPC64LE (EM_PPC64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
-+#endif
-
- // For prctl.h
- #ifndef PR_SET_SECCOMP
-diff --git a/sandbox/linux/system_headers/linux_signal.h b/sandbox/linux/system_headers/linux_signal.h
-index f5a736761..515b21a5f 100644
---- a/sandbox/linux/system_headers/linux_signal.h
-+++ b/sandbox/linux/system_headers/linux_signal.h
-@@ -13,7 +13,7 @@
- // (not undefined, but defined different values and in different memory
- // layouts). So, fill the gap here.
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
-
- #define LINUX_SIGHUP 1
- #define LINUX_SIGINT 2
-diff --git a/sandbox/linux/system_headers/linux_syscalls.h b/sandbox/linux/system_headers/linux_syscalls.h
-index 2b78a0cc3..0a70f5ea5 100644
---- a/sandbox/linux/system_headers/linux_syscalls.h
-+++ b/sandbox/linux/system_headers/linux_syscalls.h
-@@ -35,5 +35,9 @@
- #include "sandbox/linux/system_headers/arm64_linux_syscalls.h"
- #endif
-
-+#if defined(__powerpc64__)
-+#include "sandbox/linux/system_headers/ppc64_linux_syscalls.h"
-+#endif
-+
- #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SYSCALLS_H_
-
-diff --git a/sandbox/linux/system_headers/ppc64_linux_syscalls.h b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-new file mode 100644
-index 000000000..ccacffe22
---- /dev/null
-+++ b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-@@ -0,0 +1,12 @@
-+// Copyright 2014 The Chromium Authors. All rights reserved.
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+#define SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+
-+#include <asm/unistd.h>
-+
-+//TODO: is it necessary to redefine syscall numbers for PPC64?
-+
-+#endif // SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-diff --git a/sandbox/policy/linux/bpf_utility_policy_linux.cc b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_utility_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-@@ -34,7 +34,7 @@
- case __NR_fdatasync:
- case __NR_fsync:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
- #if defined(__i386__) || defined(__arm__)
-diff --git a/sandbox/policy/linux/bpf_renderer_policy_linux.cc b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-@@ -15,6 +15,11 @@
- #include "sandbox/linux/system_headers/linux_syscalls.h"
- #include "sandbox/policy/linux/sandbox_linux.h"
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- // TODO(vignatti): replace the local definitions below with #include
- // <linux/dma-buf.h> once kernel version 4.6 becomes widely used.
- #include <linux/types.h>
-@@ -77,7 +77,7 @@
- case __NR_ftruncate64:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- case __NR_setrlimit:
- // We allow setrlimit to dynamically adjust the address space limit as
-diff --git a/third_party/angle/src/compiler/translator/InfoSink.h b/third_party/angle/src/compiler/translator/InfoSink.h
-index 3a807e1e3..5258617a7 100644
---- a/third_party/angle/src/compiler/translator/InfoSink.h
-+++ b/third_party/angle/src/compiler/translator/InfoSink.h
-@@ -92,7 +92,16 @@ class TInfoSinkBase
- stream.precision(8);
- stream << f;
- }
-- sink.append(stream.str());
-+
-+ // Hack to work around a bug where negative floating point values
-+ // are rendered like '.0.5' instead of '-0.5'
-+ std::string res(stream.str());
-+
-+ if (signbit(f)) { // test if f is negative
-+ res[0] = '-';
-+ }
-+
-+ sink.append(res);
- return *this;
- }
- // Write boolean values as their names instead of integral value.
-diff --git a/third_party/angle/src/libANGLE/Constants.h b/third_party/angle/src/libANGLE/Constants.h
-index fcbc9246a..39ae66148 100644
---- a/third_party/angle/src/libANGLE/Constants.h
-+++ b/third_party/angle/src/libANGLE/Constants.h
-@@ -9,6 +9,7 @@
- #ifndef LIBANGLE_CONSTANTS_H_
- #define LIBANGLE_CONSTANTS_H_
-
-+#include <cstddef>
- #include "common/platform.h"
-
- #include <stdint.h>
-diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
-index 17cf9cda9..8ce96bd32 100644
---- a/third_party/boringssl/BUILD.gn
-+++ b/third_party/boringssl/BUILD.gn
-@@ -103,6 +103,13 @@ if (is_win && !is_msan && current_cpu != "arm64") {
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-+ } else if (current_cpu == "ppc64") {
-+ if (is_linux) {
-+ # TODO: ppc64 (be) check
-+ sources += crypto_sources_linux_ppc64le
-+ } else {
-+ public_configs = [ ":no_asm_config" ]
-+ }
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-diff --git a/third_party/breakpad/BUILD.gn b/third_party/breakpad/BUILD.gn
-index 4af3d7bbf..adbf54159 100644
---- a/third_party/breakpad/BUILD.gn
-+++ b/third_party/breakpad/BUILD.gn
-@@ -596,7 +596,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/minidump_file_writer.h",
- "breakpad/src/common/convert_UTF.cc",
- "breakpad/src/common/convert_UTF.h",
-- "breakpad/src/common/linux/breakpad_getcontext.S",
- "breakpad/src/common/linux/elf_core_dump.cc",
- "breakpad/src/common/linux/elf_core_dump.h",
- "breakpad/src/common/linux/elfutils.cc",
-@@ -634,6 +633,14 @@ if (is_linux || is_chromeos || is_android) {
-
- libs = [ "dl" ]
-
-+ if (current_cpu == "ppc64") {
-+ defines = [ "HAVE_GETCONTEXT" ]
-+ } else {
-+ sources += [
-+ "breakpad/src/common/linux/breakpad_getcontext.S"
-+ ]
-+ }
-+
- include_dirs = [
- ".",
- "breakpad/src",
-@@ -682,7 +689,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc",
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
- "breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
-- "breakpad/src/common/linux/breakpad_getcontext_unittest.cc",
- "breakpad/src/common/linux/elf_core_dump_unittest.cc",
- "breakpad/src/common/linux/file_id_unittest.cc",
- "breakpad/src/common/linux/linux_libc_support_unittest.cc",
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-index 07d9171a0..9aed4cb36 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-@@ -44,6 +44,8 @@ typedef MDRawContextARM RawContextCPU;
- typedef MDRawContextARM64_Old RawContextCPU;
- #elif defined(__mips__)
- typedef MDRawContextMIPS RawContextCPU;
-+#elif defined(__powerpc64__)
-+typedef MDRawContextPPC64 RawContextCPU;
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index aae1dc13b..03afec7a5 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -270,7 +270,42 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->float_save.fir = mcontext.fpc_eir;
- #endif
- }
--#endif // __mips__
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t ThreadInfo::GetInstructionPointer() const {
-+ return mcontext.gp_regs[PT_NIP];
-+}
-+
-+void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = mcontext.gp_regs[i];
-+
-+ out->lr = mcontext.gp_regs[PT_LNK];
-+ out->srr0 = mcontext.gp_regs[PT_NIP];
-+ out->srr1 = mcontext.gp_regs[PT_MSR];
-+ out->cr = mcontext.gp_regs[PT_CCR];
-+ out->xer = mcontext.gp_regs[PT_XER];
-+ out->ctr = mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] = \
-+ {(((uint64_t)vregs.vrregs[i][0]) << 32)
-+ | vregs.vrregs[i][1],
-+ (((uint64_t)vregs.vrregs[i][2]) << 32)
-+ | vregs.vrregs[i][3]};
-+
-+ out->vrsave = vregs.vrsave;
-+ out->vector_save.save_vscr = {0, vregs.vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+#endif // __powerpc64__
-
- void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- assert(gp_regs || size);
-@@ -279,6 +314,11 @@ void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- *gp_regs = mcontext.gregs;
- if (size)
- *size = sizeof(mcontext.gregs);
-+#elif defined(__powerpc64__)
-+ if (gp_regs)
-+ *gp_regs = mcontext.gp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.gp_regs);
- #else
- if (gp_regs)
- *gp_regs = ®s;
-@@ -294,6 +334,11 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- *fp_regs = &mcontext.fpregs;
- if (size)
- *size = sizeof(mcontext.fpregs);
-+#elif defined(__powerpc64__)
-+ if (fp_regs)
-+ *fp_regs = &mcontext.fp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.fp_regs);
- #else
- if (fp_regs)
- *fp_regs = &fpregs;
-@@ -302,4 +347,13 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- #endif
- }
-
-+#if defined(__powerpc64__)
-+void ThreadInfo::GetVectorRegisters(void** v_regs, size_t* size) {
-+ if (v_regs)
-+ *v_regs = &vregs;
-+ if (size)
-+ *size = sizeof(vregs);
-+}
-+#endif
-+
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-index fb216fa6d..593aac822 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-@@ -68,6 +68,10 @@ struct ThreadInfo {
- // Use the structures defined in <sys/user.h>
- struct user_regs_struct regs;
- struct user_fpsimd_struct fpregs;
-+#elif defined(__powerpc64__)
-+ // Use the structures defined in <sys/ucontext.h>.
-+ mcontext_t mcontext;
-+ vrregset_t vregs;
- #elif defined(__mips__)
- // Use the structure defined in <sys/ucontext.h>.
- mcontext_t mcontext;
-@@ -84,6 +88,11 @@ struct ThreadInfo {
-
- // Returns the pointer and size of float point register area.
- void GetFloatingPointRegisters(void** fp_regs, size_t* size);
-+
-+#if defined(__powerpc64__)
-+ // Returns the pointer and size of the vector register area. (PPC64 only)
-+ void GetVectorRegisters(void** v_regs, size_t* size);
-+#endif
- };
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 6eec1be24..741983a1a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -254,6 +254,48 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc) {
- out->float_save.fir = uc->uc_mcontext.fpc_eir; // Unused.
- #endif
- }
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
-+}
-+
-+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[PT_NIP];
-+}
-+
-+void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
-+ const vrregset_t* vregs) {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = uc->uc_mcontext.gp_regs[i];
-+
-+ out->lr = uc->uc_mcontext.gp_regs[PT_LNK];
-+ out->srr0 = uc->uc_mcontext.gp_regs[PT_NIP];
-+ out->srr1 = uc->uc_mcontext.gp_regs[PT_MSR];
-+ out->cr = uc->uc_mcontext.gp_regs[PT_CCR];
-+ out->xer = uc->uc_mcontext.gp_regs[PT_XER];
-+ out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] =
-+ {(((uint64_t)vregs->vrregs[i][0]) << 32)
-+ | vregs->vrregs[i][1],
-+ (((uint64_t)vregs->vrregs[i][2]) << 32)
-+ | vregs->vrregs[i][3]};
-+
-+ out->vrsave = vregs->vrsave;
-+ out->vector_save.save_vscr = {0, vregs->vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+
- #endif
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-index 7d4100881..c122ac92e 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-@@ -55,6 +55,9 @@ struct UContextReader {
- #elif defined(__aarch64__)
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- const struct fpsimd_context* fpregs);
-+#elif defined(__powerpc64__)
-+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
-+ const vrregset_t* vregs);
- #else
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc);
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index a6cb5f984..ae16b64d9 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -461,9 +461,16 @@ bool ExceptionHandler::HandleSignal(int /*sig*/, siginfo_t* info, void* uc) {
- memcpy(&g_crash_context_.float_state, fp_ptr,
- sizeof(g_crash_context_.float_state));
- }
-+#elif defined(__powerpc64__)
-+ // On PPC64, we must copy VR state
-+ ucontext_t* uc_ptr = (ucontext_t*)uc;
-+ if (uc_ptr->uc_mcontext.v_regs) {
-+ memcpy(&g_crash_context_.vector_state, uc_ptr->uc_mcontext.v_regs,
-+ sizeof(g_crash_context_.vector_state));
-+ }
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- // FP state is not part of user ABI on ARM Linux.
-- // In case of MIPS Linux FP state is already part of ucontext_t
-+ // In case of MIPS, Linux FP state is already part of ucontext_t
- // and 'float_state' is not a member of CrashContext.
- ucontext_t* uc_ptr = (ucontext_t*)uc;
- if (uc_ptr->uc_mcontext.fpregs) {
-@@ -708,11 +715,19 @@ bool ExceptionHandler::WriteMinidump() {
- }
- #endif
-
--#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__)
-+#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__) \
-+ && !defined(__powerpc64__)
- // FPU state is not part of ARM EABI ucontext_t.
- memcpy(&context.float_state, context.context.uc_mcontext.fpregs,
- sizeof(context.float_state));
- #endif
-+
-+#if defined(__powerpc64__)
-+ // Vector registers must be copied on PPC64
-+ memcpy(&context.vector_state, context.context.uc_mcontext.v_regs,
-+ sizeof(context.vector_state));
-+#endif
-+
- context.tid = sys_gettid();
-
- // Add an exception stream to the minidump for better reporting.
-@@ -733,6 +748,9 @@ bool ExceptionHandler::WriteMinidump() {
- #elif defined(__mips__)
- context.siginfo.si_addr =
- reinterpret_cast<void*>(context.context.uc_mcontext.pc);
-+#elif defined(__powerpc64__)
-+ context.siginfo.si_addr =
-+ reinterpret_cast<void*>(context.context.uc_mcontext.gp_regs[PT_NIP]);
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-index f80843ea7..260dd10f7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-@@ -192,7 +192,11 @@ class ExceptionHandler {
- siginfo_t siginfo;
- pid_t tid; // the crashing thread.
- ucontext_t context;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ // PPC64's FP state is a part of ucontext_t like MIPS but the vector
-+ // state is not, so a struct is needed.
-+ vstate_t vector_state;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- // #ifdef this out because FP state is not part of user ABI for Linux ARM.
- // In case of MIPS Linux FP state is already part of ucontext_t so
- // 'float_state' is not required.
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-index 35dcbfd4d..7934370fd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-@@ -307,7 +307,7 @@ TEST(ExceptionHandlerTest, ParallelChildCrashesDontHang) {
- }
-
- // Wait a while until the child should have crashed.
-- usleep(1000000);
-+ usleep(2000000);
- // Kill the child if it is still running.
- kill(child, SIGKILL);
-
-@@ -559,6 +559,8 @@ const unsigned char kIllegalInstruction[] = {
- #if defined(__mips__)
- // mfc2 zero,Impl - usually illegal in userspace.
- 0x48, 0x00, 0x00, 0x48
-+#elif defined(__powerpc64__)
-+ 0x01, 0x01, 0x01, 0x01 // Crashes on a tested POWER9 cpu
- #else
- // This crashes with SIGILL on x86/x86-64/arm.
- 0xff, 0xff, 0xff, 0xff
-@@ -754,10 +756,10 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
-
- // These are defined here so the parent can use them to check the
- // data from the minidump afterwards.
-- // Use 4k here because the OS will hand out a single page even
-+ // Use the page size here because the OS will hand out a single page even
- // if a smaller size is requested, and this test wants to
- // test the upper bound of the memory range.
-- const uint32_t kMemorySize = 4096; // bytes
-+ const uint32_t kMemorySize = getpagesize(); // bytes
- const int kOffset = kMemorySize - sizeof(kIllegalInstruction);
-
- const pid_t child = fork();
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-index fa3c1713a..6ce709e2f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-@@ -138,7 +138,9 @@ class MicrodumpWriter {
- const MicrodumpExtraInfo& microdump_extra_info,
- LinuxDumper* dumper)
- : ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -337,6 +339,8 @@ class MicrodumpWriter {
- # else
- # error "This mips ABI is currently not supported (n32)"
- #endif
-+#elif defined(__powerpc64__)
-+ const char kArch[] = "ppc64";
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -409,7 +413,9 @@ class MicrodumpWriter {
- void DumpCPUState() {
- RawContextCPU cpu;
- my_memset(&cpu, 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(&cpu, ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(&cpu, ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(&cpu, ucontext_);
-@@ -605,7 +611,9 @@ class MicrodumpWriter {
- void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); }
-
- const ucontext_t* const ucontext_;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_;
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-index 6339ac0cd..291af106b 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-@@ -279,10 +279,19 @@ TEST(MicrodumpWriterTest, BasicWithMappings) {
- CrashAndGetMicrodump(mappings, MicrodumpExtraInfo(), &buf);
- ASSERT_TRUE(ContainsMicrodump(buf));
-
-+ int page_size = getpagesize();
- #ifdef __LP64__
-- ASSERT_NE(std::string::npos,
-- buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-- "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ // This test is only available for the following page sizes
-+ ASSERT_TRUE((page_size == 4096) || (page_size == 65536));
-+ if (page_size == 4096) {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ } else {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000010000 000000000000002A 0000000000010000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ }
- #else
- ASSERT_NE(std::string::npos,
- buf.find("M 00001000 0000002A 00001000 "
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-index 415068983..b93e4afcf 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-@@ -112,6 +112,9 @@ bool LinuxCoreDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-@@ -197,7 +200,10 @@ bool LinuxCoreDumper::EnumerateThreads() {
- memset(&info, 0, sizeof(ThreadInfo));
- info.tgid = status->pr_pgrp;
- info.ppid = status->pr_ppid;
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ for (int i = 0; i < 31; i++)
-+ info.mcontext.gp_regs[i] = status->pr_reg[i];
-+#elif defined(__mips__)
- #if defined(__ANDROID__)
- for (int i = EF_R0; i <= EF_R31; i++)
- info.mcontext.gregs[i - EF_R0] = status->pr_reg[i];
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-index 7fd6532ad..199cbfffd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-@@ -765,7 +765,9 @@ bool LinuxDumper::GetStackInfo(const void** stack, size_t* stack_len,
- reinterpret_cast<uint8_t*>(int_stack_pointer & ~(page_size - 1));
-
- // The number of bytes of stack which we try to capture.
-- static const ptrdiff_t kStackToCapture = 32 * 1024;
-+ // This now depends on page_size to avoid missing data
-+ // on systems with larger page sizes.
-+ static const ptrdiff_t kStackToCapture = 8 * page_size;
-
- const MappingInfo* mapping = FindMapping(stack_pointer);
- if (!mapping)
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-index 7bee160f1..07bb2b81a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-@@ -63,7 +63,8 @@ namespace google_breakpad {
- (defined(__mips__) && _MIPS_SIM == _ABIO32)
- typedef Elf32_auxv_t elf_aux_entry;
- #elif defined(__x86_64) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM != _ABIO32)
-+ (defined(__mips__) && _MIPS_SIM != _ABIO32) || \
-+ defined(__powerpc64__)
- typedef Elf64_auxv_t elf_aux_entry;
- #endif
-
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-index 331f4bb34..3f722947f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-@@ -51,6 +51,8 @@
- #define TID_PTR_REGISTER "rcx"
- #elif defined(__mips__)
- #define TID_PTR_REGISTER "$1"
-+#elif defined(__powerpc64__)
-+#define TID_PTR_REGISTER "r8"
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-index e3ddb81a6..fa28575ef 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-@@ -149,19 +149,27 @@ bool LinuxPtraceDumper::CopyFromProcess(void* dest, pid_t child,
- return true;
- }
-
--bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid)
--{
-+bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid) {
- #ifdef PTRACE_GETREGSET
- struct iovec io;
- info->GetGeneralPurposeRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
- return false;
- }
-
- info->GetFloatingPointRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
- return false;
- }
-+
-+#if defined(__powerpc64__)
-+ // Grab the vector registers on PPC64 too
-+ info->GetVectorRegisters(&io.iov_base, &io.iov_len);
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PPC_VMX, (void*)&io) == -1) {
-+ return false;
-+ }
-+#endif // defined(__powerpc64__)
-+
- return true;
- #else
- return false;
-@@ -298,6 +306,9 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-index da71e15dc..12bfb317a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-@@ -462,6 +462,9 @@ TEST(LinuxPtraceDumperTest, VerifyStackReadWithMultipleThreads) {
- #elif defined(__mips__)
- pid_t* process_tid_location =
- reinterpret_cast<pid_t*>(one_thread.mcontext.gregs[1]);
-+#elif defined(__powerpc64__)
-+ pid_t* process_tid_location =
-+ reinterpret_cast<pid_t*>(one_thread.mcontext.gp_regs[8]);
- #else
- #error This test has not been ported to this platform.
- #endif
-@@ -559,6 +562,8 @@ TEST_F(LinuxPtraceDumperTest, SanitizeStackCopy) {
- uintptr_t heap_addr = thread_info.regs.rcx;
- #elif defined(__mips__)
- uintptr_t heap_addr = thread_info.mcontext.gregs[1];
-+#elif defined(__powerpc64__)
-+ uintptr_t heap_addr = thread_info.mcontext.gp_regs[8];
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-index 32634ef00..2a56948de 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-@@ -136,7 +136,9 @@ class MinidumpWriter {
- : fd_(minidump_fd),
- path_(minidump_path),
- ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -468,7 +470,9 @@ class MinidumpWriter {
- if (!cpu.Allocate())
- return false;
- my_memset(cpu.get(), 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(cpu.get(), ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(cpu.get(), ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(cpu.get(), ucontext_);
-@@ -897,7 +901,7 @@ class MinidumpWriter {
- dirent->location.rva = 0;
- }
-
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || defined(__powerpc64__)
- bool WriteCPUInformation(MDRawSystemInfo* sys_info) {
- char vendor_id[sizeof(sys_info->cpu.x86_cpu_info.vendor_id) + 1] = {0};
- static const char vendor_id_name[] = "vendor_id";
-@@ -917,7 +921,9 @@ class MinidumpWriter {
-
- // processor_architecture should always be set, do this first
- sys_info->processor_architecture =
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ MD_CPU_ARCHITECTURE_PPC64;
-+#elif defined(__mips__)
- # if _MIPS_SIM == _ABIO32
- MD_CPU_ARCHITECTURE_MIPS;
- # elif _MIPS_SIM == _ABI64
-@@ -1333,7 +1339,9 @@ class MinidumpWriter {
- const char* path_; // Path to the file where the minidum should be written.
-
- const ucontext_t* const ucontext_; // also from the signal handler
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_; // ditto
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-index e3b0b16da..ccd8aa0a4 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-@@ -48,6 +48,8 @@ class ExceptionHandler;
-
- #if defined(__aarch64__)
- typedef struct fpsimd_context fpstate_t;
-+#elif defined(__powerpc64__)
-+typedef vrregset_t vstate_t;
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- typedef std::remove_pointer<fpregset_t>::type fpstate_t;
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-index d192e5cbb..fc1bfa8d7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-@@ -715,6 +715,9 @@ TEST(MinidumpWriterTest, InvalidStackPointer) {
- #elif defined(__mips__)
- context.context.uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP] =
- invalid_stack_pointer;
-+#elif defined(__powerpc64__)
-+ context.context.uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP] =
-+ invalid_stack_pointer;
- #else
- # error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-index 99362945c..c54ba7145 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-@@ -65,8 +65,7 @@ bool MemoryMappedFile::Map(const char* path, size_t offset) {
- }
-
- #if defined(__x86_64__) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM == _ABI64)
--
-+ (defined(__mips__) && _MIPS_SIM == _ABI64) || defined(__powerpc64__)
- struct kernel_stat st;
- if (sys_fstat(fd, &st) == -1 || st.st_size < 0) {
- #else
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-index fad59f40c..616496d67 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-@@ -176,9 +176,10 @@ TEST_F(MemoryMappedFileTest, RemapAfterMap) {
- TEST_F(MemoryMappedFileTest, MapWithOffset) {
- // Put more data in the test file this time. Offsets can only be
- // done on page boundaries, so we need a two page file to test this.
-- const int page_size = 4096;
-- char data1[2 * page_size];
-- size_t data1_size = sizeof(data1);
-+ const int page_size = getpagesize();
-+ char *data1 = static_cast<char*>(malloc(2 * page_size));
-+ EXPECT_TRUE(data1 != NULL);
-+ size_t data1_size = (2 * page_size);
- for (size_t i = 0; i < data1_size; ++i) {
- data1[i] = i & 0x7f;
- }
-diff --git a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-index 5803b90d5..2a1cf14f0 100644
---- a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-@@ -57,8 +57,9 @@ TEST(PageAllocatorTest, LargeObject) {
-
- EXPECT_EQ(0U, allocator.pages_allocated());
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(10000));
-+ uint64_t expected_pages = 1 + ((10000 - 1) / getpagesize());
- ASSERT_FALSE(p == NULL);
-- EXPECT_EQ(3U, allocator.pages_allocated());
-+ EXPECT_EQ(expected_pages, allocator.pages_allocated());
- for (unsigned i = 1; i < 10; ++i) {
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(i));
- ASSERT_FALSE(p == NULL);
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-index 798056dfa..22bd81fff 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-@@ -202,12 +202,14 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) {
- // Check architecture and set architecture variable to corresponding flag
- // in objdump.
- switch (context->GetContextCPU()) {
-+#if defined(__i386) || defined(__x86_64)
- case MD_CONTEXT_X86:
- architecture = "i386";
- break;
- case MD_CONTEXT_AMD64:
- architecture = "i386:x86-64";
- break;
-+#endif
- default:
- // Unsupported architecture. Note that ARM architectures are not
- // supported because objdump does not support ARM.
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-index 528ee5f21..72764d6c1 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-@@ -104,6 +104,8 @@ ExploitabilityFor(const string& filename) {
- }
-
- TEST(ExploitabilityTest, TestWindowsEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("ascii_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -136,9 +138,12 @@ TEST(ExploitabilityTest, TestWindowsEngine) {
- ExploitabilityFor("read_av_clobber_write.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_LOW,
- ExploitabilityFor("read_av_conditional.dmp"));
-+#endif
- }
-
- TEST(ExploitabilityTest, TestLinuxEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if defined(__i386) || defined(__x86_64)
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_null_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -171,7 +176,8 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_executable_heap.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_jmp_to_module_not_exe_region.dmp"));
--#ifndef _WIN32
-+#endif
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_write_to_nonwritable_module.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -182,10 +188,10 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_write_to_outside_module_via_math.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_write_to_under_4k.dmp"));
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (!defined(__i386) && !defined(__x86_64))
- }
-
--#ifndef _WIN32
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- TEST(ExploitabilityLinuxUtilsTest, DisassembleBytesTest) {
- ASSERT_FALSE(ExploitabilityLinuxTest::DisassembleBytes("", NULL, 5, NULL));
- uint8_t bytes[6] = {0xc7, 0x0, 0x5, 0x0, 0x0, 0x0};
-@@ -301,6 +307,7 @@ TEST(ExploitabilityLinuxUtilsTest, CalculateAddressTest) {
- context,
- &write_address));
- }
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
-+
-
- } // namespace
-diff --git a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-index aade82c99..195aa73f3 100644
---- a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-+++ b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-@@ -77,6 +77,8 @@
- #define ELF_ARCH EM_MIPS
- #elif defined(__aarch64__)
- #define ELF_ARCH EM_AARCH64
-+#elif defined(__powerpc64__)
-+ #define ELF_ARCH EM_PPC64
- #endif
-
- #if defined(__arm__)
-@@ -87,6 +89,8 @@ typedef user_regs user_regs_struct;
- #elif defined (__mips__)
- // This file-local typedef simplifies the source code.
- typedef gregset_t user_regs_struct;
-+#elif defined(__powerpc64__)
-+typedef struct pt_regs user_regs_struct;
- #endif
-
- using google_breakpad::MDTypeHelper;
-@@ -321,6 +325,9 @@ struct CrashedProcess {
- #endif
- #if defined(__aarch64__)
- user_fpsimd_struct fpregs;
-+#endif
-+#if defined(__powerpc64__)
-+ mcontext_t mcontext;
- #endif
- uintptr_t stack_addr;
- const uint8_t* stack;
-@@ -535,6 +542,38 @@ ParseThreadRegisters(CrashedProcess::Thread* thread,
- thread->mcontext.fpc_eir = rawregs->float_save.fir;
- #endif
- }
-+#elif defined(__powerpc64__)
-+static void
-+ParseThreadRegisters(CrashedProcess::Thread* thread,
-+ const MinidumpMemoryRange& range) {
-+ const MDRawContextPPC64* rawregs = range.GetData<MDRawContextPPC64>(0);
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ thread->mcontext.gp_regs[i] = rawregs->gpr[i];
-+
-+ thread->mcontext.gp_regs[PT_LNK] = rawregs->lr;
-+ thread->mcontext.gp_regs[PT_NIP] = rawregs->srr0;
-+ thread->mcontext.gp_regs[PT_MSR] = rawregs->srr1;
-+ thread->mcontext.gp_regs[PT_CCR] = rawregs->cr;
-+ thread->mcontext.gp_regs[PT_XER] = rawregs->xer;
-+ thread->mcontext.gp_regs[PT_CTR] = rawregs->ctr;
-+ thread->mcontext.v_regs->vrsave = rawregs->vrsave;
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ thread->mcontext.fp_regs[i] = rawregs->float_save.fpregs[i];
-+
-+ thread->mcontext.fp_regs[NFPREG-1] = rawregs->float_save.fpscr;
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++) {
-+ thread->mcontext.v_regs->vrregs[i][0] = rawregs->vector_save.save_vr[i].high >> 32;
-+ thread->mcontext.v_regs->vrregs[i][1] = rawregs->vector_save.save_vr[i].high;
-+ thread->mcontext.v_regs->vrregs[i][2] = rawregs->vector_save.save_vr[i].low >> 32;
-+ thread->mcontext.v_regs->vrregs[i][3] = rawregs->vector_save.save_vr[i].low;
-+ }
-+
-+ thread->mcontext.v_regs->vscr.vscr_word = rawregs->vector_save.save_vscr.low & 0xFFFFFFFF;
-+}
-+
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -623,6 +662,12 @@ ParseSystemInfo(const Options& options, CrashedProcess* crashinfo,
- # else
- # error "This mips ABI is currently not supported (n32)"
- # endif
-+#elif defined(__powerpc64__)
-+ if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_PPC64) {
-+ fprintf(stderr,
-+ "This version of minidump-2-core only supports PPC64.\n");
-+ exit(1);
-+ }
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-diff --git a/third_party/crashpad/crashpad/CONTRIBUTORS b/third_party/crashpad/crashpad/CONTRIBUTORS
-index 8724b7f32..8e29424ef 100644
---- a/third_party/crashpad/crashpad/CONTRIBUTORS
-+++ b/third_party/crashpad/crashpad/CONTRIBUTORS
-@@ -13,3 +13,4 @@ Mark Mentovai <mark@chromium.org>
- Robert Sesek <rsesek@chromium.org>
- Scott Graham <scottmg@chromium.org>
- Joshua Peraza <jperaza@chromium.org>
-+Shawn Anastasio <shawn@anastas.io>
-diff --git a/third_party/crashpad/crashpad/compat/linux/sys/user.h b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-index 6ed77a98e..1fd83469a 100644
---- a/third_party/crashpad/crashpad/compat/linux/sys/user.h
-+++ b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_COMPAT_LINUX_SYS_USER_H_
- #define CRASHPAD_COMPAT_LINUX_SYS_USER_H_
-
-+#include <cstddef>
- #include_next <sys/user.h>
-
- #include <features.h>
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context.h b/third_party/crashpad/crashpad/minidump/minidump_context.h
-index 3a3e603cb..3118d9e9f 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context.h
-@@ -592,6 +592,70 @@ struct MinidumpContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief ppc64-specific flags for MinidumpPPC64::context_flags
-+//! Based on minidump_cpu_ppc64.h from breakpad
-+enum MinidumpContextPPC64Flags : uint32_t {
-+ //! \brief Identifies the context as PPC64.
-+ kMinidumpContextPPC64 = 0x01000000,
-+
-+ //! \brief Indicates the validity of general purpose registers.
-+ //!
-+ //! Registers `r0`-`r31`, `nip`, `msr`, `lr`, etc. are valid.
-+ kMinidumpContextPPC64Base = kMinidumpContextPPC64 | 0x00000001,
-+
-+ //! \brief Indicates the validity of floating point registers.
-+ //!
-+ //! Registers `fp0`-`fp31`, `fpscr` are valid.
-+ kMinidumpContextPPC64Floating = kMinidumpContextPPC64 | 0x00000008,
-+
-+ //! \brief Indicates the validity of Altivec/VMX registers.
-+ //!
-+ //! Registers `v0`-`v31`, `vscr`, `vrsave`.
-+ kMinidumpContextPPC64Vector = kMinidumpContextPPC64 | 0x00000020,
-+
-+ //! \brief Indicates the validity of all registers
-+ kMinidumpContextPPC64All = kMinidumpContextPPC64Base |
-+ kMinidumpContextPPC64Floating |
-+ kMinidumpContextPPC64Vector
-+};
-+
-+//! \brief A PPC64 CPU context carried in a minidump file.
-+//! Based on minidump_cpu_ppc64.h from breakpad.
-+struct MinidumpContextPPC64 {
-+ uint64_t context_flags;
-+
-+ //! \brief General purpose registers.
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+
-+ //! \brief Floating point registers.
-+ double fpregs[32];
-+
-+ //! \brief FPU status register.
-+ double fpscr;
-+
-+ //! \brief Altivec/VMX vector registers.
-+ struct {
-+ //! \brief Vector registers are 128bits.
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad5[4];
-+
-+ //! \brief VRSAVE register.
-+ uint32_t save_vrsave;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad6[7];
-+ } vregs;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-index d7e53a493..d89eb9e01 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-@@ -101,6 +101,13 @@ MinidumpContextWriter::CreateFromSnapshot(const CPUContext* context_snapshot) {
- break;
- }
-
-+ case kCPUArchitecturePPC64: {
-+ context = std::make_unique<MinidumpContextPPC64Writer>();
-+ reinterpret_cast<MinidumpContextPPC64Writer*>(context.get())
-+ ->InitalizeFromSnapshot(context_snapshot->ppc64);
-+ break;
-+ }
-+
- default: {
- LOG(ERROR) << "unknown context architecture "
- << context_snapshot->architecture;
-@@ -453,4 +460,47 @@ size_t MinidumpContextMIPS64Writer::ContextSize() const {
- return sizeof(context_);
- }
-
-+MinidumpContextPPC64Writer::MinidumpContextPPC64Writer()
-+ : MinidumpContextWriter(), context_() {
-+ context_.context_flags = kMinidumpContextPPC64;
-+}
-+
-+MinidumpContextPPC64Writer::~MinidumpContextPPC64Writer() = default;
-+
-+void MinidumpContextPPC64Writer::InitalizeFromSnapshot(
-+ const CPUContextPPC64* context_snapshot) {
-+ DCHECK_EQ(state(), kStateMutable);
-+ DCHECK_EQ(context_.context_flags, kMinidumpContextPPC64);
-+
-+ context_.context_flags = kMinidumpContextPPC64All;
-+
-+ memcpy(context_.regs, context_snapshot->regs, sizeof(context_.regs));
-+ context_.nip = context_snapshot->nip;
-+ context_.msr = context_snapshot->msr;
-+ context_.ccr = context_snapshot->ccr;
-+ context_.xer = context_snapshot->xer;
-+ context_.lnk = context_snapshot->lnk;
-+ context_.ctr = context_snapshot->ctr;
-+
-+ memcpy(context_.fpregs, context_snapshot->fpregs, sizeof(context_.fpregs));
-+ context_.fpscr = context_snapshot->fpscr;
-+
-+ memcpy(context_.vregs.save_vr, context_snapshot->vregs.save_vr,
-+ sizeof(context_.vregs.save_vr));
-+ memcpy(&context_.vregs.save_vscr, &context_snapshot->vregs.save_vscr,
-+ sizeof(context_.vregs.save_vscr));
-+ context_.vregs.save_vrsave = context_snapshot->vregs.save_vrsave;
-+}
-+
-+bool MinidumpContextPPC64Writer::WriteObject(
-+ FileWriterInterface* file_writer) {
-+ DCHECK_EQ(state(), kStateWritable);
-+ return file_writer->Write(&context_, sizeof(context_));
-+}
-+
-+size_t MinidumpContextPPC64Writer::ContextSize() const {
-+ DCHECK_GE(state(), kStateFrozen);
-+ return sizeof(context_);
-+}
-+
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-index d4ab936ee..1d22fc59c 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-@@ -315,6 +315,43 @@ class MinidumpContextMIPS64Writer final : public MinidumpContextWriter {
- MinidumpContextMIPS64 context_;
- };
-
-+class MinidumpContextPPC64Writer final : public MinidumpContextWriter {
-+ public:
-+ MinidumpContextPPC64Writer();
-+ ~MinidumpContextPPC64Writer() override;
-+
-+ //! \brief Initalizes the MinidumpContextPPC64 based on \a context_snapshot.
-+ //!
-+ //! \param[in] context_snapshot The context snapshot to use as source data.
-+ //!
-+ //! \note Valid in #kStateMutable. No mutation of context() may be done before
-+ //! calling this method, and it is not normally necessary to alter
-+ //! context() after calling this method.
-+ void InitalizeFromSnapshot(const CPUContextPPC64* context_snapshot);
-+
-+ //! \brief Returns a pointer to the context structure that this object will
-+ //! write.
-+ //!
-+ //! \attention This returns a non-`const` pointer to this object’s private
-+ //! data so that a caller can populate the context structure directly.
-+ //! This is done because providing setter interfaces to each field in the
-+ //! context structure would be unwieldy and cumbersome. Care must be taken
-+ //! to populate the context structure correctly. The context structure
-+ //! must only be modified while this object is in the #kStateMutable
-+ //! state.
-+ MinidumpContextPPC64* context() { return &context_; }
-+
-+ protected:
-+ // MinidumpWritable:
-+ bool WriteObject(FileWriterInterface* file_writer) override;
-+
-+ // MinidumpContextWriter:
-+ size_t ContextSize() const override;
-+
-+ private:
-+ MinidumpContextPPC64 context_;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_WRITER_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-index 3216a906b..a9fcbe9d8 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-@@ -213,6 +213,21 @@ TEST(MinidumpContextWriter, MIPS64_FromSnapshot) {
- context, ExpectMinidumpContextMIPS64, kSeed);
- }
-
-+TEST(MinidumpContextWriter, PPC64_Zeros) {
-+ EmptyContextTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ ExpectMinidumpContextPPC64);
-+}
-+
-+TEST(MinidumpContextWriter, PPC64_FromSnapshot) {
-+ constexpr uint32_t kSeed = 64;
-+ CPUContextPPC64 context_ppc64;
-+ CPUContext context;
-+ context.ppc64 = &context_ppc64;
-+ InitializeCPUContextPPC64(&context, kSeed);
-+ FromSnapshotTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ context, ExpectMinidumpContextPPC64, kSeed);
-+}
-+
- } // namespace
- } // namespace test
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-index 0974e3ddf..b71ec5880 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-@@ -135,6 +135,8 @@ std::string MinidumpMiscInfoDebugBuildString() {
- static constexpr char kCPU[] = "mips";
- #elif defined(ARCH_CPU_MIPS64EL)
- static constexpr char kCPU[] = "mips64";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kCPU[] = "ppc64";
- #else
- #error define kCPU for this CPU
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/capture_memory.cc b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-index 7a1b2763c..beda8da9e 100644
---- a/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-+++ b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-@@ -112,6 +112,11 @@ void CaptureMemory::PointedToByContext(const CPUContext& context,
- for (size_t i = 0; i < std::size(context.mipsel->regs); ++i) {
- MaybeCaptureMemoryAround(delegate, context.mipsel->regs[i]);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->nip);
-+ for (size_t i = 0; i < std::size(context.ppc64->regs); ++i) {
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->regs[i]);
-+ }
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-index 811a72095..f4f83981d 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-@@ -43,7 +43,10 @@ enum CPUArchitecture {
- kCPUArchitectureMIPSEL,
-
- //! \brief 64-bit MIPSEL.
-- kCPUArchitectureMIPS64EL
-+ kCPUArchitectureMIPS64EL,
-+
-+ //! \brief 64-bit PPC64.
-+ kCPUArchitecturePPC64
- };
-
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.cc b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-index c75b5555e..aeade577a 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-@@ -169,6 +169,8 @@ uint64_t CPUContext::InstructionPointer() const {
- return arm->pc;
- case kCPUArchitectureARM64:
- return arm64->pc;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->nip;
- default:
- NOTREACHED();
- return ~0ull;
-@@ -185,6 +187,8 @@ uint64_t CPUContext::StackPointer() const {
- return arm->sp;
- case kCPUArchitectureARM64:
- return arm64->sp;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->regs[1];
- default:
- NOTREACHED();
- return ~0ull;
-@@ -196,6 +200,7 @@ bool CPUContext::Is64Bit() const {
- case kCPUArchitectureX86_64:
- case kCPUArchitectureARM64:
- case kCPUArchitectureMIPS64EL:
-+ case kCPUArchitecturePPC64:
- return true;
- case kCPUArchitectureX86:
- case kCPUArchitectureARM:
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.h b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-index fb23c4679..eebede63c 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-@@ -352,6 +352,24 @@ struct CPUContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief A context structure carrying PPC64 CPU state.
-+struct CPUContextPPC64 {
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+ double fpregs[32];
-+ double fpscr;
-+ struct {
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+ uint32_t save_vrsave;
-+ } vregs;
-+};
-+
- //! \brief A context structure capable of carrying the context of any supported
- //! CPU architecture.
- struct CPUContext {
-@@ -382,6 +400,7 @@ struct CPUContext {
- CPUContextARM64* arm64;
- CPUContextMIPS* mipsel;
- CPUContextMIPS64* mips64;
-+ CPUContextPPC64* ppc64;
- };
- };
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-index 9f46a4897..aa677c4eb 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
- #define CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
-
-+#include <cstring>
- #include "build/build_config.h"
- #include "snapshot/cpu_context.h"
- #include "snapshot/linux/signal_context.h"
-@@ -174,6 +175,78 @@ void InitializeCPUContextMIPS(
-
- #endif // ARCH_CPU_MIPS_FAMILY || DOXYGEN
-
-+#if defined(ARCH_CPU_PPC64_FAMILY) || DOXYGEN
-+
-+//! \brief Initalizes a CPUContextPPC64 structure from native context
-+//! structures on Linux.
-+//!
-+//! \param[in] thread_context The native thread context.
-+//! \param[in] float_context The native float context.
-+//! \param[in] vector_context The native vector context.
-+//! \param[out] context The CPUContextPPC64 structure to initalize.
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const ThreadContext::t64_t& thread_context,
-+ const FloatContext::f64_t& float_context,
-+ const VectorContext::v64_t& vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.gpr, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.fpregs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const SignalThreadContext64 &thread_context,
-+ const SignalFloatContext64 &float_context,
-+ const SignalVectorContext64 &vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.regs, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.regs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+
-+#endif
-+
- } // namespace internal
- } // namespace crashpad
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-index d32bd1937..2dd538c2b 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-@@ -192,6 +192,8 @@ void TestAgainstTarget(PtraceConnection* connection) {
- device == 0 && inode == 0 && mapping_name == "[vdso]";
- #if defined(ARCH_CPU_X86)
- static constexpr char kPrefix[] = "linux-gate.so.";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kPrefix[] = "linux-vdso64.so.";
- #else
- static constexpr char kPrefix[] = "linux-vdso.so.";
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-index cd40b3b12..6bcf23b6f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-@@ -323,6 +323,69 @@ bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
- reader, context_address, context_.mips64);
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+template <typename Traits>
-+static bool ReadContext(ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address,
-+ typename Traits::CPUContext* dest_context) {
-+ const ProcessMemory* memory = reader->Memory();
-+
-+ LinuxVMAddress gp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, gp_regs);
-+
-+ typename Traits::SignalThreadContext thread_context;
-+ if (!memory->Read(gp_regs_address, sizeof(thread_context), &thread_context)) {
-+ LOG(ERROR) << "Couldn't read gp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress fp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, fp_regs);
-+
-+ typename Traits::SignalFloatContext fp_context;
-+ if (!memory->Read(fp_regs_address, sizeof(fp_context), &fp_context)) {
-+ LOG(ERROR) << "Couldn't read fp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress v_regs_ptr_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, vmx_reserve) + 8;
-+
-+ typename Traits::SignalVectorContext v_context;
-+ if (!memory->Read(v_regs_ptr_address, sizeof(v_context), &v_context)) {
-+ LOG(ERROR) << "Couldn't read v_regs!";
-+ return false;
-+ }
-+
-+ InitializeCPUContextPPC64<ContextTraits64>(thread_context, fp_context,
-+ v_context, dest_context);
-+
-+ return true;
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+
-+ return internal::ReadContext<ContextTraits64>(
-+ reader, context_address, context_.ppc64);
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits32>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ // PPC64 is 64-bit
-+ return false;
-+}
-+
- #endif // ARCH_CPU_X86_FAMILY
-
- bool ExceptionSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-index ea0cd2106..e42df520f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-@@ -84,6 +84,8 @@ class ExceptionSnapshotLinux final : public ExceptionSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #endif
- } context_union_;
- CPUContext context_;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-index c17170b43..b6a714cc6 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-@@ -296,7 +296,28 @@ void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
- 0);
- #undef CPU_ARCH_NAME
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+using NativeCPUContext = ucontext_t;
-+
-+void InitializeContext(NativeCPUContext* context) {
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ context->uc_mcontext.gp_regs[reg] = reg;
-+ }
-+
-+ memset(&context->uc_mcontext.fp_regs, 44,
-+ sizeof(context->uc_mcontext.fp_regs));
-+}
-
-+void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
-+ EXPECT_EQ(actual.architecture, kCPUArchitecturePPC64);
-+
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ EXPECT_EQ(actual.ppc64->regs[reg], expected.uc_mcontext.gp_regs[reg]);
-+ }
-+
-+ EXPECT_EQ(memcmp(actual.ppc64->fpregs, expected.uc_mcontext.fp_regs,
-+ sizeof(actual.ppc64->fpregs)), 0);
-+}
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-index ee246e8bc..9555dce04 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-@@ -108,6 +108,8 @@ void ProcessReaderLinux::Thread::InitializeStack(ProcessReaderLinux* reader) {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- stack_pointer = reader->Is64Bit() ? thread_info.thread_context.t64.regs[29]
- : thread_info.thread_context.t32.regs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ stack_pointer = thread_info.thread_context.t64.gpr[1];
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 110024680..a1f2da259 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -422,6 +422,89 @@ static_assert(offsetof(UContext<ContextTraits64>, mcontext.fpregs) ==
- "context offset mismatch");
- #endif
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+struct SignalThreadContext64 {
-+ uint64_t regs[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_r3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
-+ uint64_t dscr;
-+ uint64_t fpr0[3];
-+};
-+
-+struct SignalFloatContext64 {
-+ double regs[32];
-+ double fpscr;
-+};
-+
-+struct SignalVectorContext64 {
-+ int32_t vrregs[32][4];
-+ struct {
-+ int32_t __pad[3];
-+ int32_t vscr_word;
-+ } vscr;
-+ int32_t vrsave;
-+ int32_t __pad[3];
-+} __attribute__((__aligned__(16)));
-+
-+
-+#pragma pack(pop)
-+struct MContext64 {
-+ uint64_t reserved[4];
-+ int32_t signal;
-+ int32_t __pad0;
-+ uint64_t handler;
-+ uint64_t oldmask;
-+ uint64_t pt_regs_ptr;
-+ SignalThreadContext64 gp_regs;
-+ SignalFloatContext64 fp_regs;
-+ SignalVectorContext64 *v_regs;
-+ int64_t vmx_reserve[69];
-+};
-+
-+struct ContextTraits64 : public Traits64 {
-+ using MContext = MContext64;
-+ using SignalThreadContext = SignalThreadContext64;
-+ using SignalFloatContext = SignalFloatContext64;
-+ using SignalVectorContext = SignalVectorContext64;
-+ using CPUContext = CPUContextPPC64;
-+};
-+
-+struct ContextTraits32 : public Traits32 {};
-+
-+struct UContext {
-+ uint64_t flags;
-+ uint64_t link;
-+ SignalStack<ContextTraits64> stack;
-+ Sigset<ContextTraits64> sigmask;
-+ MContext64 mcontext;
-+};
-+#pragma pack(push, 1)
-+
-+static_assert(sizeof(UContext) == sizeof(ucontext_t),
-+ "ucontext_t size mismatch");
-+static_assert(sizeof(MContext64) == sizeof(mcontext_t),
-+ "mcontext_t size mismatch");
-+static_assert(sizeof(SignalThreadContext64) == sizeof(gregset_t),
-+ "gregset_t size mismatch");
-+static_assert(sizeof(SignalFloatContext64) == sizeof(fpregset_t),
-+ "fpregset_t size mismatch");
-+static_assert(sizeof(SignalVectorContext64) == sizeof(vrregset_t),
-+ "vrregset_t size mismatch");
-+static_assert(offsetof(UContext, mcontext) ==
-+ offsetof(ucontext_t, uc_mcontext), "mcontext offset mismatch");
-+static_assert(offsetof(MContext64, gp_regs) ==
-+ offsetof(mcontext_t, gp_regs), "gp_regs offset mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-index a99da3e4b..03b973083 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-@@ -204,6 +204,8 @@ CPUArchitecture SystemSnapshotLinux::GetCPUArchitecture() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return process_reader_->Is64Bit() ? kCPUArchitectureMIPS64EL
- : kCPUArchitectureMIPSEL;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return kCPUArchitecturePPC64;
- #else
- #error port to your architecture
- #endif
-@@ -219,6 +221,9 @@ uint32_t SystemSnapshotLinux::CPURevision() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return 0;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return 0;
- #else
- #error port to your architecture
- #endif
-@@ -239,6 +244,9 @@ std::string SystemSnapshotLinux::CPUVendor() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return std::string();
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return std::string();
- #else
- #error port to your architecture
- #endif
-@@ -372,6 +380,9 @@ bool SystemSnapshotLinux::NXEnabled() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return false;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return false;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-index b2450c206..7ba78b2ae 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-@@ -110,6 +110,8 @@ bool WriteTestModule(const base::FilePath& module_path,
- module.ehdr.e_machine = EM_AARCH64;
- #elif defined(ARCH_CPU_MIPSEL) || defined(ARCH_CPU_MIPS64EL)
- module.ehdr.e_machine = EM_MIPS;
-+#elif defined(ARCH_CPU_PPC64)
-+ module.ehdr.e_machine = EM_PPC64;
- #endif
-
- module.ehdr.e_version = EV_CURRENT;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-index e3e2bebdd..8ef43752e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-@@ -186,6 +186,14 @@ bool ThreadSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
- thread.thread_info.float_context.f32,
- context_.mipsel);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+ InitializeCPUContextPPC64<ContextTraits64>(
-+ thread.thread_info.thread_context.t64,
-+ thread.thread_info.float_context.f64,
-+ thread.thread_info.vector_context.v64,
-+ context_.ppc64);
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-index 44cc6f6d9..d4136461e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-@@ -68,6 +68,8 @@ class ThreadSnapshotLinux final : public ThreadSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
---- a/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-+++ b/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-@@ -236,6 +236,12 @@
- #elif defined(ARCH_CPU_BIG_ENDIAN)
- static constexpr char arch[] = "aarch64_be";
- #endif
-+#elif defined(__powerpc64__)
-+#if defined(ARCH_CPU_LITTLE_ENDIAN)
-+ static constexpr char arch[] = "ppc64le";
-+#elif defined(ARCH_CPU_BIG_ENDIAN)
-+ static constexpr char arch[] = "ppc64";
-+#endif
- #else
- #error Port
- #endif
-diff --git a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-index d3d5ebdfb..3fd730cb5 100644
---- a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-+++ b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-@@ -56,6 +56,11 @@ bool AuxiliaryVector::Read(PtraceConnection* connection) {
- if (type == AT_IGNORE) {
- continue;
- }
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ if (type == AT_IGNOREPPC) {
-+ continue;
-+ }
-+#endif
- if (!MapInsertOrReplace(&values_, type, value, nullptr)) {
- LOG(ERROR) << "duplicate auxv entry";
- return false;
-diff --git a/third_party/crashpad/crashpad/util/linux/ptracer.cc b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-index 557e0d363..08ae434b8 100644
---- a/third_party/crashpad/crashpad/util/linux/ptracer.cc
-+++ b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-@@ -398,6 +398,64 @@ bool GetThreadArea64(pid_t tid,
- return true;
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+// PPC64 has had HAVE_ARCH_TRACEHOOK set since 2.6.27 (even before x86 had it).
-+// That means we can simply use PTRACE_GETREGESET.
-+
-+template <typename Destination>
-+bool GetRegisterSet(pid_t tid, int set, Destination* dest, bool can_log) {
-+ iovec iov;
-+ iov.iov_base = reinterpret_cast<void*>(dest);
-+ iov.iov_len = sizeof(*dest);
-+ if (ptrace(PTRACE_GETREGSET, tid, reinterpret_cast<void*>(set), &iov) != 0) {
-+ PLOG_IF(ERROR, can_log) << "ptrace";
-+ return false;
-+ }
-+ if (iov.iov_len != sizeof(*dest)) {
-+ LOG_IF(ERROR, can_log) << "Unexpected registers size";
-+ return false;
-+ }
-+ return true;
-+}
-+
-+bool GetVectorRegisters64(pid_t tid,
-+ VectorContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PPC_VMX, &context->v64, can_log);
-+}
-+
-+bool GetFloatingPointRegisters64(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PRFPREG, &context->f64, can_log);
-+}
-+
-+bool GetThreadArea64(pid_t tid,
-+ const ThreadContext& context,
-+ LinuxVMAddress* address,
-+ bool can_log) {
-+ // PPC64 doesn't have PTRACE_GET_THREAD_AREA since the thread pointer
-+ // is stored in GPR 13.
-+ ThreadContext::t64_t tc;
-+ if (!GetRegisterSet(tid, NT_PRSTATUS, &tc, can_log)) {
-+ LOG_IF(ERROR, can_log) << "Unable to get thread pointer!";
-+ return false;
-+ }
-+
-+ *address = tc.gpr[13];
-+
-+ return true;
-+}
-+
-+// Stubs for 32-bit functions not applicable on PPC64
-+bool GetFloatingPointRegisters32(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) { return false; }
-+bool GetThreadArea32(pid_t tid,
-+ const ThreadContext &context,
-+ LinuxVMAddress *address,
-+ bool can_log) { return false; }
-+
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -494,6 +552,9 @@ bool Ptracer::GetThreadInfo(pid_t tid, ThreadInfo* info) {
- if (is_64_bit_) {
- return GetGeneralPurposeRegisters64(tid, &info->thread_context, can_log_) &&
- GetFloatingPointRegisters64(tid, &info->float_context, can_log_) &&
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ GetVectorRegisters64(tid, &info->vector_context, can_log_) &&
-+#endif
- GetThreadArea64(tid,
- info->thread_context,
- &info->thread_specific_data_address,
-diff --git a/third_party/crashpad/crashpad/util/linux/thread_info.h b/third_party/crashpad/crashpad/util/linux/thread_info.h
-index 5b55c24a7..dea0d1f39 100644
---- a/third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ b/third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -28,6 +28,10 @@
- #include <android/api-level.h>
- #endif
-
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+#include <sys/ucontext.h>
-+#endif
-+
- namespace crashpad {
-
- //! \brief The set of general purpose registers for an architecture family.
-@@ -79,6 +83,8 @@ union ThreadContext {
- uint32_t cp0_status;
- uint32_t cp0_cause;
- uint32_t padding1_;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // PPC64 is 64-bit
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -132,6 +138,21 @@ union ThreadContext {
- uint64_t cp0_badvaddr;
- uint64_t cp0_status;
- uint64_t cp0_cause;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects struct pt_regs in asm/ptrace.h.
-+ uint64_t gpr[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_gpr3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -143,6 +164,8 @@ union ThreadContext {
- using NativeThreadContext = user_regs;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate NativeThreadsContext type available for MIPS
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ using NativeThreadContext = struct pt_regs;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY || ARCH_CPU_ARM64
-@@ -218,6 +241,9 @@ union FloatContext {
- } fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Crashpad's PPC support is 64-bit only, so this
-+ // 32bit-only struct is declared as empty.
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -252,6 +278,10 @@ union FloatContext {
- double fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects fpregset_t in sys/ucontext.h
-+ double fpregs[32];
-+ double fpscr;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -280,6 +310,8 @@ union FloatContext {
- static_assert(sizeof(f64) == sizeof(user_fpsimd_struct), "Size mismatch");
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate floating point context native type for available MIPS.
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ static_assert(sizeof(f64) == sizeof(fpregset_t), "Size mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86
-@@ -287,6 +319,26 @@ union FloatContext {
- static_assert(std::is_standard_layout<FloatContext>::value,
- "Not standard layout");
-
-+//! \brief The vector registers used for an architecture family
-+union VectorContext {
-+ struct v32_t {} v32;
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ __attribute__((__aligned__(16))) // Vector context must be doubleword aligned.
-+#endif
-+ struct v64_t {
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects vrregset_t in sys/ucontext.h
-+ uint32_t vrregs[32][4];
-+ struct {
-+ uint32_t __pad[3];
-+ uint32_t vscr_word;
-+ } vscr;
-+ uint32_t vrsave;
-+ uint32_t __pad[3];
-+#endif
-+ } v64;
-+};
-+
- //! \brief A collection of `ptrace`-able information about a thread.
- struct ThreadInfo {
- ThreadInfo();
-@@ -298,6 +350,9 @@ struct ThreadInfo {
- //! \brief The floating point registers for the thread.
- FloatContext float_context;
-
-+ //! \brief (Optional) The vector registers used for the thread.
-+ VectorContext vector_context;
-+
- //! \brief The thread-local storage address for the thread.
- LinuxVMAddress thread_specific_data_address;
- };
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context.h b/third_party/crashpad/crashpad/util/misc/capture_context.h
-index d21a24f19..acc325349 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context.h
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context.h
-@@ -69,6 +69,7 @@ using NativeCPUContext = ucontext_t;
- //! macOS/Linux/Fuchsia | x86_64 | `%%rdi`
- //! Linux | ARM/ARM64 | `r0`/`x0`
- //! Linux | MIPS/MIPS64 | `$a0`
-+//! Linux | PPC64 | `r3`
- //!
- //! Additionally, the value `LR` on ARM/ARM64 will be the return address of
- //! this function.
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-index 52215ee5d..b3e4a3ec7 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-@@ -32,7 +32,7 @@
- .balign 4, 0x0
- .type CAPTURECONTEXT_SYMBOL, %function
- .type CAPTURECONTEXT_SYMBOL2, %function
--#elif defined(__mips__)
-+#elif defined(__mips__) || defined(__powerpc64__)
- .balign 4, 0x0
- #endif
-
-@@ -423,4 +423,214 @@ CAPTURECONTEXT_SYMBOL2:
- jr $ra
-
- .set at
-+#elif defined(__powerpc64__)
-+ // Store r0-r31
-+ std 0, 0xe8(3) // context->uc_mcontext.gp_regs[0]
-+ std 1, 0xf0(3) // context->uc_mcontext.gp_regs[1]
-+ std 2, 0xf8(3) // context->uc_mcontext.gp_regs[2]
-+ // note that r3's original value was lost
-+ std 3, 0x100(3) // context->uc_mcontext.gp_regs[3]
-+ std 4, 0x108(3) // context->uc_mcontext.gp_regs[4]
-+ std 5, 0x110(3) // context->uc_mcontext.gp_regs[5]
-+ std 6, 0x118(3) // context->uc_mcontext.gp_regs[6]
-+ std 7, 0x120(3) // context->uc_mcontext.gp_regs[7]
-+ std 8, 0x128(3) // context->uc_mcontext.gp_regs[8]
-+ std 9, 0x130(3) // context->uc_mcontext.gp_regs[9]
-+ std 10, 0x138(3) // context->uc_mcontext.gp_regs[10]
-+ std 11, 0x140(3) // context->uc_mcontext.gp_regs[11]
-+ std 12, 0x148(3) // context->uc_mcontext.gp_regs[12]
-+ std 13, 0x150(3) // context->uc_mcontext.gp_regs[13]
-+ std 14, 0x158(3) // context->uc_mcontext.gp_regs[14]
-+ std 15, 0x160(3) // context->uc_mcontext.gp_regs[15]
-+ std 16, 0x168(3) // context->uc_mcontext.gp_regs[16]
-+ std 17, 0x170(3) // context->uc_mcontext.gp_regs[17]
-+ std 18, 0x178(3) // context->uc_mcontext.gp_regs[18]
-+ std 19, 0x180(3) // context->uc_mcontext.gp_regs[19]
-+ std 20, 0x188(3) // context->uc_mcontext.gp_regs[20]
-+ std 21, 0x190(3) // context->uc_mcontext.gp_regs[21]
-+ std 22, 0x198(3) // context->uc_mcontext.gp_regs[22]
-+ std 23, 0x1a0(3) // context->uc_mcontext.gp_regs[23]
-+ std 24, 0x1a8(3) // context->uc_mcontext.gp_regs[24]
-+ std 25, 0x1b0(3) // context->uc_mcontext.gp_regs[25]
-+ std 26, 0x1b8(3) // context->uc_mcontext.gp_regs[26]
-+ std 27, 0x1c0(3) // context->uc_mcontext.gp_regs[27]
-+ std 28, 0x1c8(3) // context->uc_mcontext.gp_regs[28]
-+ std 29, 0x1d0(3) // context->uc_mcontext.gp_regs[29]
-+ std 30, 0x1d8(3) // context->uc_mcontext.gp_regs[30]
-+ std 31, 0x1e0(3) // context->uc_mcontext.gp_regs[31]
-+
-+ // For NIP, we can use the value in the link register
-+ mflr 0
-+ std 0, 0x1e8(3) // context->uc_mcontext.gp_regs[PT_NIP]
-+
-+ // CTR
-+ mfctr 0
-+ std 0, 0x200(3) // context->uc_mcontext.gp_regs[PT_CTR]
-+
-+ // For LNK, we'll use the caller's LR save area (2 stack frames up).
-+ // r4 can be used as a scratch register since it has already been saved.
-+ ld 4, 0(1)
-+ ld 4, 16(4)
-+ std 4, 0x208(3) // context->uc_mcontext.gp_regs[PT_LNK]
-+
-+ // XER
-+ mfxer 0
-+ std 0, 0x210(3) // context->uc_mcontext.gp_regs[PT_XER]
-+
-+ // CCR
-+ mfcr 0
-+ std 0, 0x218(3) // context->uc_mcontext.gp_regs[PT_CCR]
-+
-+ // MSR, orig_r3, MQ, TRAP, DAR, DSISR, RESULT, DSCR,
-+ // not used or not relevant, zero them out.
-+ li 4, 0
-+ std 4, 0x1f0(3) // context->uc_mcontext.gp_regs[PT_MSR]
-+ std 4, 0x1f8(3) // context->uc_mcontext.gp_regs[PT_ORIG_R3]
-+ std 4, 0x220(3) // context->uc_mcontext.gp_regs[PT_MQ]
-+ std 4, 0x228(3) // context->uc_mcontext.gp_regs[PT_TRAP]
-+ std 4, 0x230(3) // context->uc_mcontext.gp_regs[PT_DAR]
-+ std 4, 0x238(3) // context->uc_mcontext.gp_regs[PT_DSISR]
-+ std 4, 0x240(3) // context->uc_mcontext.gp_regs[PT_RESULT]
-+ std 4, 0x248(3) // context->uc_mcontext.gp_regs[PT_DSCR]
-+
-+ // Update context->uc_mcontext.regs to point to gp_regs
-+ addi 0, 3, 0xe8
-+ std 0, 0xe0(3)
-+
-+ // Save floating point registers 0-31
-+ stfd 0, 0x268(3) // context->uc_mcontext.fp_regs[0]
-+ stfd 1, 0x270(3) // context->uc_mcontext.fp_regs[1]
-+ stfd 2, 0x278(3) // context->uc_mcontext.fp_regs[2]
-+ stfd 3, 0x280(3) // context->uc_mcontext.fp_regs[3]
-+ stfd 4, 0x288(3) // context->uc_mcontext.fp_regs[4]
-+ stfd 5, 0x290(3) // context->uc_mcontext.fp_regs[5]
-+ stfd 6, 0x298(3) // context->uc_mcontext.fp_regs[6]
-+ stfd 7, 0x2a0(3) // context->uc_mcontext.fp_regs[7]
-+ stfd 8, 0x2a8(3) // context->uc_mcontext.fp_regs[8]
-+ stfd 9, 0x2b0(3) // context->uc_mcontext.fp_regs[9]
-+ stfd 10, 0x2b8(3) // context->uc_mcontext.fp_regs[10]
-+ stfd 11, 0x2c0(3) // context->uc_mcontext.fp_regs[11]
-+ stfd 12, 0x2c8(3) // context->uc_mcontext.fp_regs[12]
-+ stfd 13, 0x2d0(3) // context->uc_mcontext.fp_regs[13]
-+ stfd 14, 0x2d8(3) // context->uc_mcontext.fp_regs[14]
-+ stfd 15, 0x2e0(3) // context->uc_mcontext.fp_regs[15]
-+ stfd 16, 0x2e8(3) // context->uc_mcontext.fp_regs[16]
-+ stfd 17, 0x2f0(3) // context->uc_mcontext.fp_regs[17]
-+ stfd 18, 0x2f8(3) // context->uc_mcontext.fp_regs[18]
-+ stfd 19, 0x300(3) // context->uc_mcontext.fp_regs[19]
-+ stfd 20, 0x308(3) // context->uc_mcontext.fp_regs[20]
-+ stfd 21, 0x310(3) // context->uc_mcontext.fp_regs[21]
-+ stfd 22, 0x318(3) // context->uc_mcontext.fp_regs[22]
-+ stfd 23, 0x320(3) // context->uc_mcontext.fp_regs[23]
-+ stfd 24, 0x328(3) // context->uc_mcontext.fp_regs[24]
-+ stfd 25, 0x330(3) // context->uc_mcontext.fp_regs[25]
-+ stfd 26, 0x338(3) // context->uc_mcontext.fp_regs[26]
-+ stfd 27, 0x340(3) // context->uc_mcontext.fp_regs[27]
-+ stfd 28, 0x348(3) // context->uc_mcontext.fp_regs[28]
-+ stfd 29, 0x350(3) // context->uc_mcontext.fp_regs[29]
-+ stfd 30, 0x358(3) // context->uc_mcontext.fp_regs[30]
-+ stfd 31, 0x360(3) // context->uc_mcontext.fp_regs[31]
-+
-+ // FPSCR
-+ mffs 0
-+ stfd 0, 0x368(3) // context->uc_mcontext.fp_regs[32]
-+
-+ // Save VMX Vector registers
-+ // Update r4 to contain the base address of vmx_reserve
-+ addi 4, 3, 0x378
-+ // Ensure that it is quadword aligned
-+ andi. 5, 4, 0xF
-+ beq 1f // No alignment is necessary
-+ // Address is doubleword aligned and not quadword aligned, add 8
-+ addi 4, 4, 8
-+
-+1:
-+ // Store VMX registers 0-31
-+ // r4 will contain the base address
-+ // r5 will contain the index
-+ li 5, 0
-+ stvx 0, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 0]
-+ addi 5, 5, 16
-+ stvx 1, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 1]
-+ addi 5, 5, 16
-+ stvx 2, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 2]
-+ addi 5, 5, 16
-+ stvx 3, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 3]
-+ addi 5, 5, 16
-+ stvx 4, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 4]
-+ addi 5, 5, 16
-+ stvx 5, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 5]
-+ addi 5, 5, 16
-+ stvx 6, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 6]
-+ addi 5, 5, 16
-+ stvx 7, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 7]
-+ addi 5, 5, 16
-+ stvx 8, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 8]
-+ addi 5, 5, 16
-+ stvx 9, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 9]
-+ addi 5, 5, 16
-+ stvx 10, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 10]
-+ addi 5, 5, 16
-+ stvx 11, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 11]
-+ addi 5, 5, 16
-+ stvx 12, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 12]
-+ addi 5, 5, 16
-+ stvx 13, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 13]
-+ addi 5, 5, 16
-+ stvx 14, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 14]
-+ addi 5, 5, 16
-+ stvx 15, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 15]
-+ addi 5, 5, 16
-+ stvx 16, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 16]
-+ addi 5, 5, 16
-+ stvx 17, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 17]
-+ addi 5, 5, 16
-+ stvx 18, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 18]
-+ addi 5, 5, 16
-+ stvx 19, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 19]
-+ addi 5, 5, 16
-+ stvx 20, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 20]
-+ addi 5, 5, 16
-+ stvx 21, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 21]
-+ addi 5, 5, 16
-+ stvx 22, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 22]
-+ addi 5, 5, 16
-+ stvx 23, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 23]
-+ addi 5, 5, 16
-+ stvx 24, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 24]
-+ addi 5, 5, 16
-+ stvx 25, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 25]
-+ addi 5, 5, 16
-+ stvx 26, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 26]
-+ addi 5, 5, 16
-+ stvx 27, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 27]
-+ addi 5, 5, 16
-+ stvx 28, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 28]
-+ addi 5, 5, 16
-+ stvx 29, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 29]
-+ addi 5, 5, 16
-+ stvx 30, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 30]
-+ addi 5, 5, 16
-+ stvx 31, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 31]
-+ addi 5, 5, 16
-+
-+ // VSCR
-+ mfvscr 0
-+ stvx 0, 4, 5
-+ addi 5, 5, 16
-+
-+ // VRSAVE
-+ mfvrsave 0
-+ stwx 0, 4, 5
-+
-+ // Update context->uc_mcontext.v_regs to point to vmx_reserve + alignment.
-+ std 4, 0x370(3)
-+
-+ // Zero out all unused fields
-+ li 4, 0
-+ std 4, 0xc8(3) // context->uc_mcontext.signal
-+ std 4, 0xd0(3) // context->uc_mcontext.handler
-+ std 4, 0xd8(3) // context->uc_mcontext.oldmask
-+
-+ blr
- #endif // __i386__
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-index cf23c2def..5f264bc92 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-@@ -57,7 +57,7 @@ void TestCaptureContext() {
- uintptr_t pc = ProgramCounterFromContext(context_1);
-
- #if !defined(ADDRESS_SANITIZER) && !defined(ARCH_CPU_MIPS_FAMILY) && \
-- !defined(MEMORY_SANITIZER)
-+ !defined(MEMORY_SANITIZER) && !defined(ARCH_CPU_PPC64_FAMILY)
- // Sanitizers can cause enough code bloat that the “nearby” check would
- // likely fail.
- const uintptr_t kReferencePC =
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-index 30a2ab21d..60509f21d 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-@@ -35,6 +35,8 @@ void SanityCheckContext(const NativeCPUContext& context) {
- EXPECT_EQ(context.uc_mcontext.regs[0], FromPointerCast<uintptr_t>(&context));
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- EXPECT_EQ(context.uc_mcontext.gregs[4], FromPointerCast<uintptr_t>(&context));
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ EXPECT_EQ(context.uc_mcontext.gp_regs[3], FromPointerCast<uintptr_t>(&context));
- #endif
- }
-
-@@ -49,6 +51,8 @@ uintptr_t ProgramCounterFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.pc;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.pc;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[PT_NIP];
- #endif
- }
-
-@@ -63,6 +67,8 @@ uintptr_t StackPointerFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.sp;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.gregs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[1];
- #endif
- }
-
-diff --git a/third_party/dav1d/config/linux/ppc64/config.h b/third_party/dav1d/config/linux/ppc64/config.h
-new file mode 100644
-index 000000000..9fbbf75cc
---- /dev/null
-+++ b/third_party/dav1d/config/linux/ppc64/config.h
-@@ -0,0 +1,39 @@
-+/*
-+ * Autogenerated by the Meson build system.
-+ * Do not edit, your changes will be lost.
-+ */
-+
-+#pragma once
-+
-+#define ARCH_AARCH64 0
-+
-+#define ARCH_ARM 0
-+
-+#define ARCH_PPC64LE 1
-+
-+#define ARCH_X86 0
-+
-+#define ARCH_X86_32 0
-+
-+#define ARCH_X86_64 0
-+
-+#define CONFIG_16BPC 1
-+
-+#define CONFIG_8BPC 1
-+
-+// #define CONFIG_LOG 1 -- Logging is controlled by Chromium
-+
-+#define ENDIANNESS_BIG 0
-+
-+#define HAVE_ASM 1
-+
-+#define HAVE_CLOCK_GETTIME 1
-+
-+#define HAVE_DLSYM 1
-+
-+#define HAVE_GETAUXVAL 1
-+
-+#define HAVE_POSIX_MEMALIGN 1
-+
-+#define HAVE_UNISTD_H 1
-+
-diff --git a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-index 0b4bd72f0..a0caa5e71 100644
---- a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-+++ b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-@@ -51,4 +51,19 @@
- #define u16l_to_i32(v) ((i32x4) vec_mergel((u16x8) v, vec_splat_u16(0)))
- #define i16l_to_i32(v) ((i32x4) vec_unpackl((i16x8)v))
-
-+#if defined(__clang__)
-+#undef vec_splats
-+#define vec_splats(N) \
-+ _Generic((N), \
-+ unsigned char: ((u8x16)(N)), \
-+ signed char: ((i8x16)(N)), \
-+ unsigned short: ((u16x8)(N)), \
-+ signed short: ((i16x8)(N)), \
-+ unsigned int: ((u32x4)(N)), \
-+ signed int: ((i32x4)(N)), \
-+ unsigned long long: ((u64x2)(N)), \
-+ signed long long: ((i64x2)(N)) \
-+ )
-+#endif
-+
- #endif /* DAV1D_SRC_PPC_TYPES_H */
-diff --git a/third_party/eigen3/BUILD.gn b/third_party/eigen3/BUILD.gn
-index 0d4e184..f2ce484 100644
---- a/third_party/eigen3/BUILD.gn
-+++ b/third_party/eigen3/BUILD.gn
-@@ -22,4 +22,8 @@ config("eigen_includes") {
- # for this component on Windows on Arm due to compilation errors.
- defines += [ "EIGEN_DONT_VECTORIZE" ]
- }
-+
-+ if (target_cpu == "ppc64") {
-+ defines += [ "EIGEN_DONT_VECTORIZE" ]
-+ }
- }
-
-diff --git a/third_party/libaom/BUILD.gn b/third_party/libaom/BUILD.gn
-index 9b065bd..df3af02 100644
---- a/third_party/libaom/BUILD.gn
-+++ b/third_party/libaom/BUILD.gn
-@@ -40,6 +40,8 @@
- cpu_arch_full = "generic"
- } else if (current_cpu == "loong64") {
- cpu_arch_full = "generic"
-+} else if (current_cpu == "ppc64") {
-+ cpu_arch_full = "generic"
- } else {
- cpu_arch_full = current_cpu
- }
-diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h
-index e4ac22644..1c57015db 100644
---- a/third_party/lss/linux_syscall_support.h
-+++ b/third_party/lss/linux_syscall_support.h
-@@ -3947,7 +3947,7 @@ struct kernel_statfs {
- LSS_REG(2, buf);
- LSS_BODY(void*, mmap2, "0"(__r2));
- }
--#else
-+#elif !defined(__powerpc64__) /* ppc64 doesn't have mmap2 */
- #define __NR__mmap2 __NR_mmap2
- LSS_INLINE _syscall6(void*, _mmap2, void*, s,
- size_t, l, int, p,
-@@ -4058,7 +4058,7 @@ struct kernel_statfs {
- #if defined(__i386__) || \
- defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \
- (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \
-- defined(__PPC__) || \
-+ (defined(__PPC__) && !defined(__powerpc64__)) || \
- (defined(__s390__) && !defined(__s390x__))
- /* On these architectures, implement mmap() with mmap2(). */
- LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d,
-@@ -4872,11 +4872,11 @@ struct kernel_statx {
- LSS_SC_BODY(4, int, 8, d, type, protocol, sv);
- }
- #endif
-- #if defined(__NR_recvmsg)
-+ #if defined(__NR_recvmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, recvmsg, int, s, struct kernel_msghdr*, msg,
- int, flags)
- #endif
-- #if defined(__NR_sendmsg)
-+ #if defined(__NR_sendmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, sendmsg, int, s, const struct kernel_msghdr*,
- msg, int, flags)
- #endif
-@@ -4885,13 +4885,13 @@ struct kernel_statx {
- int, flags, const struct kernel_sockaddr*, to,
- unsigned int, tolen)
- #endif
-- #if defined(__NR_shutdown)
-+ #if defined(__NR_shutdown) && !defined(__PPC__)
- LSS_INLINE _syscall2(int, shutdown, int, s, int, how)
- #endif
-- #if defined(__NR_socket)
-+ #if defined(__NR_socket) && !defined(__PPC__)
- LSS_INLINE _syscall3(int, socket, int, domain, int, type, int, protocol)
- #endif
-- #if defined(__NR_socketpair)
-+ #if defined(__NR_socketpair) && !defined(__PPC__)
- LSS_INLINE _syscall4(int, socketpair, int, d, int, type, int, protocol,
- int*, sv)
- #endif
-diff --git a/third_party/pdfium/third_party/libpng16/pngpriv.h b/third_party/pdfium/third_party/libpng16/pngpriv.h
-index 583c26f..e03d697 100644
---- a/third_party/pdfium/third_party/libpng16/pngpriv.h
-+++ b/third_party/pdfium/third_party/libpng16/pngpriv.h
-@@ -196,11 +196,7 @@
- #endif
-
- #ifndef PNG_POWERPC_VSX_OPT
--# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
--# define PNG_POWERPC_VSX_OPT 2
--# else
--# define PNG_POWERPC_VSX_OPT 0
--# endif
-+# define PNG_POWERPC_VSX_OPT 0
- #endif
-
- #ifndef PNG_INTEL_SSE_OPT
-diff --git a/third_party/pffft/src/pffft.c b/third_party/pffft/src/pffft.c
-index bdac4d784..51e0f2cac 100644
---- a/third_party/pffft/src/pffft.c
-+++ b/third_party/pffft/src/pffft.c
-@@ -100,6 +100,7 @@
- Altivec support macros
- */
- #if !defined(PFFFT_SIMD_DISABLE) && (defined(__ppc__) || defined(__ppc64__))
-+#include <altivec.h>
- typedef vector float v4sf;
- # define SIMD_SZ 4
- # define VZERO() ((vector float) vec_splat_u8(0))
-diff --git a/third_party/sqlite/src/amalgamation/sqlite3.c b/third_party/sqlite/src/amalgamation/sqlite3.c
-index 6b4a7899d..b8c7fe414 100644
---- a/third_party/sqlite/src/amalgamation/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation/sqlite3.c
-@@ -14474,7 +14474,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/amalgamation_dev/sqlite3.c b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-index d30c9b7de..cf75a69d9 100644
---- a/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-@@ -14487,7 +14487,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/ext/rtree/rtree.c b/third_party/sqlite/src/ext/rtree/rtree.c
-index f5b57a5e2..80a2d0ad8 100644
---- a/third_party/sqlite/src/ext/rtree/rtree.c
-+++ b/third_party/sqlite/src/ext/rtree/rtree.c
-@@ -450,7 +450,7 @@ struct RtreeMatchArg {
- #if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__arm__)
-+ defined(__arm__) || defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- #elif defined(sparc) || defined(__ppc__)
- # define SQLITE_BYTEORDER 4321
-diff --git a/third_party/sqlite/src/src/sqliteInt.h b/third_party/sqlite/src/src/sqliteInt.h
-index 245070d4f..b25164e95 100644
---- a/third_party/sqlite/src/src/sqliteInt.h
-+++ b/third_party/sqlite/src/src/sqliteInt.h
-@@ -877,7 +877,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/webrtc/rtc_base/system/arch.h b/third_party/webrtc/rtc_base/system/arch.h
-index be2367b85..be4ee4233 100644
---- a/third_party/webrtc/rtc_base/system/arch.h
-+++ b/third_party/webrtc/rtc_base/system/arch.h
-@@ -79,6 +79,18 @@
- #elif defined(__EMSCRIPTEN__)
- #define WEBRTC_ARCH_32_BITS
- #define WEBRTC_ARCH_LITTLE_ENDIAN
-+#elif defined(__PPC__)
-+#define WEBRTC_ARCH_PPC_FAMILY
-+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-+#define WEBRTC_ARCH_LITTLE_ENDIAN
-+#else
-+#define WEBRTC_ARCH_BIG_ENDIAN
-+#endif
-+#if defined(__LP64__)
-+#define WEBRTC_ARCH_64_BITS
-+#else
-+#define WEBRTC_ARCH_32_BITS
-+#endif
- #else
- #error Please add support for your architecture in rtc_base/system/arch.h
- #endif
-diff --git a/v8/BUILD.gn b/v8/BUILD.gn
-index f39529a3a..e84fc449e 100644
---- a/v8/BUILD.gn
-+++ b/v8/BUILD.gn
-@@ -850,6 +850,12 @@ config("toolchain") {
- }
- if (host_byteorder == "little") {
- defines += [ "V8_TARGET_ARCH_PPC_LE" ]
-+ cflags += [
-+ # Enable usage of AltiVec, VSX, and other POWER8 and higher features
-+ "-mcpu=power8",
-+ "-maltivec",
-+ "-mvsx",
-+ ]
- } else if (host_byteorder == "big") {
- defines += [ "V8_TARGET_ARCH_PPC_BE" ]
- if (current_os == "aix") {
---- a/ui/gl/features.gni
-+++ b/ui/gl/features.gni
-@@ -33,5 +33,5 @@
- is_chromeos_ash || is_fuchsia) &&
- (target_cpu == "x86" || target_cpu == "x64" || target_cpu == "arm" ||
- target_cpu == "arm64" || target_cpu == "mipsel" ||
-- target_cpu == "mips64el" || target_cpu == "riscv64")
-+ target_cpu == "mips64el" || target_cpu == "riscv64" || target_cpu == "ppc64")
- }
-diff --git a/v8/test/BUILD.gn b/v8/test/BUILD.gn
-index fb872ad39..45fc585dd 100644
---- a/v8/test/BUILD.gn
-+++ b/v8/test/BUILD.gn
-@@ -42,7 +42,7 @@ group("gn_all") {
- "benchmarks/cpp:gn_all",
- "cctest:cctest",
- "unittests:generate-bytecode-expectations",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
- }
- }
-@@ -84,7 +84,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- "webkit:v8_webkit",
- ]
-
-@@ -109,7 +109,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
-
- if (v8_enable_webassembly) {
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch b/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
deleted file mode 100644
index df453f491d8c..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-+++ b/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-@@ -574,6 +574,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCAsmInfoCOFF.cpp",
- "llvm/lib/MC/MCAsmInfoDarwin.cpp",
- "llvm/lib/MC/MCAsmInfoELF.cpp",
-+ "llvm/lib/MC/MCAsmInfoXCOFF.cpp",
- "llvm/lib/MC/MCAsmMacro.cpp",
- "llvm/lib/MC/MCAsmStreamer.cpp",
- "llvm/lib/MC/MCAssembler.cpp",
-@@ -629,6 +630,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCWinCOFFStreamer.cpp",
- "llvm/lib/MC/MCWinEH.cpp",
- "llvm/lib/MC/MCXCOFFStreamer.cpp",
-+ "llvm/lib/MC/MCXCOFFObjectTargetWriter.cpp",
- "llvm/lib/MC/MachObjectWriter.cpp",
- "llvm/lib/MC/StringTableBuilder.cpp",
- "llvm/lib/MC/SubtargetFeature.cpp",
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 7dea8bbe50d3..50b9a3aec409 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -1,7 +1,7 @@
# Template file for 'chromium'
pkgname=chromium
# See https://chromiumdash.appspot.com/releases?platform=Linux for the latest version
-version=108.0.5359.124
+version=109.0.5414.74
revision=1
archs="i686* x86_64* aarch64* armv7l* ppc64le*"
hostmakedepends="
@@ -28,7 +28,7 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://www.chromium.org/"
distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz"
-checksum=d48dfac2a61b14a5d7d2f460b09b70ef3ab88e27b82e3173938cb54eaa612a75
+checksum=eded233c26ab631be325ad49cb306c338513b6a6528197d42653e66187548e5d
lib32disabled=yes
@@ -220,9 +220,6 @@ do_configure() {
'icu_use_data_file=true'
- 'use_allocator="none"'
- 'use_allocator_shim=false'
-
'enable_widevine=true'
'enable_hangout_services_extension=true'
@@ -318,13 +315,13 @@ do_configure() {
do_build() {
_setup_toolchain
- CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver chrome_crashpad_handler
+ CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver.unstripped chrome_crashpad_handler
}
do_install() {
vinstall out/Release/chrome 755 usr/lib/${pkgname} ${pkgname}
vinstall out/Release/chrome_crashpad_handler 755 usr/lib/${pkgname} chrome_crashpad_handler
- vinstall out/Release/chromedriver 755 usr/lib/${pkgname} chromedriver
+ vinstall out/Release/chromedriver.unstripped 755 usr/lib/${pkgname} chromedriver
vinstall out/Release/libEGL.so 755 usr/lib/${pkgname} libEGL.so
vinstall out/Release/libGLESv2.so 755 usr/lib/${pkgname} libGLESv2.so
vinstall out/Release/libvk_swiftshader.so 755 usr/lib/${pkgname} libvk_swiftshader.so
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] chromium: update to 109.0.5414.74.
2023-01-11 1:12 [PR PATCH] chromium: update to 109.0.5414.74 Duncaen
2023-01-11 14:05 ` [PR PATCH] [Updated] " Duncaen
2023-01-11 14:05 ` Duncaen
@ 2023-01-11 14:18 ` Duncaen
2023-01-11 14:53 ` Duncaen
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Duncaen @ 2023-01-11 14:18 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]
There is an updated pull request by Duncaen against master on the void-packages repository
https://github.com/Duncaen/void-packages chromium-109
https://github.com/void-linux/void-packages/pull/41570
chromium: update to 109.0.5414.74.
[ci skip]
* [x] x86_64-glibc
* [ ] x86_64-musl
* [ ] aarch64-musl
* [ ] i686
A patch file from https://github.com/void-linux/void-packages/pull/41570.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-chromium-109-41570.patch --]
[-- Type: text/x-diff, Size: 180077 bytes --]
From ec49817c94bedb3a3696e1b142229a2391c2ea49 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Wed, 11 Jan 2023 01:28:40 +0100
Subject: [PATCH] chromium: update to 109.0.5414.74.
---
.../musl-patches/xxx-ppc64le-support.patch | 187 -
.../patches/build-add-use_cxx17.patch | 38 +-
.../patches/fix-build-with-old-clang.patch | 20 +
.../patches/fix-constexpr-narrowing.patch | 21 +
.../patches/fix-musl-pthread-stacksize.patch | 40 -
.../chromium/patches/fix-narrowing-cast.patch | 53 -
.../patches/fix-nasm-musl-config.patch | 12 -
srcpkgs/chromium/patches/narrowing-cast.patch | 21 +
...uild-error-on-linux-with-system-zlib.patch | 41 -
.../patches/remove-strip_binary.patch | 32 -
.../patches/xxx-ppc64le-4k-pages.patch | 60 -
.../chromium/patches/xxx-ppc64le-libvpx.patch | 33 -
.../xxx-ppc64le-sandbox-linux-stat.patch | 31 -
.../patches/xxx-ppc64le-support.patch | 3590 -----------------
.../patches/xxx-ppc64le-swiftshader.patch | 18 -
srcpkgs/chromium/template | 11 +-
16 files changed, 83 insertions(+), 4125 deletions(-)
delete mode 100644 srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
create mode 100644 srcpkgs/chromium/patches/fix-build-with-old-clang.patch
create mode 100644 srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
delete mode 100644 srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
delete mode 100644 srcpkgs/chromium/patches/fix-narrowing-cast.patch
delete mode 100644 srcpkgs/chromium/patches/fix-nasm-musl-config.patch
create mode 100644 srcpkgs/chromium/patches/narrowing-cast.patch
delete mode 100644 srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
delete mode 100644 srcpkgs/chromium/patches/remove-strip_binary.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-support.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
diff --git a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 555f69c072c8..000000000000
--- a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,187 +0,0 @@
-diff --git sandbox/linux/bpf_dsl/seccomp_macros.h sandbox/linux/bpf_dsl/seccomp_macros.h
-index a6aec544e..2a4a7f1bc 100644
---- sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,7 +16,7 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
--#elif defined(__powerpc64__)
-+#elif defined(__powerpc64__) && defined(__GLIBC__)
- // Manually define greg_t on ppc64
- typedef unsigned long long greg_t;
- #endif
-@@ -361,11 +361,11 @@ typedef struct pt_regs regs_struct;
- #define SECCOMP_ARCH AUDIT_ARCH_PPC64
- #endif
-
--#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+#define SECCOMP_REG(_ctx, _reg) (((struct pt_regs *)(_ctx)->uc_mcontext.regs)->gpr[_reg])
-
- #define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
--#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_IP(_ctx) ((struct pt_regs *)(_ctx)->uc_mcontext.regs)->nip
- #define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
- #define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-diff --git sandbox/linux/seccomp-bpf/syscall.cc sandbox/linux/seccomp-bpf/syscall.cc
-index d53a7ff56..c290f0e92 100644
---- sandbox/linux/seccomp-bpf/syscall.cc
-+++ sandbox/linux/seccomp-bpf/syscall.cc
-@@ -499,9 +499,9 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // Same as MIPS, need to invert ret and set error register (cr0.SO)
- if (ret_val <= -1 && ret_val >= -4095) {
- ret_val = -ret_val;
-- ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr |= (1 << 28);
- } else {
-- ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr &= ~(1 << 28);
- }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
---- third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-+++ third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-@@ -22,6 +22,7 @@
- // The following platforms have an implementation of a hardware counter.
- #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
- defined(__powerpc__) || defined(__ppc__) || defined(__riscv) || \
-+ ((defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__)) || defined(__riscv) || \
- defined(_M_IX86) || (defined(_M_X64) && !defined(_M_ARM64EC))
- #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1
- #else
---- third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-+++ third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-@@ -64,7 +64,7 @@
- #elif defined(__i386__) || defined(__x86_64__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_x86-inl.inc"
--#elif defined(__ppc__) || defined(__PPC__)
-+#elif (defined(__ppc__) || defined(__PPC__)) && defined(__GLIBC__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_powerpc-inl.inc"
- #elif defined(__aarch64__)
-diff --git third_party/breakpad/BUILD.gn third_party/breakpad/BUILD.gn
-index f9a60e37..25f3a0b7 100644
---- third_party/breakpad/BUILD.gn
-+++ third_party/breakpad/BUILD.gn
-@@ -637,6 +637,7 @@ if (is_linux || is_android) {
-
- if (current_cpu == "ppc64") {
- defines = [ "HAVE_GETCONTEXT" ]
-+ libs += [ "ucontext" ]
- } else {
- sources += [
- "breakpad/src/common/linux/breakpad_getcontext.S"
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index 03afec7a..0264ecf1 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -273,6 +273,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t ThreadInfo::GetInstructionPointer() const {
- return mcontext.gp_regs[PT_NIP];
- }
-@@ -290,9 +293,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->ctr = mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] = \
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 1090470f..e580233d 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -257,6 +257,9 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
- return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
- }
-@@ -280,9 +283,9 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&uc->uc_mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&uc->uc_mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] =
-diff --git third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index 5a7ab50c..ee8b858c 100644
---- third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -105,6 +105,11 @@
- #define PR_SET_PTRACER 0x59616d61
- #endif
-
-+/* musl hack, can't include asm/ptrace.h as that causes conflicts */
-+#if defined(__powerpc64__) && !defined(PT_NIP)
-+#define PT_NIP 32
-+#endif
-+
- namespace google_breakpad {
-
- namespace {
-diff --git third_party/crashpad/crashpad/snapshot/linux/signal_context.h third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 8e335a09..b2a0f155 100644
---- third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -469,7 +469,7 @@ struct MContext64 {
- SignalThreadContext64 gp_regs;
- SignalFloatContext64 fp_regs;
- SignalVectorContext64 *v_regs;
-- int64_t vmx_reserve[69];
-+ int64_t vmx_reserve[101];
- };
-
- struct ContextTraits64 : public Traits64 {
-diff --git third_party/crashpad/crashpad/util/linux/thread_info.h third_party/crashpad/crashpad/util/linux/thread_info.h
-index dea0d1f3..b203e5b2 100644
---- third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -30,6 +30,7 @@
-
- #if defined(ARCH_CPU_PPC64_FAMILY)
- #include <sys/ucontext.h>
-+#include <asm/ptrace.h>
- #endif
-
- namespace crashpad {
-diff --git third_party/lss/linux_syscall_support.h third_party/lss/linux_syscall_support.h
-index 9955ce44..4c1cc488 100644
---- third_party/lss/linux_syscall_support.h
-+++ third_party/lss/linux_syscall_support.h
-@@ -4216,9 +4216,13 @@ struct kernel_statfs {
- }
- #endif
- #if defined(__NR_fstatat64)
-+ // musl does #define fstatat64 fstatat
-+ #undef fstatat64
- LSS_INLINE _syscall4(int, fstatat64, int, d,
- const char *, p,
- struct kernel_stat64 *, b, int, f)
-+ // set it back like it was
-+ #define fstatat64 fstatat
- #endif
- #if defined(__NR_waitpid)
- // waitpid is polyfilled below when not available.
diff --git a/srcpkgs/chromium/patches/build-add-use_cxx17.patch b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
index 091b1c553727..b50825fb7e2c 100644
--- a/srcpkgs/chromium/patches/build-add-use_cxx17.patch
+++ b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
@@ -1,26 +1,22 @@
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
-@@ -167,6 +167,10 @@
- # Enable -H, which prints the include tree during compilation.
- # For use by tools/clang/scripts/analyze_includes.py
- show_includes = false
-+
-+ # Allow projects that wish to stay on C++17 to override Chromium's default.
-+ # TODO(crbug.com/1402249): evaluate removing this end of 2023
-+ use_cxx17 = false
+@@ -191,6 +191,10 @@
+ current_cpu == "x64"))))
}
- declare_args() {
-@@ -596,7 +600,11 @@
- } else if (is_linux) {
- # TODO(crbug.com/1284275): Switch to C++20 on all platforms.
- if (is_clang) {
-- cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ if (use_cxx17) {
-+ cflags_cc += [ "-std=${standard_prefix}++17" ]
-+ } else {
-+ cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ }
++declare_args() {
++ use_cxx17 = false
++}
++
+ if (is_android || (is_chromeos_ash && is_chromeos_device)) {
+ # Set the path to use orderfile for linking Chrome
+ # Note that this is for using only one orderfile for linking
+@@ -605,7 +609,7 @@
+ cflags_cc += [ "-fno-trigraphs" ]
+ }
+ } else if (is_clang) {
+- if (is_chromeos_device) {
++ if (is_chromeos_device || use_cxx17) {
+ # TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
+ cflags_cc += [ "-std=${standard_prefix}++17" ]
} else {
- # The gcc bots are currently using GCC 9, which is not new enough to
- # support "c++20"/"gnu++20".
diff --git a/srcpkgs/chromium/patches/fix-build-with-old-clang.patch b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
new file mode 100644
index 000000000000..f23218e71e4d
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
@@ -0,0 +1,20 @@
+--- a/build/config/compiler/BUILD.gn
++++ b/build/config/compiler/BUILD.gn
+@@ -805,17 +805,6 @@
+ cflags += [ "-fcomplete-member-pointers" ]
+ }
+
+- # Use DWARF simple template names, with the following exceptions:
+- #
+- # * Windows is not supported as it doesn't use DWARF.
+- # * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
+- # lldb doesn't have the needed changes yet.
+- # * Fuchsia isn't supported as zxdb doesn't support simple template names yet.
+- # TODO(crbug.com/1379070): Remove if the upstream default ever changes.
+- if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
+- cflags_cc += [ "-gsimple-template-names" ]
+- }
+-
+ # MLGO specific flags. These flags enable an ML-based inliner trained on
+ # Chrome on Android (arm32) with ThinLTO enabled, optimizing for size.
+ # The "release" ML model is embedded into clang as part of its build.
diff --git a/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch b/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
new file mode 100644
index 000000000000..570ca6e69a80
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
@@ -0,0 +1,21 @@
+--- a/third_party/blink/renderer/platform/media/web_media_player_impl.cc.orig
++++ b/third_party/blink/renderer/platform/media/web_media_player_impl.cc
+@@ -3881,15 +3881,15 @@
+ const T&... values) {
+ std::string strkey = std::string(key);
+
+- if constexpr (Flags & kEncrypted) {
++ if constexpr (Flags & kEncrypted != 0) {
+ if (is_encrypted_)
+ UmaFunction(strkey + ".EME", values...);
+ }
+
+- if constexpr (Flags & kTotal)
++ if constexpr (Flags & kTotal != 0)
+ UmaFunction(strkey + ".All", values...);
+
+- if constexpr (Flags & kPlaybackType) {
++ if constexpr (Flags & kPlaybackType != 0) {
+ auto demuxer_type = GetDemuxerType();
+ if (!demuxer_type.has_value())
+ return;
diff --git a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch b/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
deleted file mode 100644
index cd5533190db9..000000000000
--- a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- a/base/threading/platform_thread_linux.cc
-+++ b/base/threading/platform_thread_linux.cc
-@@ -436,8 +436,13 @@
-
- size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
- #if !defined(THREAD_SANITIZER)
-+#if defined(__GLIBC__)
- return 0;
- #else
-+ // musl libcs default is too small, use 8mb like glibc
-+ return (1 << 23);
-+#endif
-+#else
- // ThreadSanitizer bloats the stack heavily. Evidence has been that the
- // default stack size isn't enough for some browser tests.
- return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux).
---- a/chrome/browser/shutdown_signal_handlers_posix.cc
-+++ b/chrome/browser/shutdown_signal_handlers_posix.cc
-@@ -188,11 +188,21 @@
- g_shutdown_pipe_read_fd = pipefd[0];
- g_shutdown_pipe_write_fd = pipefd[1];
- #if !defined(ADDRESS_SANITIZER)
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
- #else
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 * 8;
-+#endif
-+#else
- // ASan instrumentation bloats the stack frames, so we need to increase the
- // stack size to avoid hitting the guard page.
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
-+#else
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 * 8;
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+#endif
- #endif
- ShutdownDetector* detector = new ShutdownDetector(
- g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);
diff --git a/srcpkgs/chromium/patches/fix-narrowing-cast.patch b/srcpkgs/chromium/patches/fix-narrowing-cast.patch
deleted file mode 100644
index afd42a1489ae..000000000000
--- a/srcpkgs/chromium/patches/fix-narrowing-cast.patch
+++ /dev/null
@@ -1,53 +0,0 @@
---- a/base/files/file_util_linux.cc
-+++ b/base/files/file_util_linux.cc
-@@ -23,14 +23,14 @@
-
- // Not all possible |statfs_buf.f_type| values are in linux/magic.h.
- // Missing values are copied from the statfs man page.
-- switch (statfs_buf.f_type) {
-+ switch (static_cast<uintmax_t>(statfs_buf.f_type)) {
- case 0:
- *type = FILE_SYSTEM_0;
- break;
- case EXT2_SUPER_MAGIC: // Also ext3 and ext4
- case MSDOS_SUPER_MAGIC:
- case REISERFS_SUPER_MAGIC:
-- case static_cast<int>(BTRFS_SUPER_MAGIC):
-+ case BTRFS_SUPER_MAGIC:
- case 0x5346544E: // NTFS
- case 0x58465342: // XFS
- case 0x3153464A: // JFS
-@@ -40,14 +40,14 @@
- *type = FILE_SYSTEM_NFS;
- break;
- case SMB_SUPER_MAGIC:
-- case static_cast<int>(0xFF534D42): // CIFS
-+ case 0xFF534D42: // CIFS
- *type = FILE_SYSTEM_SMB;
- break;
- case CODA_SUPER_MAGIC:
- *type = FILE_SYSTEM_CODA;
- break;
-- case static_cast<int>(HUGETLBFS_MAGIC):
-- case static_cast<int>(RAMFS_MAGIC):
-+ case HUGETLBFS_MAGIC:
-+ case RAMFS_MAGIC:
- case TMPFS_MAGIC:
- *type = FILE_SYSTEM_MEMORY;
- break;
---- a/base/system/sys_info_posix.cc
-+++ b/base/system/sys_info_posix.cc
-@@ -100,10 +100,10 @@
- if (HANDLE_EINTR(statfs(path.value().c_str(), &stats)) != 0)
- return false;
-
-- switch (stats.f_type) {
-+ switch (static_cast<uintmax_t>(stats.f_type)) {
- case TMPFS_MAGIC:
-- case static_cast<int>(HUGETLBFS_MAGIC):
-- case static_cast<int>(RAMFS_MAGIC):
-+ case HUGETLBFS_MAGIC:
-+ case RAMFS_MAGIC:
- return true;
- }
- return false;
diff --git a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch b/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
deleted file mode 100644
index 7a0337f3bf3b..000000000000
--- a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/third_party/nasm/config/config-linux.h
-+++ b/third_party/nasm/config/config-linux.h
-@@ -139,7 +139,9 @@
- #define HAVE_ACCESS 1
-
- /* Define to 1 if you have the `canonicalize_file_name' function. */
-+#ifdef __GLIBC__
- #define HAVE_CANONICALIZE_FILE_NAME 1
-+#endif
-
- /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
- /* #undef HAVE_CPU_TO_LE16 */
diff --git a/srcpkgs/chromium/patches/narrowing-cast.patch b/srcpkgs/chromium/patches/narrowing-cast.patch
new file mode 100644
index 000000000000..d10940eb7e89
--- /dev/null
+++ b/srcpkgs/chromium/patches/narrowing-cast.patch
@@ -0,0 +1,21 @@
+from the manpage for statfs:
+
+The __fsword_t type used for various fields in the statfs structure
+definition is a glibc internal type, not intended for public use. This
+leaves the programmer in a bit of a conundrum when trying to copy or
+compare these fields to local variables in a program. Using
+unsigned int for such variables suffices on most systems.
+
+--- a/base/system/sys_info_posix.cc
++++ b/base/system/sys_info_posix.cc
+@@ -64,8 +64,8 @@
+
+ switch (stats.f_type) {
+ case TMPFS_MAGIC:
+- case static_cast<int>(HUGETLBFS_MAGIC):
+- case static_cast<int>(RAMFS_MAGIC):
++ case static_cast<unsigned int>(HUGETLBFS_MAGIC):
++ case static_cast<unsigned int>(RAMFS_MAGIC):
+ return true;
+ }
+ return false;
diff --git a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch b/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
deleted file mode 100644
index 13d504d3e792..000000000000
--- a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From dda01a706453ded8c01c41775707cb5ef4e316f8 Mon Sep 17 00:00:00 2001
-From: Andres Salomon <dilinger@queued.net>
-Date: Tue, 25 Oct 2022 21:11:46 +0000
-Subject: [PATCH] Re-fix TFLite build error on linux when using the system zlib
-
-In commit ae0f9adb7e14c0d19ca695ef6ad40b321a8cb64c, I fixed some build
-errors related to minizip patch inclusion in TFLite. However, after that
-when TFLite Support was rolled to HEAD, a small part of that patch got
-dropped. The result is the following build error with 107.0.5304.62:
-
-../../third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc:22:10: fatal error: 'contrib/minizip/ioapi.h' file not found
- ^~~~~~~~~~~~~~~~~~~~~~~~~
-1 error generated.
-
-This commit re-adds the lost fix.
-
-R=junzou@chromium.org
-
-Change-Id: Ie96c3571894b5100a1e2a2771da29699eff0beb3
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3972087
-Reviewed-by: Robert Ogden <robertogden@chromium.org>
-Commit-Queue: Robert Ogden <robertogden@chromium.org>
-Auto-Submit: Andres Salomon <dilinger@queued.net>
-Cr-Commit-Position: refs/heads/main@{#1063478}
----
- .../metadata/cc/utils/zip_readonly_mem_file.cc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-index 392b6b411fe..525ae4a2b45 100644
---- a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-+++ b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-@@ -19,7 +19,7 @@ limitations under the License.
- #include <cstdio>
-
- #include "absl/strings/string_view.h" // from @com_google_absl
--#include "contrib/minizip/ioapi.h"
-+#include "third_party/zlib/contrib/minizip/ioapi.h"
-
- namespace tflite {
- namespace metadata {
diff --git a/srcpkgs/chromium/patches/remove-strip_binary.patch b/srcpkgs/chromium/patches/remove-strip_binary.patch
deleted file mode 100644
index 8b13c6a056a8..000000000000
--- a/srcpkgs/chromium/patches/remove-strip_binary.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/chrome/test/chromedriver/BUILD.gn.orig
-+++ b/chrome/test/chromedriver/BUILD.gn
-@@ -308,11 +308,7 @@
- }
- }
-
--if (is_linux) {
-- chromedriver_output = "chromedriver.unstripped"
--} else {
-- chromedriver_output = "chromedriver"
--}
-+chromedriver_output = "chromedriver"
-
- executable("$chromedriver_output") {
- testonly = true
-@@ -336,16 +332,6 @@
- }
- }
-
--if (is_linux) {
-- strip_binary("chromedriver") {
-- testonly = true
-- binary_input = "$root_out_dir/$chromedriver_output"
-- symbol_output = "$root_out_dir/chromedriver.debug"
-- stripped_binary_output = "$root_out_dir/chromedriver"
-- deps = [ ":$chromedriver_output" ]
-- }
--}
--
- python_library("chromedriver_py_tests") {
- testonly = true
- deps = [
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch b/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
deleted file mode 100644
index 28c4ad35f14e..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-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;
-
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch b/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
deleted file mode 100644
index 0c03ad4a65eb..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-commit 981437bc846fcdb854062e89fd3d86f112e5f426
-Author: q66 <daniel@octaforge.org>
-Date: Sat Jun 25 12:35:37 2022 +0200
-
- Use generic target for now.
-
- This is because the source tree is missing vsx optimizations that
- then do not get included and result in failed linking such as:
-
- ld.lld: error: undefined symbol: vpx_mse16x16_vsx
-
-diff --git a/third_party/libvpx/generate_gni.sh b/third_party/libvpx/generate_gni.sh
-index 7429080..43ee29a 100755
---- a/third_party/libvpx/generate_gni.sh
-+++ b/third_party/libvpx/generate_gni.sh
-@@ -405,7 +405,7 @@
- gen_config_files linux/mips64el "--target=mips64-linux-gcc ${all_platforms}"
- gen_config_files linux/loongarch \
- "--target=loongarch64-linux-gcc ${all_platforms}"
--gen_config_files linux/ppc64 "--target=ppc64le-linux-gcc ${all_platforms}"
-+gen_config_files linux/ppc64 "--target=generic-gnu ${all_platforms}"
- gen_config_files linux/generic "--target=generic-gnu $HIGHBD ${all_platforms}"
- gen_config_files win/arm64 \
- "--target=arm64-win64-vs15 ${all_platforms} ${HIGHBD}"
-@@ -468,7 +468,7 @@
- gen_rtcd_header linux/mipsel mipsel
- gen_rtcd_header linux/mips64el mips64el
- gen_rtcd_header linux/loongarch loongarch
--gen_rtcd_header linux/ppc64 ppc
-+gen_rtcd_header linux/ppc64 generic
- gen_rtcd_header linux/generic generic
- gen_rtcd_header win/arm64 armv8
- gen_rtcd_header win/ia32 x86 "${require_sse2}"
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch b/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
deleted file mode 100644
index 4bfb5d494b06..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/sandbox/linux/system_headers/linux_stat.h
-+++ b/sandbox/linux/system_headers/linux_stat.h
-@@ -155,6 +155,28 @@ struct kernel_stat {
- unsigned int __unused4;
- unsigned int __unused5;
- };
-+#elif defined(__powerpc64__)
-+struct kernel_stat {
-+ unsigned long st_dev;
-+ unsigned long st_ino;
-+ unsigned long st_nlink;
-+ unsigned int st_mode;
-+ unsigned int st_uid;
-+ unsigned int st_gid;
-+ unsigned long st_rdev;
-+ long st_size;
-+ unsigned long st_blksize;
-+ unsigned long st_blocks;
-+ unsigned long st_atime_;
-+ unsigned long st_atime_nsec_;
-+ unsigned long st_mtime_;
-+ unsigned long st_mtime_nsec_;
-+ unsigned long st_ctime_;
-+ unsigned long st_ctime_nsec_;
-+ unsigned long __unused4;
-+ unsigned long __unused5;
-+ unsigned long __unused6;
-+};
- #endif
-
- // On 32-bit systems, we default to the 64-bit stat struct like libc
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 0bc505358916..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,3590 +0,0 @@
-commit 2c013a317b1114ef67cdbbc30824b28907b9ea94
-Author: Daniel Kolesa <daniel@octaforge.org>
-Date: Wed Mar 3 19:08:29 2021 +0100
-
- ppc64le support
-
-diff --git a/build/download_nacl_toolchains.py b/build/download_nacl_toolchains.py
-index 286a92a27..ec36a85d3 100755
---- a/build/download_nacl_toolchains.py
-+++ b/build/download_nacl_toolchains.py
-@@ -13,6 +13,10 @@ import sys
-
-
- def Main(args):
-+ # If `disable_nacl=1` is in GYP_DEFINES, exit
-+ if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''):
-+ return 0
-+
- script_dir = os.path.dirname(os.path.abspath(__file__))
- src_dir = os.path.dirname(script_dir)
- nacl_dir = os.path.join(src_dir, 'native_client')
---- a/chrome/installer/linux/BUILD.gn
-+++ b/chrome/installer/linux/BUILD.gn
-@@ -97,8 +97,6 @@
- "$root_out_dir/xdg-mime",
- "$root_out_dir/xdg-settings",
- "$root_out_dir/locales/en-US.pak",
-- "$root_out_dir/MEIPreload/manifest.json",
-- "$root_out_dir/MEIPreload/preloaded_data.pb",
- ]
-
- action_foreach("calculate_deb_dependencies") {
-@@ -377,7 +377,6 @@
- "//chrome",
- "//chrome:packed_resources",
- "//chrome/browser/enterprise/connectors/device_trust/key_management/installer/management_service:chrome_management_service",
-- "//chrome/browser/resources/media/mei_preload:component",
- "//components/crash/core/app:chrome_crashpad_handler",
- "//sandbox/linux:chrome_sandbox",
- ]
-diff --git a/sandbox/features.gni b/sandbox/features.gni
-index db30ae6d6..9dc09bf53 100644
---- a/sandbox/features.gni
-+++ b/sandbox/features.gni
-@@ -11,7 +11,8 @@ import("//build/config/nacl/config.gni")
- use_seccomp_bpf = (is_linux || is_chromeos || is_android) &&
- (current_cpu == "x86" || current_cpu == "x64" ||
- current_cpu == "arm" || current_cpu == "arm64" ||
-- current_cpu == "mipsel" || current_cpu == "mips64el")
-+ current_cpu == "mipsel" || current_cpu == "mips64el" ||
-+ current_cpu == "ppc64")
-
- use_seccomp_bpf = use_seccomp_bpf || is_nacl_nonsfi
-
-diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn
-index e9a94b461..cca1a5da5 100644
---- a/sandbox/linux/BUILD.gn
-+++ b/sandbox/linux/BUILD.gn
-@@ -427,6 +427,8 @@ component("sandbox_services") {
-
- source_set("sandbox_services_headers") {
- sources = [
-+ "system_headers/ppc64_linux_syscalls.h",
-+ "system_headers/ppc64_linux_ucontext.h",
- "system_headers/arm64_linux_syscalls.h",
- "system_headers/arm_linux_syscalls.h",
- "system_headers/arm_linux_ucontext.h",
-diff --git a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-index 313511f22..0ca3a326f 100644
---- a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-+++ b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-@@ -56,6 +56,13 @@
- #define MAX_PUBLIC_SYSCALL __NR_syscalls
- #define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-
-+#elif defined(__powerpc64__)
-+
-+#include <asm-generic/unistd.h>
-+#define MIN_SYSCALL 0u
-+#define MAX_PUBLIC_SYSCALL __NR_syscalls
-+#define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-+
- #else
- #error "Unsupported architecture"
- #endif
-diff --git a/sandbox/linux/bpf_dsl/seccomp_macros.h b/sandbox/linux/bpf_dsl/seccomp_macros.h
-index 1a407b952..a6aec544e 100644
---- a/sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ b/sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,6 +16,9 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
-+#elif defined(__powerpc64__)
-+// Manually define greg_t on ppc64
-+typedef unsigned long long greg_t;
- #endif
- #endif
-
-@@ -346,6 +349,51 @@ struct regs_struct {
- #define SECCOMP_PT_PARM4(_regs) (_regs).regs[3]
- #define SECCOMP_PT_PARM5(_regs) (_regs).regs[4]
- #define SECCOMP_PT_PARM6(_regs) (_regs).regs[5]
-+
-+#elif defined(__powerpc64__)
-+#include <asm/ptrace.h>
-+
-+typedef struct pt_regs regs_struct;
-+
-+#ifdef ARCH_CPU_LITTLE_ENDIAN
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64LE
-+#else
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64
-+#endif
-+
-+#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+
-+#define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
-+#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
-+#define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-+#define SECCOMP_PARM4(_ctx) SECCOMP_REG(_ctx, 6)
-+#define SECCOMP_PARM5(_ctx) SECCOMP_REG(_ctx, 7)
-+#define SECCOMP_PARM6(_ctx) SECCOMP_REG(_ctx, 8)
-+
-+#define SECCOMP_NR_IDX (offsetof(struct arch_seccomp_data, nr))
-+#define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch))
-+#define SECCOMP_IP_MSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 4)
-+#define SECCOMP_IP_LSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 0)
-+#define SECCOMP_ARG_MSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 4)
-+#define SECCOMP_ARG_LSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 0)
-+
-+#define SECCOMP_PT_RESULT(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_SYSCALL(_regs) (_regs).gpr[0]
-+#define SECCOMP_PT_IP(_regs) (_regs).nip
-+#define SECCOMP_PT_PARM1(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_PARM2(_regs) (_regs).gpr[4]
-+#define SECCOMP_PT_PARM3(_regs) (_regs).gpr[5]
-+#define SECCOMP_PT_PARM4(_regs) (_regs).gpr[6]
-+#define SECCOMP_PT_PARM5(_regs) (_regs).gpr[7]
-+#define SECCOMP_PT_PARM6(_regs) (_regs).gpr[8]
-+
- #else
- #error Unsupported target platform
-
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-index 6a1ec2389..f20c582dd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-@@ -88,7 +88,8 @@ bool IsBaselinePolicyWatched(int sysno) {
- SyscallSets::IsPrctl(sysno) ||
- SyscallSets::IsProcessGroupOrSession(sysno) ||
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- SyscallSets::IsSocketCall(sysno) ||
- #endif
- #if defined(__arm__)
-@@ -227,7 +228,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_mmap)
- return RestrictMmapFlags();
- #endif
-@@ -245,7 +246,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- return RestrictPrctl();
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_socketpair) {
- // Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen.
- static_assert(AF_UNIX == PF_UNIX,
-@@ -285,7 +286,8 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- if (SyscallSets::IsSocketCall(sysno))
- return RestrictSocketcallCommand();
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:11:10.481579470 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:12:43.524831376 -0400
-@@ -302,7 +302,7 @@
- TEST_BASELINE_SIGSYS(__NR_syslog)
- TEST_BASELINE_SIGSYS(__NR_timer_create)
-
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- TEST_BASELINE_SIGSYS(__NR_inotify_init)
- TEST_BASELINE_SIGSYS(__NR_vserver)
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-@@ -358,7 +358,16 @@
- if (args.nr == __NR_fstatat_default) {
- if (*reinterpret_cast<const char*>(args.args[1]) == '\0' &&
- args.args[3] == static_cast<uint64_t>(AT_EMPTY_PATH)) {
-- return syscall(__NR_fstat_default, static_cast<int>(args.args[0]),
-+ int fd = static_cast<int>(args.args[0]);
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO: Investigate the root cause and fix in glibc
-+ if (fd < 0)
-+ fd = -fd;
-+#endif
-+ return syscall(__NR_fstat_default, fd,
- reinterpret_cast<default_stat_struct*>(args.args[2]));
- }
- return -reinterpret_cast<intptr_t>(fs_denied_errno);
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
-index 2a97d3916..8e81aa6cf 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-14 14:41:08.000000000 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-15 13:17:57.808715733 -0400
-@@ -37,7 +37,8 @@
-
- #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
- !defined(__arm__) && !defined(__aarch64__) && \
-- !defined(PTRACE_GET_THREAD_AREA)
-+ !defined(PTRACE_GET_THREAD_AREA) && \
-+ !defined(__powerpc64__)
- // Also include asm/ptrace-abi.h since ptrace.h in older libc (for instance
- // the one in Ubuntu 16.04 LTS) is missing PTRACE_GET_THREAD_AREA.
- // asm/ptrace-abi.h doesn't exist on arm32 and PTRACE_GET_THREAD_AREA isn't
-@@ -45,6 +46,11 @@
- #include <asm/ptrace-abi.h>
- #endif
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- #if BUILDFLAG(IS_ANDROID)
-
- #if !defined(F_DUPFD_CLOEXEC)
-@@ -99,6 +105,14 @@
- return true;
- #else
- return false;
-+#endif
-+}
-+
-+inline bool IsArchitecturePPC64() {
-+#if defined(__powerpc64__)
-+ return true;
-+#else
-+ return false;
- #endif
- }
-
-@@ -239,6 +254,8 @@
- uint64_t kOLargeFileFlag = O_LARGEFILE;
- if (IsArchitectureX86_64() || IsArchitectureI386() || IsArchitectureMips())
- kOLargeFileFlag = 0100000;
-+ else if (IsArchitecturePPC64())
-+ kOLargeFileFlag = 0200000;
-
- const Arg<int> cmd(1);
- const Arg<long> long_arg(2);
-@@ -256,7 +273,16 @@
- F_SETLKW,
- F_GETLK,
- F_DUPFD,
-- F_DUPFD_CLOEXEC),
-+ F_DUPFD_CLOEXEC
-+#if defined(__powerpc64__)
-+// On PPC64, F_SETLK, F_GETLK, F_SETLKW are defined as the 64-bit variants
-+// but glibc will sometimes still use the 32-bit versions. Allow both.
-+ ,
-+ 5, /* F_GETLK (32) */
-+ 6, /* F_SETLK (32) */
-+ 7 /* F_SETLKW (32) */
-+#endif
-+ ),
- Allow())
- .Case(F_SETFL,
- If((long_arg & ~kAllowedMask) == 0, Allow()).Else(CrashSIGSYS()))
-@@ -266,7 +292,7 @@
- // clang-format on
- }
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- ResultExpr RestrictSocketcallCommand() {
- // Unfortunately, we are unable to restrict the first parameter to
- // socketpair(2). Whilst initially sounding bad, it's noteworthy that very
-@@ -419,7 +445,7 @@
- #endif
- return Switch(request)
- .CASES((
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- PTRACE_GETREGS, PTRACE_GETFPREGS, PTRACE_GET_THREAD_AREA,
- PTRACE_GETREGSET,
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-index ba4289f05..9a4d5ab2d 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-@@ -48,7 +48,7 @@ SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictMprotectFlags();
- // O_NONBLOCK | O_SYNC | O_LARGEFILE | O_CLOEXEC | O_NOATIME.
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictFcntlCommands();
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- // Restrict socketcall(2) to only allow socketpair(2), send(2), recv(2),
- // sendto(2), recvfrom(2), shutdown(2), sendmsg(2) and recvmsg(2).
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictSocketcallCommand();
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-index 642df7207..34f47eb73 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-@@ -29,7 +29,8 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- switch (sysno) {
- case __NR_gettimeofday:
- #if defined(__i386__) || defined(__x86_64__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_time:
- #endif
- return true;
-@@ -52,12 +53,14 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- case __NR_clock_nanosleep_time64: // Parameters filtered by RestrictClockID().
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ftime: // Obsolete.
- #endif
- case __NR_settimeofday: // Privileged.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stime:
- #endif
- default:
-@@ -135,7 +138,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_faccessat: // EPERM not a valid errno.
- case __NR_fchmodat:
- case __NR_fchownat: // Should be called chownat ?
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat: // fstatat(). EPERM not a valid errno.
- #elif defined(__i386__) || defined(__arm__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-@@ -154,7 +157,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_memfd_create:
- case __NR_mkdirat:
- case __NR_mknodat:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldlstat:
- case __NR_oldstat:
- #endif
-@@ -168,7 +171,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- #endif
- case __NR_statfs: // EPERM not a valid errno.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_statfs64:
- #endif
- case __NR_symlinkat:
-@@ -178,7 +182,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_truncate64:
- #endif
- case __NR_unlinkat:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_utime:
- #endif
- case __NR_utimensat: // New.
-@@ -203,7 +208,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- #endif
- return true;
- // TODO(jln): these should be denied gracefully as well (moved below).
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_fadvise64: // EPERM not a valid errno.
- #endif
- #if defined(__i386__)
-@@ -216,11 +222,12 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_flock: // EPERM not a valid errno.
- case __NR_fstatfs: // Give information about the whole filesystem.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_fstatfs64:
- #endif
- case __NR_fsync: // EPERM not a valid errno.
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldfstat:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-@@ -228,6 +235,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_sync_file_range: // EPERM not a valid errno.
- #elif defined(__arm__)
- case __NR_arm_sync_file_range: // EPERM not a valid errno.
-+#elif defined(__powerpc64__)
-+ case __NR_sync_file_range2: // EPERM not a valid errno.
- #endif
- default:
- return false;
-@@ -248,7 +257,8 @@ bool SyscallSets::IsDeniedFileSystemAccessViaFd(int sysno) {
- #endif
- case __NR_getdents64: // EPERM not a valid errno.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_readdir:
- #endif
- return true;
-@@ -289,7 +299,7 @@ bool SyscallSets::IsGetSimpleId(int sysno) {
- bool SyscallSets::IsProcessPrivilegeChange(int sysno) {
- switch (sysno) {
- case __NR_capset:
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_ioperm: // Intel privilege.
- case __NR_iopl: // Intel privilege.
- #endif
-@@ -340,8 +350,11 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- case __NR_rt_sigreturn:
- case __NR_rt_sigtimedwait:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
-+#ifndef __powerpc64__
- case __NR_rt_sigtimedwait_time64:
-+#endif
- case __NR_sigaction:
- case __NR_sigprocmask:
- case __NR_sigreturn:
-@@ -357,7 +370,8 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- #endif
- case __NR_signalfd4:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_sigpending:
- case __NR_sigsuspend:
- #endif
-@@ -381,7 +395,7 @@ bool SyscallSets::IsAllowedOperationOnFd(int sysno) {
- #endif
- case __NR_dup3:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_shutdown:
- #endif
- return true;
-@@ -414,7 +428,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- case __NR_exit_group:
- case __NR_wait4:
- case __NR_waitid:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_waitpid:
- #endif
- return true;
-@@ -431,7 +445,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- #endif
- case __NR_set_tid_address:
- case __NR_unshare:
--#if !defined(__mips__) && !defined(__aarch64__)
-+#if !defined(__mips__) && !defined(__aarch64__) || defined(__powerpc64__)
- case __NR_vfork:
- #endif
- default:
-@@ -484,7 +498,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- return true;
- default:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_socketpair: // We will want to inspect its argument.
- #endif
- return false;
-@@ -494,7 +508,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- switch (sysno) {
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_accept:
- case __NR_accept4:
- case __NR_bind:
-@@ -509,7 +523,8 @@ bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- bool SyscallSets::IsSocketCall(int sysno) {
- switch (sysno) {
-@@ -523,7 +538,8 @@ bool SyscallSets::IsSocketCall(int sysno) {
- }
- #endif
-
--#if defined(__x86_64__) || defined(__arm__) || defined(__mips__)
-+#if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- bool SyscallSets::IsNetworkSocketInformation(int sysno) {
- switch (sysno) {
- case __NR_getpeername:
-@@ -548,7 +564,7 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
- case __NR_mincore:
- case __NR_mlockall:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_mmap:
- #endif
- #if defined(__i386__) || defined(__arm__) || \
-@@ -578,7 +594,8 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- switch (sysno) {
- case __NR_lseek:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR__llseek:
- #endif
- #if !defined(__aarch64__)
-@@ -598,26 +615,28 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- case __NR_readv:
- case __NR_pread64:
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_recv:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_recvfrom: // Could specify source.
- case __NR_recvmsg: // Could specify source.
- #endif
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_select:
- #endif
--#if defined(__i386__) || defined(__arm__) || defined(__mips__)
-+#if defined(__i386__) || defined(__arm__) || defined(__mips__) || defined(__powerpc64__)
- case __NR__newselect:
- #endif
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_send:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_sendmsg: // Could specify destination.
- case __NR_sendto: // Could specify destination.
- #endif
-@@ -673,7 +692,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- return true;
- case __NR_getpriority:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_nice:
- #endif
- case __NR_setpriority:
-@@ -685,7 +705,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- bool SyscallSets::IsAdminOperation(int sysno) {
- switch (sysno) {
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_bdflush:
- #endif
- case __NR_kexec_load:
-@@ -701,7 +722,8 @@ bool SyscallSets::IsAdminOperation(int sysno) {
-
- bool SyscallSets::IsKernelModule(int sysno) {
- switch (sysno) {
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_create_module:
- case __NR_get_kernel_syms: // Should ENOSYS.
- case __NR_query_module:
-@@ -734,7 +756,8 @@ bool SyscallSets::IsFsControl(int sysno) {
- case __NR_swapoff:
- case __NR_swapon:
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_umount:
- #endif
- case __NR_umount2:
-@@ -750,7 +773,7 @@ bool SyscallSets::IsNuma(int sysno) {
- case __NR_getcpu:
- case __NR_mbind:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_migrate_pages:
- #endif
- case __NR_move_pages:
-@@ -785,14 +808,15 @@ bool SyscallSets::IsGlobalProcessEnvironment(int sysno) {
- switch (sysno) {
- case __NR_acct: // Privileged.
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
--#if defined(__i386__) || defined(__arm__)
-+#if defined(__i386__) || defined(__arm__) || defined(__powerpc64__)
- case __NR_ugetrlimit:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ulimit:
- #endif
- case __NR_getrusage:
-@@ -826,7 +850,7 @@ bool SyscallSets::IsGlobalSystemStatus(int sysno) {
- #endif
- case __NR_sysinfo:
- case __NR_uname:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_olduname:
- case __NR_oldolduname:
- #endif
-@@ -892,8 +916,16 @@ bool SyscallSets::IsSystemVSemaphores(int sysno) {
- }
- #endif
-
-+/* shitty hack around Void's 4.19 kernel headers missing those numbers */
-+#if defined(__powerpc64__) && !defined(__NR_shmget)
-+#define __NR_shmget 395
-+#define __NR_shmctl 396
-+#define __NR_shmat 397
-+#define __NR_shmdt 398
-+#endif
-+
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- bool SyscallSets::IsSystemVSharedMemory(int sysno) {
-@@ -925,7 +957,8 @@ bool SyscallSets::IsSystemVMessageQueue(int sysno) {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- bool SyscallSets::IsSystemVIpc(int sysno) {
- switch (sysno) {
-@@ -945,7 +978,8 @@ bool SyscallSets::IsAnySystemV(int sysno) {
- return IsSystemVMessageQueue(sysno) || IsSystemVSemaphores(sysno) ||
- IsSystemVSharedMemory(sysno);
- #elif defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- return IsSystemVIpc(sysno);
- #endif
- }
-@@ -1002,7 +1036,8 @@ bool SyscallSets::IsFaNotify(int sysno) {
- bool SyscallSets::IsTimer(int sysno) {
- switch (sysno) {
- case __NR_getitimer:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_alarm:
- #endif
- case __NR_setitimer:
-@@ -1084,18 +1119,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_syncfs:
- case __NR_vhangup:
- // The system calls below are not implemented.
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_afs_syscall:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_break:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_getpmsg:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_gtty:
- case __NR_idle:
- case __NR_lock:
-@@ -1103,20 +1142,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_prof:
- case __NR_profil:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_putpmsg:
- #endif
- #if defined(__x86_64__)
- case __NR_security:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stty:
- #endif
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- case __NR_tuxcall:
- #endif
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- case __NR_vserver:
- #endif
- return true;
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-index 923533ec9..411f72acd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-@@ -43,13 +43,14 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsDeniedGetOrModifySocket(int sysno);
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- static bool IsSocketCall(int sysno);
- #endif
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- static bool IsNetworkSocketInformation(int sysno);
- #endif
-
-@@ -76,7 +77,7 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsSystemVSemaphores(int sysno);
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- static bool IsSystemVSharedMemory(int sysno);
-@@ -88,7 +89,8 @@ class SANDBOX_EXPORT SyscallSets {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- static bool IsSystemVIpc(int sysno);
- #endif
-diff --git a/sandbox/linux/seccomp-bpf/syscall.cc b/sandbox/linux/seccomp-bpf/syscall.cc
-index e47e98bf5..d53a7ff56 100644
---- a/sandbox/linux/seccomp-bpf/syscall.cc
-+++ b/sandbox/linux/seccomp-bpf/syscall.cc
-@@ -18,7 +18,7 @@ namespace sandbox {
- namespace {
-
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined (ARCH_CPU_PPC64_FAMILY)
- // Number that's not currently used by any Linux kernel ABIs.
- const int kInvalidSyscallNumber = 0x351d3;
- #else
-@@ -310,12 +310,56 @@ asm(// We need to be able to tell the kernel exactly where we made a
- // Enter the kernel
- "svc 0\n"
- "2:ret\n"
-+ ".cfi_endproc\n"
-+ ".size SyscallAsm, .-SyscallAsm\n"
-+#elif defined(__powerpc64__)
-+ ".text\n"
-+ ".align 4\n"
-+ ".type SyscallAsm @function\n"
-+ "SyscallAsm:\n"
-+ ".cfi_startproc\n"
-+
-+ // Check if r3 is negative
-+ "cmpdi 3, 0\n"
-+ "bgt 2f\n"
-+
-+ // Load address of 3f into r3 and return
-+ "mflr 10\n"
-+ "bl 1f\n"
-+ "1: mflr 3\n"
-+ "mtlr 10\n"
-+ "addi 3, 3, 4*13\n"
-+ "blr\n"
-+
-+ // Load arguments from array into r3-8
-+ // save param 3 in r10
-+ "2:\n"
-+ "mr 0, 3\n"
-+ "ld 3, 0(4)\n"
-+ "ld 5, 16(4)\n"
-+ "ld 6, 24(4)\n"
-+ "ld 7, 32(4)\n"
-+ "ld 8, 40(4)\n"
-+ "ld 4, 8(4)\n"
-+ "li 9, 0\n"
-+
-+ // Enter kernel
-+ "sc\n"
-+
-+ // Magic return address
-+ "3:\n"
-+ // Like MIPS, ppc64 return values are always positive.
-+ // Check for error in cr0.SO and negate upon error
-+ "bc 4, 3, 4f\n"
-+ "neg 3, 3\n"
-+ "4: blr\n"
-+
- ".cfi_endproc\n"
- ".size SyscallAsm, .-SyscallAsm\n"
- #endif
- ); // asm
-
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- extern "C" {
- intptr_t SyscallAsm(intptr_t nr, const intptr_t args[6]);
- }
-@@ -429,6 +473,8 @@ intptr_t Syscall::Call(int nr,
- ret = inout;
- }
-
-+#elif defined(__powerpc64__)
-+ intptr_t ret = SyscallAsm(nr, args);
- #else
- #error "Unimplemented architecture"
- #endif
-@@ -445,8 +491,18 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // needs to be changed back.
- ret_val = -ret_val;
- SECCOMP_PARM4(ctx) = 1;
-- } else
-+ } else {
- SECCOMP_PARM4(ctx) = 0;
-+ }
-+#endif
-+#if defined(__powerpc64__)
-+ // Same as MIPS, need to invert ret and set error register (cr0.SO)
-+ if (ret_val <= -1 && ret_val >= -4095) {
-+ ret_val = -ret_val;
-+ ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ } else {
-+ ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
- }
-diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc
-index f5b86a73a..5e6c4a068 100644
---- a/sandbox/linux/seccomp-bpf/trap.cc
-+++ b/sandbox/linux/seccomp-bpf/trap.cc
-@@ -232,6 +232,20 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
- SetIsInSigHandler();
- }
-
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO(shawn@anastas.io): investigate this issue further
-+ auto nr = SECCOMP_SYSCALL(ctx);
-+ if (nr == __NR_openat || nr == __NR_mkdirat || nr == __NR_faccessat || nr == __NR_readlinkat ||
-+ nr == __NR_renameat || nr == __NR_renameat2 || nr == __NR_newfstatat || nr == __NR_unlinkat) {
-+ if (static_cast<int>(SECCOMP_PARM1(ctx)) > 0) {
-+ SECCOMP_PARM1(ctx) = -SECCOMP_PARM1(ctx);
-+ }
-+ }
-+#endif
-+
- // Copy the seccomp-specific data into a arch_seccomp_data structure. This
- // is what we are showing to TrapFnc callbacks that the system call
- // evaluator registered with the sandbox.
-diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc
-index d7b5d8c44..4adc6d0d4 100644
---- a/sandbox/linux/services/credentials.cc
-+++ b/sandbox/linux/services/credentials.cc
-@@ -81,7 +81,7 @@ bool ChrootToSafeEmptyDir() {
- pid_t pid = -1;
- alignas(16) char stack_buf[PTHREAD_STACK_MIN];
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // The stack grows downward.
- void* stack = stack_buf + sizeof(stack_buf);
- #else
-@@ -90,7 +90,9 @@
-
- int clone_flags = CLONE_FS | LINUX_SIGCHLD;
- void* tls = nullptr;
--#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
-+// RAJA this might be it...
-+#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY) || \
-+ defined(ARCH_CPU_PPC64_FAMILY)) && \
- !defined(MEMORY_SANITIZER)
- // Use CLONE_VM | CLONE_VFORK as an optimization to avoid copying page tables.
- // Since clone writes to the new child's TLS before returning, we must set a
-@@ -98,6 +100,11 @@
- // glibc performs syscalls by calling a function pointer in TLS, so we do not
- // attempt this optimization.
- // TODO(crbug.com/1247458) Broken in MSan builds after LLVM f1bb30a4956f.
-+ //
-+ // NOTE: Without CLONE_VM, fontconfig will attempt to reload configuration
-+ // in every thread. Since the rendered threads are sandboxed without
-+ // filesystem access (e.g. to /etc/fonts/fonts.conf) this will cause font
-+ // configuraiton loading failures and no fonts will be displayed!
- clone_flags |= CLONE_VM | CLONE_VFORK | CLONE_SETTLS;
-
- char tls_buf[PTHREAD_STACK_MIN] = {0};
-diff --git a/sandbox/linux/services/syscall_wrappers.cc b/sandbox/linux/services/syscall_wrappers.cc
-index fcfd2aa12..f6eb32fb7 100644
---- a/sandbox/linux/services/syscall_wrappers.cc
-+++ b/sandbox/linux/services/syscall_wrappers.cc
-@@ -58,7 +58,7 @@ long sys_clone(unsigned long flags,
- #if defined(ARCH_CPU_X86_64)
- return syscall(__NR_clone, flags, child_stack, ptid, ctid, tls);
- #elif defined(ARCH_CPU_X86) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // CONFIG_CLONE_BACKWARDS defined.
- return syscall(__NR_clone, flags, child_stack, ptid, tls, ctid);
- #endif
-diff --git a/sandbox/linux/syscall_broker/broker_process.cc b/sandbox/linux/syscall_broker/broker_process.cc
-index d72c9d238..77f1d95f5 100644
---- a/sandbox/linux/syscall_broker/broker_process.cc
-+++ b/sandbox/linux/syscall_broker/broker_process.cc
-@@ -169,7 +169,7 @@ bool BrokerProcess::IsSyscallBrokerable(int sysno, bool fast_check) const {
- #if defined(__NR_fstatat64)
- case __NR_fstatat64:
- #endif
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat:
- #endif
- return !fast_check || allowed_command_set_.test(COMMAND_STAT);
-diff --git a/sandbox/linux/system_headers/linux_seccomp.h b/sandbox/linux/system_headers/linux_seccomp.h
-index 1fa47ed09..39cc9ab53 100644
---- a/sandbox/linux/system_headers/linux_seccomp.h
-+++ b/sandbox/linux/system_headers/linux_seccomp.h
-@@ -41,6 +41,9 @@
- #ifndef EM_AARCH64
- #define EM_AARCH64 183
- #endif
-+#ifndef EM_PPC64
-+#define EM_PPC64 21
-+#endif
-
- #ifndef __AUDIT_ARCH_64BIT
- #define __AUDIT_ARCH_64BIT 0x80000000
-@@ -73,6 +76,12 @@
- #ifndef AUDIT_ARCH_AARCH64
- #define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
- #endif
-+#ifndef AUDIT_ARCH_PPC64
-+#define AUDIT_ARCH_PPC64 (EM_PPC64 | __AUDIT_ARCH_64BIT)
-+#endif
-+#ifndef AUDIT_ARCH_PPC64LE
-+#define AUDIT_ARCH_PPC64LE (EM_PPC64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
-+#endif
-
- // For prctl.h
- #ifndef PR_SET_SECCOMP
-diff --git a/sandbox/linux/system_headers/linux_signal.h b/sandbox/linux/system_headers/linux_signal.h
-index f5a736761..515b21a5f 100644
---- a/sandbox/linux/system_headers/linux_signal.h
-+++ b/sandbox/linux/system_headers/linux_signal.h
-@@ -13,7 +13,7 @@
- // (not undefined, but defined different values and in different memory
- // layouts). So, fill the gap here.
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
-
- #define LINUX_SIGHUP 1
- #define LINUX_SIGINT 2
-diff --git a/sandbox/linux/system_headers/linux_syscalls.h b/sandbox/linux/system_headers/linux_syscalls.h
-index 2b78a0cc3..0a70f5ea5 100644
---- a/sandbox/linux/system_headers/linux_syscalls.h
-+++ b/sandbox/linux/system_headers/linux_syscalls.h
-@@ -35,5 +35,9 @@
- #include "sandbox/linux/system_headers/arm64_linux_syscalls.h"
- #endif
-
-+#if defined(__powerpc64__)
-+#include "sandbox/linux/system_headers/ppc64_linux_syscalls.h"
-+#endif
-+
- #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SYSCALLS_H_
-
-diff --git a/sandbox/linux/system_headers/ppc64_linux_syscalls.h b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-new file mode 100644
-index 000000000..ccacffe22
---- /dev/null
-+++ b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-@@ -0,0 +1,12 @@
-+// Copyright 2014 The Chromium Authors. All rights reserved.
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+#define SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+
-+#include <asm/unistd.h>
-+
-+//TODO: is it necessary to redefine syscall numbers for PPC64?
-+
-+#endif // SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-diff --git a/sandbox/policy/linux/bpf_utility_policy_linux.cc b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_utility_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-@@ -34,7 +34,7 @@
- case __NR_fdatasync:
- case __NR_fsync:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
- #if defined(__i386__) || defined(__arm__)
-diff --git a/sandbox/policy/linux/bpf_renderer_policy_linux.cc b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-@@ -15,6 +15,11 @@
- #include "sandbox/linux/system_headers/linux_syscalls.h"
- #include "sandbox/policy/linux/sandbox_linux.h"
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- // TODO(vignatti): replace the local definitions below with #include
- // <linux/dma-buf.h> once kernel version 4.6 becomes widely used.
- #include <linux/types.h>
-@@ -77,7 +77,7 @@
- case __NR_ftruncate64:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- case __NR_setrlimit:
- // We allow setrlimit to dynamically adjust the address space limit as
-diff --git a/third_party/angle/src/compiler/translator/InfoSink.h b/third_party/angle/src/compiler/translator/InfoSink.h
-index 3a807e1e3..5258617a7 100644
---- a/third_party/angle/src/compiler/translator/InfoSink.h
-+++ b/third_party/angle/src/compiler/translator/InfoSink.h
-@@ -92,7 +92,16 @@ class TInfoSinkBase
- stream.precision(8);
- stream << f;
- }
-- sink.append(stream.str());
-+
-+ // Hack to work around a bug where negative floating point values
-+ // are rendered like '.0.5' instead of '-0.5'
-+ std::string res(stream.str());
-+
-+ if (signbit(f)) { // test if f is negative
-+ res[0] = '-';
-+ }
-+
-+ sink.append(res);
- return *this;
- }
- // Write boolean values as their names instead of integral value.
-diff --git a/third_party/angle/src/libANGLE/Constants.h b/third_party/angle/src/libANGLE/Constants.h
-index fcbc9246a..39ae66148 100644
---- a/third_party/angle/src/libANGLE/Constants.h
-+++ b/third_party/angle/src/libANGLE/Constants.h
-@@ -9,6 +9,7 @@
- #ifndef LIBANGLE_CONSTANTS_H_
- #define LIBANGLE_CONSTANTS_H_
-
-+#include <cstddef>
- #include "common/platform.h"
-
- #include <stdint.h>
-diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
-index 17cf9cda9..8ce96bd32 100644
---- a/third_party/boringssl/BUILD.gn
-+++ b/third_party/boringssl/BUILD.gn
-@@ -103,6 +103,13 @@ if (is_win && !is_msan && current_cpu != "arm64") {
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-+ } else if (current_cpu == "ppc64") {
-+ if (is_linux) {
-+ # TODO: ppc64 (be) check
-+ sources += crypto_sources_linux_ppc64le
-+ } else {
-+ public_configs = [ ":no_asm_config" ]
-+ }
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-diff --git a/third_party/breakpad/BUILD.gn b/third_party/breakpad/BUILD.gn
-index 4af3d7bbf..adbf54159 100644
---- a/third_party/breakpad/BUILD.gn
-+++ b/third_party/breakpad/BUILD.gn
-@@ -596,7 +596,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/minidump_file_writer.h",
- "breakpad/src/common/convert_UTF.cc",
- "breakpad/src/common/convert_UTF.h",
-- "breakpad/src/common/linux/breakpad_getcontext.S",
- "breakpad/src/common/linux/elf_core_dump.cc",
- "breakpad/src/common/linux/elf_core_dump.h",
- "breakpad/src/common/linux/elfutils.cc",
-@@ -634,6 +633,14 @@ if (is_linux || is_chromeos || is_android) {
-
- libs = [ "dl" ]
-
-+ if (current_cpu == "ppc64") {
-+ defines = [ "HAVE_GETCONTEXT" ]
-+ } else {
-+ sources += [
-+ "breakpad/src/common/linux/breakpad_getcontext.S"
-+ ]
-+ }
-+
- include_dirs = [
- ".",
- "breakpad/src",
-@@ -682,7 +689,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc",
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
- "breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
-- "breakpad/src/common/linux/breakpad_getcontext_unittest.cc",
- "breakpad/src/common/linux/elf_core_dump_unittest.cc",
- "breakpad/src/common/linux/file_id_unittest.cc",
- "breakpad/src/common/linux/linux_libc_support_unittest.cc",
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-index 07d9171a0..9aed4cb36 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-@@ -44,6 +44,8 @@ typedef MDRawContextARM RawContextCPU;
- typedef MDRawContextARM64_Old RawContextCPU;
- #elif defined(__mips__)
- typedef MDRawContextMIPS RawContextCPU;
-+#elif defined(__powerpc64__)
-+typedef MDRawContextPPC64 RawContextCPU;
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index aae1dc13b..03afec7a5 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -270,7 +270,42 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->float_save.fir = mcontext.fpc_eir;
- #endif
- }
--#endif // __mips__
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t ThreadInfo::GetInstructionPointer() const {
-+ return mcontext.gp_regs[PT_NIP];
-+}
-+
-+void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = mcontext.gp_regs[i];
-+
-+ out->lr = mcontext.gp_regs[PT_LNK];
-+ out->srr0 = mcontext.gp_regs[PT_NIP];
-+ out->srr1 = mcontext.gp_regs[PT_MSR];
-+ out->cr = mcontext.gp_regs[PT_CCR];
-+ out->xer = mcontext.gp_regs[PT_XER];
-+ out->ctr = mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] = \
-+ {(((uint64_t)vregs.vrregs[i][0]) << 32)
-+ | vregs.vrregs[i][1],
-+ (((uint64_t)vregs.vrregs[i][2]) << 32)
-+ | vregs.vrregs[i][3]};
-+
-+ out->vrsave = vregs.vrsave;
-+ out->vector_save.save_vscr = {0, vregs.vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+#endif // __powerpc64__
-
- void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- assert(gp_regs || size);
-@@ -279,6 +314,11 @@ void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- *gp_regs = mcontext.gregs;
- if (size)
- *size = sizeof(mcontext.gregs);
-+#elif defined(__powerpc64__)
-+ if (gp_regs)
-+ *gp_regs = mcontext.gp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.gp_regs);
- #else
- if (gp_regs)
- *gp_regs = ®s;
-@@ -294,6 +334,11 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- *fp_regs = &mcontext.fpregs;
- if (size)
- *size = sizeof(mcontext.fpregs);
-+#elif defined(__powerpc64__)
-+ if (fp_regs)
-+ *fp_regs = &mcontext.fp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.fp_regs);
- #else
- if (fp_regs)
- *fp_regs = &fpregs;
-@@ -302,4 +347,13 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- #endif
- }
-
-+#if defined(__powerpc64__)
-+void ThreadInfo::GetVectorRegisters(void** v_regs, size_t* size) {
-+ if (v_regs)
-+ *v_regs = &vregs;
-+ if (size)
-+ *size = sizeof(vregs);
-+}
-+#endif
-+
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-index fb216fa6d..593aac822 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-@@ -68,6 +68,10 @@ struct ThreadInfo {
- // Use the structures defined in <sys/user.h>
- struct user_regs_struct regs;
- struct user_fpsimd_struct fpregs;
-+#elif defined(__powerpc64__)
-+ // Use the structures defined in <sys/ucontext.h>.
-+ mcontext_t mcontext;
-+ vrregset_t vregs;
- #elif defined(__mips__)
- // Use the structure defined in <sys/ucontext.h>.
- mcontext_t mcontext;
-@@ -84,6 +88,11 @@ struct ThreadInfo {
-
- // Returns the pointer and size of float point register area.
- void GetFloatingPointRegisters(void** fp_regs, size_t* size);
-+
-+#if defined(__powerpc64__)
-+ // Returns the pointer and size of the vector register area. (PPC64 only)
-+ void GetVectorRegisters(void** v_regs, size_t* size);
-+#endif
- };
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 6eec1be24..741983a1a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -254,6 +254,48 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc) {
- out->float_save.fir = uc->uc_mcontext.fpc_eir; // Unused.
- #endif
- }
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
-+}
-+
-+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[PT_NIP];
-+}
-+
-+void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
-+ const vrregset_t* vregs) {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = uc->uc_mcontext.gp_regs[i];
-+
-+ out->lr = uc->uc_mcontext.gp_regs[PT_LNK];
-+ out->srr0 = uc->uc_mcontext.gp_regs[PT_NIP];
-+ out->srr1 = uc->uc_mcontext.gp_regs[PT_MSR];
-+ out->cr = uc->uc_mcontext.gp_regs[PT_CCR];
-+ out->xer = uc->uc_mcontext.gp_regs[PT_XER];
-+ out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] =
-+ {(((uint64_t)vregs->vrregs[i][0]) << 32)
-+ | vregs->vrregs[i][1],
-+ (((uint64_t)vregs->vrregs[i][2]) << 32)
-+ | vregs->vrregs[i][3]};
-+
-+ out->vrsave = vregs->vrsave;
-+ out->vector_save.save_vscr = {0, vregs->vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+
- #endif
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-index 7d4100881..c122ac92e 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-@@ -55,6 +55,9 @@ struct UContextReader {
- #elif defined(__aarch64__)
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- const struct fpsimd_context* fpregs);
-+#elif defined(__powerpc64__)
-+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
-+ const vrregset_t* vregs);
- #else
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc);
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index a6cb5f984..ae16b64d9 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -461,9 +461,16 @@ bool ExceptionHandler::HandleSignal(int /*sig*/, siginfo_t* info, void* uc) {
- memcpy(&g_crash_context_.float_state, fp_ptr,
- sizeof(g_crash_context_.float_state));
- }
-+#elif defined(__powerpc64__)
-+ // On PPC64, we must copy VR state
-+ ucontext_t* uc_ptr = (ucontext_t*)uc;
-+ if (uc_ptr->uc_mcontext.v_regs) {
-+ memcpy(&g_crash_context_.vector_state, uc_ptr->uc_mcontext.v_regs,
-+ sizeof(g_crash_context_.vector_state));
-+ }
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- // FP state is not part of user ABI on ARM Linux.
-- // In case of MIPS Linux FP state is already part of ucontext_t
-+ // In case of MIPS, Linux FP state is already part of ucontext_t
- // and 'float_state' is not a member of CrashContext.
- ucontext_t* uc_ptr = (ucontext_t*)uc;
- if (uc_ptr->uc_mcontext.fpregs) {
-@@ -708,11 +715,19 @@ bool ExceptionHandler::WriteMinidump() {
- }
- #endif
-
--#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__)
-+#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__) \
-+ && !defined(__powerpc64__)
- // FPU state is not part of ARM EABI ucontext_t.
- memcpy(&context.float_state, context.context.uc_mcontext.fpregs,
- sizeof(context.float_state));
- #endif
-+
-+#if defined(__powerpc64__)
-+ // Vector registers must be copied on PPC64
-+ memcpy(&context.vector_state, context.context.uc_mcontext.v_regs,
-+ sizeof(context.vector_state));
-+#endif
-+
- context.tid = sys_gettid();
-
- // Add an exception stream to the minidump for better reporting.
-@@ -733,6 +748,9 @@ bool ExceptionHandler::WriteMinidump() {
- #elif defined(__mips__)
- context.siginfo.si_addr =
- reinterpret_cast<void*>(context.context.uc_mcontext.pc);
-+#elif defined(__powerpc64__)
-+ context.siginfo.si_addr =
-+ reinterpret_cast<void*>(context.context.uc_mcontext.gp_regs[PT_NIP]);
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-index f80843ea7..260dd10f7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-@@ -192,7 +192,11 @@ class ExceptionHandler {
- siginfo_t siginfo;
- pid_t tid; // the crashing thread.
- ucontext_t context;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ // PPC64's FP state is a part of ucontext_t like MIPS but the vector
-+ // state is not, so a struct is needed.
-+ vstate_t vector_state;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- // #ifdef this out because FP state is not part of user ABI for Linux ARM.
- // In case of MIPS Linux FP state is already part of ucontext_t so
- // 'float_state' is not required.
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-index 35dcbfd4d..7934370fd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-@@ -307,7 +307,7 @@ TEST(ExceptionHandlerTest, ParallelChildCrashesDontHang) {
- }
-
- // Wait a while until the child should have crashed.
-- usleep(1000000);
-+ usleep(2000000);
- // Kill the child if it is still running.
- kill(child, SIGKILL);
-
-@@ -559,6 +559,8 @@ const unsigned char kIllegalInstruction[] = {
- #if defined(__mips__)
- // mfc2 zero,Impl - usually illegal in userspace.
- 0x48, 0x00, 0x00, 0x48
-+#elif defined(__powerpc64__)
-+ 0x01, 0x01, 0x01, 0x01 // Crashes on a tested POWER9 cpu
- #else
- // This crashes with SIGILL on x86/x86-64/arm.
- 0xff, 0xff, 0xff, 0xff
-@@ -754,10 +756,10 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
-
- // These are defined here so the parent can use them to check the
- // data from the minidump afterwards.
-- // Use 4k here because the OS will hand out a single page even
-+ // Use the page size here because the OS will hand out a single page even
- // if a smaller size is requested, and this test wants to
- // test the upper bound of the memory range.
-- const uint32_t kMemorySize = 4096; // bytes
-+ const uint32_t kMemorySize = getpagesize(); // bytes
- const int kOffset = kMemorySize - sizeof(kIllegalInstruction);
-
- const pid_t child = fork();
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-index fa3c1713a..6ce709e2f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-@@ -138,7 +138,9 @@ class MicrodumpWriter {
- const MicrodumpExtraInfo& microdump_extra_info,
- LinuxDumper* dumper)
- : ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -337,6 +339,8 @@ class MicrodumpWriter {
- # else
- # error "This mips ABI is currently not supported (n32)"
- #endif
-+#elif defined(__powerpc64__)
-+ const char kArch[] = "ppc64";
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -409,7 +413,9 @@ class MicrodumpWriter {
- void DumpCPUState() {
- RawContextCPU cpu;
- my_memset(&cpu, 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(&cpu, ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(&cpu, ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(&cpu, ucontext_);
-@@ -605,7 +611,9 @@ class MicrodumpWriter {
- void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); }
-
- const ucontext_t* const ucontext_;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_;
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-index 6339ac0cd..291af106b 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-@@ -279,10 +279,19 @@ TEST(MicrodumpWriterTest, BasicWithMappings) {
- CrashAndGetMicrodump(mappings, MicrodumpExtraInfo(), &buf);
- ASSERT_TRUE(ContainsMicrodump(buf));
-
-+ int page_size = getpagesize();
- #ifdef __LP64__
-- ASSERT_NE(std::string::npos,
-- buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-- "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ // This test is only available for the following page sizes
-+ ASSERT_TRUE((page_size == 4096) || (page_size == 65536));
-+ if (page_size == 4096) {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ } else {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000010000 000000000000002A 0000000000010000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ }
- #else
- ASSERT_NE(std::string::npos,
- buf.find("M 00001000 0000002A 00001000 "
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-index 415068983..b93e4afcf 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-@@ -112,6 +112,9 @@ bool LinuxCoreDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-@@ -197,7 +200,10 @@ bool LinuxCoreDumper::EnumerateThreads() {
- memset(&info, 0, sizeof(ThreadInfo));
- info.tgid = status->pr_pgrp;
- info.ppid = status->pr_ppid;
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ for (int i = 0; i < 31; i++)
-+ info.mcontext.gp_regs[i] = status->pr_reg[i];
-+#elif defined(__mips__)
- #if defined(__ANDROID__)
- for (int i = EF_R0; i <= EF_R31; i++)
- info.mcontext.gregs[i - EF_R0] = status->pr_reg[i];
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-index 7fd6532ad..199cbfffd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-@@ -765,7 +765,9 @@ bool LinuxDumper::GetStackInfo(const void** stack, size_t* stack_len,
- reinterpret_cast<uint8_t*>(int_stack_pointer & ~(page_size - 1));
-
- // The number of bytes of stack which we try to capture.
-- static const ptrdiff_t kStackToCapture = 32 * 1024;
-+ // This now depends on page_size to avoid missing data
-+ // on systems with larger page sizes.
-+ static const ptrdiff_t kStackToCapture = 8 * page_size;
-
- const MappingInfo* mapping = FindMapping(stack_pointer);
- if (!mapping)
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-index 7bee160f1..07bb2b81a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-@@ -63,7 +63,8 @@ namespace google_breakpad {
- (defined(__mips__) && _MIPS_SIM == _ABIO32)
- typedef Elf32_auxv_t elf_aux_entry;
- #elif defined(__x86_64) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM != _ABIO32)
-+ (defined(__mips__) && _MIPS_SIM != _ABIO32) || \
-+ defined(__powerpc64__)
- typedef Elf64_auxv_t elf_aux_entry;
- #endif
-
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-index 331f4bb34..3f722947f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-@@ -51,6 +51,8 @@
- #define TID_PTR_REGISTER "rcx"
- #elif defined(__mips__)
- #define TID_PTR_REGISTER "$1"
-+#elif defined(__powerpc64__)
-+#define TID_PTR_REGISTER "r8"
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-index e3ddb81a6..fa28575ef 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-@@ -149,19 +149,27 @@ bool LinuxPtraceDumper::CopyFromProcess(void* dest, pid_t child,
- return true;
- }
-
--bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid)
--{
-+bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid) {
- #ifdef PTRACE_GETREGSET
- struct iovec io;
- info->GetGeneralPurposeRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
- return false;
- }
-
- info->GetFloatingPointRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
- return false;
- }
-+
-+#if defined(__powerpc64__)
-+ // Grab the vector registers on PPC64 too
-+ info->GetVectorRegisters(&io.iov_base, &io.iov_len);
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PPC_VMX, (void*)&io) == -1) {
-+ return false;
-+ }
-+#endif // defined(__powerpc64__)
-+
- return true;
- #else
- return false;
-@@ -298,6 +306,9 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-index da71e15dc..12bfb317a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-@@ -462,6 +462,9 @@ TEST(LinuxPtraceDumperTest, VerifyStackReadWithMultipleThreads) {
- #elif defined(__mips__)
- pid_t* process_tid_location =
- reinterpret_cast<pid_t*>(one_thread.mcontext.gregs[1]);
-+#elif defined(__powerpc64__)
-+ pid_t* process_tid_location =
-+ reinterpret_cast<pid_t*>(one_thread.mcontext.gp_regs[8]);
- #else
- #error This test has not been ported to this platform.
- #endif
-@@ -559,6 +562,8 @@ TEST_F(LinuxPtraceDumperTest, SanitizeStackCopy) {
- uintptr_t heap_addr = thread_info.regs.rcx;
- #elif defined(__mips__)
- uintptr_t heap_addr = thread_info.mcontext.gregs[1];
-+#elif defined(__powerpc64__)
-+ uintptr_t heap_addr = thread_info.mcontext.gp_regs[8];
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-index 32634ef00..2a56948de 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-@@ -136,7 +136,9 @@ class MinidumpWriter {
- : fd_(minidump_fd),
- path_(minidump_path),
- ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -468,7 +470,9 @@ class MinidumpWriter {
- if (!cpu.Allocate())
- return false;
- my_memset(cpu.get(), 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(cpu.get(), ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(cpu.get(), ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(cpu.get(), ucontext_);
-@@ -897,7 +901,7 @@ class MinidumpWriter {
- dirent->location.rva = 0;
- }
-
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || defined(__powerpc64__)
- bool WriteCPUInformation(MDRawSystemInfo* sys_info) {
- char vendor_id[sizeof(sys_info->cpu.x86_cpu_info.vendor_id) + 1] = {0};
- static const char vendor_id_name[] = "vendor_id";
-@@ -917,7 +921,9 @@ class MinidumpWriter {
-
- // processor_architecture should always be set, do this first
- sys_info->processor_architecture =
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ MD_CPU_ARCHITECTURE_PPC64;
-+#elif defined(__mips__)
- # if _MIPS_SIM == _ABIO32
- MD_CPU_ARCHITECTURE_MIPS;
- # elif _MIPS_SIM == _ABI64
-@@ -1333,7 +1339,9 @@ class MinidumpWriter {
- const char* path_; // Path to the file where the minidum should be written.
-
- const ucontext_t* const ucontext_; // also from the signal handler
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_; // ditto
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-index e3b0b16da..ccd8aa0a4 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-@@ -48,6 +48,8 @@ class ExceptionHandler;
-
- #if defined(__aarch64__)
- typedef struct fpsimd_context fpstate_t;
-+#elif defined(__powerpc64__)
-+typedef vrregset_t vstate_t;
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- typedef std::remove_pointer<fpregset_t>::type fpstate_t;
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-index d192e5cbb..fc1bfa8d7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-@@ -715,6 +715,9 @@ TEST(MinidumpWriterTest, InvalidStackPointer) {
- #elif defined(__mips__)
- context.context.uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP] =
- invalid_stack_pointer;
-+#elif defined(__powerpc64__)
-+ context.context.uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP] =
-+ invalid_stack_pointer;
- #else
- # error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-index 99362945c..c54ba7145 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-@@ -65,8 +65,7 @@ bool MemoryMappedFile::Map(const char* path, size_t offset) {
- }
-
- #if defined(__x86_64__) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM == _ABI64)
--
-+ (defined(__mips__) && _MIPS_SIM == _ABI64) || defined(__powerpc64__)
- struct kernel_stat st;
- if (sys_fstat(fd, &st) == -1 || st.st_size < 0) {
- #else
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-index fad59f40c..616496d67 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-@@ -176,9 +176,10 @@ TEST_F(MemoryMappedFileTest, RemapAfterMap) {
- TEST_F(MemoryMappedFileTest, MapWithOffset) {
- // Put more data in the test file this time. Offsets can only be
- // done on page boundaries, so we need a two page file to test this.
-- const int page_size = 4096;
-- char data1[2 * page_size];
-- size_t data1_size = sizeof(data1);
-+ const int page_size = getpagesize();
-+ char *data1 = static_cast<char*>(malloc(2 * page_size));
-+ EXPECT_TRUE(data1 != NULL);
-+ size_t data1_size = (2 * page_size);
- for (size_t i = 0; i < data1_size; ++i) {
- data1[i] = i & 0x7f;
- }
-diff --git a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-index 5803b90d5..2a1cf14f0 100644
---- a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-@@ -57,8 +57,9 @@ TEST(PageAllocatorTest, LargeObject) {
-
- EXPECT_EQ(0U, allocator.pages_allocated());
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(10000));
-+ uint64_t expected_pages = 1 + ((10000 - 1) / getpagesize());
- ASSERT_FALSE(p == NULL);
-- EXPECT_EQ(3U, allocator.pages_allocated());
-+ EXPECT_EQ(expected_pages, allocator.pages_allocated());
- for (unsigned i = 1; i < 10; ++i) {
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(i));
- ASSERT_FALSE(p == NULL);
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-index 798056dfa..22bd81fff 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-@@ -202,12 +202,14 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) {
- // Check architecture and set architecture variable to corresponding flag
- // in objdump.
- switch (context->GetContextCPU()) {
-+#if defined(__i386) || defined(__x86_64)
- case MD_CONTEXT_X86:
- architecture = "i386";
- break;
- case MD_CONTEXT_AMD64:
- architecture = "i386:x86-64";
- break;
-+#endif
- default:
- // Unsupported architecture. Note that ARM architectures are not
- // supported because objdump does not support ARM.
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-index 528ee5f21..72764d6c1 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-@@ -104,6 +104,8 @@ ExploitabilityFor(const string& filename) {
- }
-
- TEST(ExploitabilityTest, TestWindowsEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("ascii_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -136,9 +138,12 @@ TEST(ExploitabilityTest, TestWindowsEngine) {
- ExploitabilityFor("read_av_clobber_write.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_LOW,
- ExploitabilityFor("read_av_conditional.dmp"));
-+#endif
- }
-
- TEST(ExploitabilityTest, TestLinuxEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if defined(__i386) || defined(__x86_64)
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_null_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -171,7 +176,8 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_executable_heap.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_jmp_to_module_not_exe_region.dmp"));
--#ifndef _WIN32
-+#endif
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_write_to_nonwritable_module.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -182,10 +188,10 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_write_to_outside_module_via_math.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_write_to_under_4k.dmp"));
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (!defined(__i386) && !defined(__x86_64))
- }
-
--#ifndef _WIN32
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- TEST(ExploitabilityLinuxUtilsTest, DisassembleBytesTest) {
- ASSERT_FALSE(ExploitabilityLinuxTest::DisassembleBytes("", NULL, 5, NULL));
- uint8_t bytes[6] = {0xc7, 0x0, 0x5, 0x0, 0x0, 0x0};
-@@ -301,6 +307,7 @@ TEST(ExploitabilityLinuxUtilsTest, CalculateAddressTest) {
- context,
- &write_address));
- }
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
-+
-
- } // namespace
-diff --git a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-index aade82c99..195aa73f3 100644
---- a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-+++ b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-@@ -77,6 +77,8 @@
- #define ELF_ARCH EM_MIPS
- #elif defined(__aarch64__)
- #define ELF_ARCH EM_AARCH64
-+#elif defined(__powerpc64__)
-+ #define ELF_ARCH EM_PPC64
- #endif
-
- #if defined(__arm__)
-@@ -87,6 +89,8 @@ typedef user_regs user_regs_struct;
- #elif defined (__mips__)
- // This file-local typedef simplifies the source code.
- typedef gregset_t user_regs_struct;
-+#elif defined(__powerpc64__)
-+typedef struct pt_regs user_regs_struct;
- #endif
-
- using google_breakpad::MDTypeHelper;
-@@ -321,6 +325,9 @@ struct CrashedProcess {
- #endif
- #if defined(__aarch64__)
- user_fpsimd_struct fpregs;
-+#endif
-+#if defined(__powerpc64__)
-+ mcontext_t mcontext;
- #endif
- uintptr_t stack_addr;
- const uint8_t* stack;
-@@ -535,6 +542,38 @@ ParseThreadRegisters(CrashedProcess::Thread* thread,
- thread->mcontext.fpc_eir = rawregs->float_save.fir;
- #endif
- }
-+#elif defined(__powerpc64__)
-+static void
-+ParseThreadRegisters(CrashedProcess::Thread* thread,
-+ const MinidumpMemoryRange& range) {
-+ const MDRawContextPPC64* rawregs = range.GetData<MDRawContextPPC64>(0);
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ thread->mcontext.gp_regs[i] = rawregs->gpr[i];
-+
-+ thread->mcontext.gp_regs[PT_LNK] = rawregs->lr;
-+ thread->mcontext.gp_regs[PT_NIP] = rawregs->srr0;
-+ thread->mcontext.gp_regs[PT_MSR] = rawregs->srr1;
-+ thread->mcontext.gp_regs[PT_CCR] = rawregs->cr;
-+ thread->mcontext.gp_regs[PT_XER] = rawregs->xer;
-+ thread->mcontext.gp_regs[PT_CTR] = rawregs->ctr;
-+ thread->mcontext.v_regs->vrsave = rawregs->vrsave;
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ thread->mcontext.fp_regs[i] = rawregs->float_save.fpregs[i];
-+
-+ thread->mcontext.fp_regs[NFPREG-1] = rawregs->float_save.fpscr;
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++) {
-+ thread->mcontext.v_regs->vrregs[i][0] = rawregs->vector_save.save_vr[i].high >> 32;
-+ thread->mcontext.v_regs->vrregs[i][1] = rawregs->vector_save.save_vr[i].high;
-+ thread->mcontext.v_regs->vrregs[i][2] = rawregs->vector_save.save_vr[i].low >> 32;
-+ thread->mcontext.v_regs->vrregs[i][3] = rawregs->vector_save.save_vr[i].low;
-+ }
-+
-+ thread->mcontext.v_regs->vscr.vscr_word = rawregs->vector_save.save_vscr.low & 0xFFFFFFFF;
-+}
-+
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -623,6 +662,12 @@ ParseSystemInfo(const Options& options, CrashedProcess* crashinfo,
- # else
- # error "This mips ABI is currently not supported (n32)"
- # endif
-+#elif defined(__powerpc64__)
-+ if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_PPC64) {
-+ fprintf(stderr,
-+ "This version of minidump-2-core only supports PPC64.\n");
-+ exit(1);
-+ }
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-diff --git a/third_party/crashpad/crashpad/CONTRIBUTORS b/third_party/crashpad/crashpad/CONTRIBUTORS
-index 8724b7f32..8e29424ef 100644
---- a/third_party/crashpad/crashpad/CONTRIBUTORS
-+++ b/third_party/crashpad/crashpad/CONTRIBUTORS
-@@ -13,3 +13,4 @@ Mark Mentovai <mark@chromium.org>
- Robert Sesek <rsesek@chromium.org>
- Scott Graham <scottmg@chromium.org>
- Joshua Peraza <jperaza@chromium.org>
-+Shawn Anastasio <shawn@anastas.io>
-diff --git a/third_party/crashpad/crashpad/compat/linux/sys/user.h b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-index 6ed77a98e..1fd83469a 100644
---- a/third_party/crashpad/crashpad/compat/linux/sys/user.h
-+++ b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_COMPAT_LINUX_SYS_USER_H_
- #define CRASHPAD_COMPAT_LINUX_SYS_USER_H_
-
-+#include <cstddef>
- #include_next <sys/user.h>
-
- #include <features.h>
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context.h b/third_party/crashpad/crashpad/minidump/minidump_context.h
-index 3a3e603cb..3118d9e9f 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context.h
-@@ -592,6 +592,70 @@ struct MinidumpContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief ppc64-specific flags for MinidumpPPC64::context_flags
-+//! Based on minidump_cpu_ppc64.h from breakpad
-+enum MinidumpContextPPC64Flags : uint32_t {
-+ //! \brief Identifies the context as PPC64.
-+ kMinidumpContextPPC64 = 0x01000000,
-+
-+ //! \brief Indicates the validity of general purpose registers.
-+ //!
-+ //! Registers `r0`-`r31`, `nip`, `msr`, `lr`, etc. are valid.
-+ kMinidumpContextPPC64Base = kMinidumpContextPPC64 | 0x00000001,
-+
-+ //! \brief Indicates the validity of floating point registers.
-+ //!
-+ //! Registers `fp0`-`fp31`, `fpscr` are valid.
-+ kMinidumpContextPPC64Floating = kMinidumpContextPPC64 | 0x00000008,
-+
-+ //! \brief Indicates the validity of Altivec/VMX registers.
-+ //!
-+ //! Registers `v0`-`v31`, `vscr`, `vrsave`.
-+ kMinidumpContextPPC64Vector = kMinidumpContextPPC64 | 0x00000020,
-+
-+ //! \brief Indicates the validity of all registers
-+ kMinidumpContextPPC64All = kMinidumpContextPPC64Base |
-+ kMinidumpContextPPC64Floating |
-+ kMinidumpContextPPC64Vector
-+};
-+
-+//! \brief A PPC64 CPU context carried in a minidump file.
-+//! Based on minidump_cpu_ppc64.h from breakpad.
-+struct MinidumpContextPPC64 {
-+ uint64_t context_flags;
-+
-+ //! \brief General purpose registers.
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+
-+ //! \brief Floating point registers.
-+ double fpregs[32];
-+
-+ //! \brief FPU status register.
-+ double fpscr;
-+
-+ //! \brief Altivec/VMX vector registers.
-+ struct {
-+ //! \brief Vector registers are 128bits.
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad5[4];
-+
-+ //! \brief VRSAVE register.
-+ uint32_t save_vrsave;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad6[7];
-+ } vregs;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-index d7e53a493..d89eb9e01 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-@@ -101,6 +101,13 @@ MinidumpContextWriter::CreateFromSnapshot(const CPUContext* context_snapshot) {
- break;
- }
-
-+ case kCPUArchitecturePPC64: {
-+ context = std::make_unique<MinidumpContextPPC64Writer>();
-+ reinterpret_cast<MinidumpContextPPC64Writer*>(context.get())
-+ ->InitalizeFromSnapshot(context_snapshot->ppc64);
-+ break;
-+ }
-+
- default: {
- LOG(ERROR) << "unknown context architecture "
- << context_snapshot->architecture;
-@@ -453,4 +460,47 @@ size_t MinidumpContextMIPS64Writer::ContextSize() const {
- return sizeof(context_);
- }
-
-+MinidumpContextPPC64Writer::MinidumpContextPPC64Writer()
-+ : MinidumpContextWriter(), context_() {
-+ context_.context_flags = kMinidumpContextPPC64;
-+}
-+
-+MinidumpContextPPC64Writer::~MinidumpContextPPC64Writer() = default;
-+
-+void MinidumpContextPPC64Writer::InitalizeFromSnapshot(
-+ const CPUContextPPC64* context_snapshot) {
-+ DCHECK_EQ(state(), kStateMutable);
-+ DCHECK_EQ(context_.context_flags, kMinidumpContextPPC64);
-+
-+ context_.context_flags = kMinidumpContextPPC64All;
-+
-+ memcpy(context_.regs, context_snapshot->regs, sizeof(context_.regs));
-+ context_.nip = context_snapshot->nip;
-+ context_.msr = context_snapshot->msr;
-+ context_.ccr = context_snapshot->ccr;
-+ context_.xer = context_snapshot->xer;
-+ context_.lnk = context_snapshot->lnk;
-+ context_.ctr = context_snapshot->ctr;
-+
-+ memcpy(context_.fpregs, context_snapshot->fpregs, sizeof(context_.fpregs));
-+ context_.fpscr = context_snapshot->fpscr;
-+
-+ memcpy(context_.vregs.save_vr, context_snapshot->vregs.save_vr,
-+ sizeof(context_.vregs.save_vr));
-+ memcpy(&context_.vregs.save_vscr, &context_snapshot->vregs.save_vscr,
-+ sizeof(context_.vregs.save_vscr));
-+ context_.vregs.save_vrsave = context_snapshot->vregs.save_vrsave;
-+}
-+
-+bool MinidumpContextPPC64Writer::WriteObject(
-+ FileWriterInterface* file_writer) {
-+ DCHECK_EQ(state(), kStateWritable);
-+ return file_writer->Write(&context_, sizeof(context_));
-+}
-+
-+size_t MinidumpContextPPC64Writer::ContextSize() const {
-+ DCHECK_GE(state(), kStateFrozen);
-+ return sizeof(context_);
-+}
-+
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-index d4ab936ee..1d22fc59c 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-@@ -315,6 +315,43 @@ class MinidumpContextMIPS64Writer final : public MinidumpContextWriter {
- MinidumpContextMIPS64 context_;
- };
-
-+class MinidumpContextPPC64Writer final : public MinidumpContextWriter {
-+ public:
-+ MinidumpContextPPC64Writer();
-+ ~MinidumpContextPPC64Writer() override;
-+
-+ //! \brief Initalizes the MinidumpContextPPC64 based on \a context_snapshot.
-+ //!
-+ //! \param[in] context_snapshot The context snapshot to use as source data.
-+ //!
-+ //! \note Valid in #kStateMutable. No mutation of context() may be done before
-+ //! calling this method, and it is not normally necessary to alter
-+ //! context() after calling this method.
-+ void InitalizeFromSnapshot(const CPUContextPPC64* context_snapshot);
-+
-+ //! \brief Returns a pointer to the context structure that this object will
-+ //! write.
-+ //!
-+ //! \attention This returns a non-`const` pointer to this object’s private
-+ //! data so that a caller can populate the context structure directly.
-+ //! This is done because providing setter interfaces to each field in the
-+ //! context structure would be unwieldy and cumbersome. Care must be taken
-+ //! to populate the context structure correctly. The context structure
-+ //! must only be modified while this object is in the #kStateMutable
-+ //! state.
-+ MinidumpContextPPC64* context() { return &context_; }
-+
-+ protected:
-+ // MinidumpWritable:
-+ bool WriteObject(FileWriterInterface* file_writer) override;
-+
-+ // MinidumpContextWriter:
-+ size_t ContextSize() const override;
-+
-+ private:
-+ MinidumpContextPPC64 context_;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_WRITER_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-index 3216a906b..a9fcbe9d8 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-@@ -213,6 +213,21 @@ TEST(MinidumpContextWriter, MIPS64_FromSnapshot) {
- context, ExpectMinidumpContextMIPS64, kSeed);
- }
-
-+TEST(MinidumpContextWriter, PPC64_Zeros) {
-+ EmptyContextTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ ExpectMinidumpContextPPC64);
-+}
-+
-+TEST(MinidumpContextWriter, PPC64_FromSnapshot) {
-+ constexpr uint32_t kSeed = 64;
-+ CPUContextPPC64 context_ppc64;
-+ CPUContext context;
-+ context.ppc64 = &context_ppc64;
-+ InitializeCPUContextPPC64(&context, kSeed);
-+ FromSnapshotTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ context, ExpectMinidumpContextPPC64, kSeed);
-+}
-+
- } // namespace
- } // namespace test
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-index 0974e3ddf..b71ec5880 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-@@ -135,6 +135,8 @@ std::string MinidumpMiscInfoDebugBuildString() {
- static constexpr char kCPU[] = "mips";
- #elif defined(ARCH_CPU_MIPS64EL)
- static constexpr char kCPU[] = "mips64";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kCPU[] = "ppc64";
- #else
- #error define kCPU for this CPU
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/capture_memory.cc b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-index 7a1b2763c..beda8da9e 100644
---- a/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-+++ b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-@@ -112,6 +112,11 @@ void CaptureMemory::PointedToByContext(const CPUContext& context,
- for (size_t i = 0; i < std::size(context.mipsel->regs); ++i) {
- MaybeCaptureMemoryAround(delegate, context.mipsel->regs[i]);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->nip);
-+ for (size_t i = 0; i < std::size(context.ppc64->regs); ++i) {
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->regs[i]);
-+ }
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-index 811a72095..f4f83981d 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-@@ -43,7 +43,10 @@ enum CPUArchitecture {
- kCPUArchitectureMIPSEL,
-
- //! \brief 64-bit MIPSEL.
-- kCPUArchitectureMIPS64EL
-+ kCPUArchitectureMIPS64EL,
-+
-+ //! \brief 64-bit PPC64.
-+ kCPUArchitecturePPC64
- };
-
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.cc b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-index c75b5555e..aeade577a 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-@@ -169,6 +169,8 @@ uint64_t CPUContext::InstructionPointer() const {
- return arm->pc;
- case kCPUArchitectureARM64:
- return arm64->pc;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->nip;
- default:
- NOTREACHED();
- return ~0ull;
-@@ -185,6 +187,8 @@ uint64_t CPUContext::StackPointer() const {
- return arm->sp;
- case kCPUArchitectureARM64:
- return arm64->sp;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->regs[1];
- default:
- NOTREACHED();
- return ~0ull;
-@@ -196,6 +200,7 @@ bool CPUContext::Is64Bit() const {
- case kCPUArchitectureX86_64:
- case kCPUArchitectureARM64:
- case kCPUArchitectureMIPS64EL:
-+ case kCPUArchitecturePPC64:
- return true;
- case kCPUArchitectureX86:
- case kCPUArchitectureARM:
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.h b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-index fb23c4679..eebede63c 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-@@ -352,6 +352,24 @@ struct CPUContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief A context structure carrying PPC64 CPU state.
-+struct CPUContextPPC64 {
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+ double fpregs[32];
-+ double fpscr;
-+ struct {
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+ uint32_t save_vrsave;
-+ } vregs;
-+};
-+
- //! \brief A context structure capable of carrying the context of any supported
- //! CPU architecture.
- struct CPUContext {
-@@ -382,6 +400,7 @@ struct CPUContext {
- CPUContextARM64* arm64;
- CPUContextMIPS* mipsel;
- CPUContextMIPS64* mips64;
-+ CPUContextPPC64* ppc64;
- };
- };
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-index 9f46a4897..aa677c4eb 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
- #define CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
-
-+#include <cstring>
- #include "build/build_config.h"
- #include "snapshot/cpu_context.h"
- #include "snapshot/linux/signal_context.h"
-@@ -174,6 +175,78 @@ void InitializeCPUContextMIPS(
-
- #endif // ARCH_CPU_MIPS_FAMILY || DOXYGEN
-
-+#if defined(ARCH_CPU_PPC64_FAMILY) || DOXYGEN
-+
-+//! \brief Initalizes a CPUContextPPC64 structure from native context
-+//! structures on Linux.
-+//!
-+//! \param[in] thread_context The native thread context.
-+//! \param[in] float_context The native float context.
-+//! \param[in] vector_context The native vector context.
-+//! \param[out] context The CPUContextPPC64 structure to initalize.
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const ThreadContext::t64_t& thread_context,
-+ const FloatContext::f64_t& float_context,
-+ const VectorContext::v64_t& vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.gpr, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.fpregs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const SignalThreadContext64 &thread_context,
-+ const SignalFloatContext64 &float_context,
-+ const SignalVectorContext64 &vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.regs, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.regs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+
-+#endif
-+
- } // namespace internal
- } // namespace crashpad
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-index d32bd1937..2dd538c2b 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-@@ -192,6 +192,8 @@ void TestAgainstTarget(PtraceConnection* connection) {
- device == 0 && inode == 0 && mapping_name == "[vdso]";
- #if defined(ARCH_CPU_X86)
- static constexpr char kPrefix[] = "linux-gate.so.";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kPrefix[] = "linux-vdso64.so.";
- #else
- static constexpr char kPrefix[] = "linux-vdso.so.";
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-index cd40b3b12..6bcf23b6f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-@@ -323,6 +323,69 @@ bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
- reader, context_address, context_.mips64);
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+template <typename Traits>
-+static bool ReadContext(ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address,
-+ typename Traits::CPUContext* dest_context) {
-+ const ProcessMemory* memory = reader->Memory();
-+
-+ LinuxVMAddress gp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, gp_regs);
-+
-+ typename Traits::SignalThreadContext thread_context;
-+ if (!memory->Read(gp_regs_address, sizeof(thread_context), &thread_context)) {
-+ LOG(ERROR) << "Couldn't read gp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress fp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, fp_regs);
-+
-+ typename Traits::SignalFloatContext fp_context;
-+ if (!memory->Read(fp_regs_address, sizeof(fp_context), &fp_context)) {
-+ LOG(ERROR) << "Couldn't read fp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress v_regs_ptr_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, vmx_reserve) + 8;
-+
-+ typename Traits::SignalVectorContext v_context;
-+ if (!memory->Read(v_regs_ptr_address, sizeof(v_context), &v_context)) {
-+ LOG(ERROR) << "Couldn't read v_regs!";
-+ return false;
-+ }
-+
-+ InitializeCPUContextPPC64<ContextTraits64>(thread_context, fp_context,
-+ v_context, dest_context);
-+
-+ return true;
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+
-+ return internal::ReadContext<ContextTraits64>(
-+ reader, context_address, context_.ppc64);
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits32>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ // PPC64 is 64-bit
-+ return false;
-+}
-+
- #endif // ARCH_CPU_X86_FAMILY
-
- bool ExceptionSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-index ea0cd2106..e42df520f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-@@ -84,6 +84,8 @@ class ExceptionSnapshotLinux final : public ExceptionSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #endif
- } context_union_;
- CPUContext context_;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-index c17170b43..b6a714cc6 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-@@ -296,7 +296,28 @@ void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
- 0);
- #undef CPU_ARCH_NAME
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+using NativeCPUContext = ucontext_t;
-+
-+void InitializeContext(NativeCPUContext* context) {
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ context->uc_mcontext.gp_regs[reg] = reg;
-+ }
-+
-+ memset(&context->uc_mcontext.fp_regs, 44,
-+ sizeof(context->uc_mcontext.fp_regs));
-+}
-
-+void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
-+ EXPECT_EQ(actual.architecture, kCPUArchitecturePPC64);
-+
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ EXPECT_EQ(actual.ppc64->regs[reg], expected.uc_mcontext.gp_regs[reg]);
-+ }
-+
-+ EXPECT_EQ(memcmp(actual.ppc64->fpregs, expected.uc_mcontext.fp_regs,
-+ sizeof(actual.ppc64->fpregs)), 0);
-+}
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-index ee246e8bc..9555dce04 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-@@ -108,6 +108,8 @@ void ProcessReaderLinux::Thread::InitializeStack(ProcessReaderLinux* reader) {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- stack_pointer = reader->Is64Bit() ? thread_info.thread_context.t64.regs[29]
- : thread_info.thread_context.t32.regs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ stack_pointer = thread_info.thread_context.t64.gpr[1];
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 110024680..a1f2da259 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -422,6 +422,89 @@ static_assert(offsetof(UContext<ContextTraits64>, mcontext.fpregs) ==
- "context offset mismatch");
- #endif
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+struct SignalThreadContext64 {
-+ uint64_t regs[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_r3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
-+ uint64_t dscr;
-+ uint64_t fpr0[3];
-+};
-+
-+struct SignalFloatContext64 {
-+ double regs[32];
-+ double fpscr;
-+};
-+
-+struct SignalVectorContext64 {
-+ int32_t vrregs[32][4];
-+ struct {
-+ int32_t __pad[3];
-+ int32_t vscr_word;
-+ } vscr;
-+ int32_t vrsave;
-+ int32_t __pad[3];
-+} __attribute__((__aligned__(16)));
-+
-+
-+#pragma pack(pop)
-+struct MContext64 {
-+ uint64_t reserved[4];
-+ int32_t signal;
-+ int32_t __pad0;
-+ uint64_t handler;
-+ uint64_t oldmask;
-+ uint64_t pt_regs_ptr;
-+ SignalThreadContext64 gp_regs;
-+ SignalFloatContext64 fp_regs;
-+ SignalVectorContext64 *v_regs;
-+ int64_t vmx_reserve[69];
-+};
-+
-+struct ContextTraits64 : public Traits64 {
-+ using MContext = MContext64;
-+ using SignalThreadContext = SignalThreadContext64;
-+ using SignalFloatContext = SignalFloatContext64;
-+ using SignalVectorContext = SignalVectorContext64;
-+ using CPUContext = CPUContextPPC64;
-+};
-+
-+struct ContextTraits32 : public Traits32 {};
-+
-+struct UContext {
-+ uint64_t flags;
-+ uint64_t link;
-+ SignalStack<ContextTraits64> stack;
-+ Sigset<ContextTraits64> sigmask;
-+ MContext64 mcontext;
-+};
-+#pragma pack(push, 1)
-+
-+static_assert(sizeof(UContext) == sizeof(ucontext_t),
-+ "ucontext_t size mismatch");
-+static_assert(sizeof(MContext64) == sizeof(mcontext_t),
-+ "mcontext_t size mismatch");
-+static_assert(sizeof(SignalThreadContext64) == sizeof(gregset_t),
-+ "gregset_t size mismatch");
-+static_assert(sizeof(SignalFloatContext64) == sizeof(fpregset_t),
-+ "fpregset_t size mismatch");
-+static_assert(sizeof(SignalVectorContext64) == sizeof(vrregset_t),
-+ "vrregset_t size mismatch");
-+static_assert(offsetof(UContext, mcontext) ==
-+ offsetof(ucontext_t, uc_mcontext), "mcontext offset mismatch");
-+static_assert(offsetof(MContext64, gp_regs) ==
-+ offsetof(mcontext_t, gp_regs), "gp_regs offset mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-index a99da3e4b..03b973083 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-@@ -204,6 +204,8 @@ CPUArchitecture SystemSnapshotLinux::GetCPUArchitecture() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return process_reader_->Is64Bit() ? kCPUArchitectureMIPS64EL
- : kCPUArchitectureMIPSEL;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return kCPUArchitecturePPC64;
- #else
- #error port to your architecture
- #endif
-@@ -219,6 +221,9 @@ uint32_t SystemSnapshotLinux::CPURevision() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return 0;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return 0;
- #else
- #error port to your architecture
- #endif
-@@ -239,6 +244,9 @@ std::string SystemSnapshotLinux::CPUVendor() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return std::string();
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return std::string();
- #else
- #error port to your architecture
- #endif
-@@ -372,6 +380,9 @@ bool SystemSnapshotLinux::NXEnabled() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return false;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return false;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-index b2450c206..7ba78b2ae 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-@@ -110,6 +110,8 @@ bool WriteTestModule(const base::FilePath& module_path,
- module.ehdr.e_machine = EM_AARCH64;
- #elif defined(ARCH_CPU_MIPSEL) || defined(ARCH_CPU_MIPS64EL)
- module.ehdr.e_machine = EM_MIPS;
-+#elif defined(ARCH_CPU_PPC64)
-+ module.ehdr.e_machine = EM_PPC64;
- #endif
-
- module.ehdr.e_version = EV_CURRENT;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-index e3e2bebdd..8ef43752e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-@@ -186,6 +186,14 @@ bool ThreadSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
- thread.thread_info.float_context.f32,
- context_.mipsel);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+ InitializeCPUContextPPC64<ContextTraits64>(
-+ thread.thread_info.thread_context.t64,
-+ thread.thread_info.float_context.f64,
-+ thread.thread_info.vector_context.v64,
-+ context_.ppc64);
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-index 44cc6f6d9..d4136461e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-@@ -68,6 +68,8 @@ class ThreadSnapshotLinux final : public ThreadSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
---- a/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-+++ b/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-@@ -236,6 +236,12 @@
- #elif defined(ARCH_CPU_BIG_ENDIAN)
- static constexpr char arch[] = "aarch64_be";
- #endif
-+#elif defined(__powerpc64__)
-+#if defined(ARCH_CPU_LITTLE_ENDIAN)
-+ static constexpr char arch[] = "ppc64le";
-+#elif defined(ARCH_CPU_BIG_ENDIAN)
-+ static constexpr char arch[] = "ppc64";
-+#endif
- #else
- #error Port
- #endif
-diff --git a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-index d3d5ebdfb..3fd730cb5 100644
---- a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-+++ b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-@@ -56,6 +56,11 @@ bool AuxiliaryVector::Read(PtraceConnection* connection) {
- if (type == AT_IGNORE) {
- continue;
- }
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ if (type == AT_IGNOREPPC) {
-+ continue;
-+ }
-+#endif
- if (!MapInsertOrReplace(&values_, type, value, nullptr)) {
- LOG(ERROR) << "duplicate auxv entry";
- return false;
-diff --git a/third_party/crashpad/crashpad/util/linux/ptracer.cc b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-index 557e0d363..08ae434b8 100644
---- a/third_party/crashpad/crashpad/util/linux/ptracer.cc
-+++ b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-@@ -398,6 +398,64 @@ bool GetThreadArea64(pid_t tid,
- return true;
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+// PPC64 has had HAVE_ARCH_TRACEHOOK set since 2.6.27 (even before x86 had it).
-+// That means we can simply use PTRACE_GETREGESET.
-+
-+template <typename Destination>
-+bool GetRegisterSet(pid_t tid, int set, Destination* dest, bool can_log) {
-+ iovec iov;
-+ iov.iov_base = reinterpret_cast<void*>(dest);
-+ iov.iov_len = sizeof(*dest);
-+ if (ptrace(PTRACE_GETREGSET, tid, reinterpret_cast<void*>(set), &iov) != 0) {
-+ PLOG_IF(ERROR, can_log) << "ptrace";
-+ return false;
-+ }
-+ if (iov.iov_len != sizeof(*dest)) {
-+ LOG_IF(ERROR, can_log) << "Unexpected registers size";
-+ return false;
-+ }
-+ return true;
-+}
-+
-+bool GetVectorRegisters64(pid_t tid,
-+ VectorContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PPC_VMX, &context->v64, can_log);
-+}
-+
-+bool GetFloatingPointRegisters64(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PRFPREG, &context->f64, can_log);
-+}
-+
-+bool GetThreadArea64(pid_t tid,
-+ const ThreadContext& context,
-+ LinuxVMAddress* address,
-+ bool can_log) {
-+ // PPC64 doesn't have PTRACE_GET_THREAD_AREA since the thread pointer
-+ // is stored in GPR 13.
-+ ThreadContext::t64_t tc;
-+ if (!GetRegisterSet(tid, NT_PRSTATUS, &tc, can_log)) {
-+ LOG_IF(ERROR, can_log) << "Unable to get thread pointer!";
-+ return false;
-+ }
-+
-+ *address = tc.gpr[13];
-+
-+ return true;
-+}
-+
-+// Stubs for 32-bit functions not applicable on PPC64
-+bool GetFloatingPointRegisters32(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) { return false; }
-+bool GetThreadArea32(pid_t tid,
-+ const ThreadContext &context,
-+ LinuxVMAddress *address,
-+ bool can_log) { return false; }
-+
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -494,6 +552,9 @@ bool Ptracer::GetThreadInfo(pid_t tid, ThreadInfo* info) {
- if (is_64_bit_) {
- return GetGeneralPurposeRegisters64(tid, &info->thread_context, can_log_) &&
- GetFloatingPointRegisters64(tid, &info->float_context, can_log_) &&
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ GetVectorRegisters64(tid, &info->vector_context, can_log_) &&
-+#endif
- GetThreadArea64(tid,
- info->thread_context,
- &info->thread_specific_data_address,
-diff --git a/third_party/crashpad/crashpad/util/linux/thread_info.h b/third_party/crashpad/crashpad/util/linux/thread_info.h
-index 5b55c24a7..dea0d1f39 100644
---- a/third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ b/third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -28,6 +28,10 @@
- #include <android/api-level.h>
- #endif
-
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+#include <sys/ucontext.h>
-+#endif
-+
- namespace crashpad {
-
- //! \brief The set of general purpose registers for an architecture family.
-@@ -79,6 +83,8 @@ union ThreadContext {
- uint32_t cp0_status;
- uint32_t cp0_cause;
- uint32_t padding1_;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // PPC64 is 64-bit
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -132,6 +138,21 @@ union ThreadContext {
- uint64_t cp0_badvaddr;
- uint64_t cp0_status;
- uint64_t cp0_cause;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects struct pt_regs in asm/ptrace.h.
-+ uint64_t gpr[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_gpr3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -143,6 +164,8 @@ union ThreadContext {
- using NativeThreadContext = user_regs;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate NativeThreadsContext type available for MIPS
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ using NativeThreadContext = struct pt_regs;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY || ARCH_CPU_ARM64
-@@ -218,6 +241,9 @@ union FloatContext {
- } fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Crashpad's PPC support is 64-bit only, so this
-+ // 32bit-only struct is declared as empty.
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -252,6 +278,10 @@ union FloatContext {
- double fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects fpregset_t in sys/ucontext.h
-+ double fpregs[32];
-+ double fpscr;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -280,6 +310,8 @@ union FloatContext {
- static_assert(sizeof(f64) == sizeof(user_fpsimd_struct), "Size mismatch");
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate floating point context native type for available MIPS.
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ static_assert(sizeof(f64) == sizeof(fpregset_t), "Size mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86
-@@ -287,6 +319,26 @@ union FloatContext {
- static_assert(std::is_standard_layout<FloatContext>::value,
- "Not standard layout");
-
-+//! \brief The vector registers used for an architecture family
-+union VectorContext {
-+ struct v32_t {} v32;
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ __attribute__((__aligned__(16))) // Vector context must be doubleword aligned.
-+#endif
-+ struct v64_t {
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects vrregset_t in sys/ucontext.h
-+ uint32_t vrregs[32][4];
-+ struct {
-+ uint32_t __pad[3];
-+ uint32_t vscr_word;
-+ } vscr;
-+ uint32_t vrsave;
-+ uint32_t __pad[3];
-+#endif
-+ } v64;
-+};
-+
- //! \brief A collection of `ptrace`-able information about a thread.
- struct ThreadInfo {
- ThreadInfo();
-@@ -298,6 +350,9 @@ struct ThreadInfo {
- //! \brief The floating point registers for the thread.
- FloatContext float_context;
-
-+ //! \brief (Optional) The vector registers used for the thread.
-+ VectorContext vector_context;
-+
- //! \brief The thread-local storage address for the thread.
- LinuxVMAddress thread_specific_data_address;
- };
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context.h b/third_party/crashpad/crashpad/util/misc/capture_context.h
-index d21a24f19..acc325349 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context.h
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context.h
-@@ -69,6 +69,7 @@ using NativeCPUContext = ucontext_t;
- //! macOS/Linux/Fuchsia | x86_64 | `%%rdi`
- //! Linux | ARM/ARM64 | `r0`/`x0`
- //! Linux | MIPS/MIPS64 | `$a0`
-+//! Linux | PPC64 | `r3`
- //!
- //! Additionally, the value `LR` on ARM/ARM64 will be the return address of
- //! this function.
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-index 52215ee5d..b3e4a3ec7 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-@@ -32,7 +32,7 @@
- .balign 4, 0x0
- .type CAPTURECONTEXT_SYMBOL, %function
- .type CAPTURECONTEXT_SYMBOL2, %function
--#elif defined(__mips__)
-+#elif defined(__mips__) || defined(__powerpc64__)
- .balign 4, 0x0
- #endif
-
-@@ -423,4 +423,214 @@ CAPTURECONTEXT_SYMBOL2:
- jr $ra
-
- .set at
-+#elif defined(__powerpc64__)
-+ // Store r0-r31
-+ std 0, 0xe8(3) // context->uc_mcontext.gp_regs[0]
-+ std 1, 0xf0(3) // context->uc_mcontext.gp_regs[1]
-+ std 2, 0xf8(3) // context->uc_mcontext.gp_regs[2]
-+ // note that r3's original value was lost
-+ std 3, 0x100(3) // context->uc_mcontext.gp_regs[3]
-+ std 4, 0x108(3) // context->uc_mcontext.gp_regs[4]
-+ std 5, 0x110(3) // context->uc_mcontext.gp_regs[5]
-+ std 6, 0x118(3) // context->uc_mcontext.gp_regs[6]
-+ std 7, 0x120(3) // context->uc_mcontext.gp_regs[7]
-+ std 8, 0x128(3) // context->uc_mcontext.gp_regs[8]
-+ std 9, 0x130(3) // context->uc_mcontext.gp_regs[9]
-+ std 10, 0x138(3) // context->uc_mcontext.gp_regs[10]
-+ std 11, 0x140(3) // context->uc_mcontext.gp_regs[11]
-+ std 12, 0x148(3) // context->uc_mcontext.gp_regs[12]
-+ std 13, 0x150(3) // context->uc_mcontext.gp_regs[13]
-+ std 14, 0x158(3) // context->uc_mcontext.gp_regs[14]
-+ std 15, 0x160(3) // context->uc_mcontext.gp_regs[15]
-+ std 16, 0x168(3) // context->uc_mcontext.gp_regs[16]
-+ std 17, 0x170(3) // context->uc_mcontext.gp_regs[17]
-+ std 18, 0x178(3) // context->uc_mcontext.gp_regs[18]
-+ std 19, 0x180(3) // context->uc_mcontext.gp_regs[19]
-+ std 20, 0x188(3) // context->uc_mcontext.gp_regs[20]
-+ std 21, 0x190(3) // context->uc_mcontext.gp_regs[21]
-+ std 22, 0x198(3) // context->uc_mcontext.gp_regs[22]
-+ std 23, 0x1a0(3) // context->uc_mcontext.gp_regs[23]
-+ std 24, 0x1a8(3) // context->uc_mcontext.gp_regs[24]
-+ std 25, 0x1b0(3) // context->uc_mcontext.gp_regs[25]
-+ std 26, 0x1b8(3) // context->uc_mcontext.gp_regs[26]
-+ std 27, 0x1c0(3) // context->uc_mcontext.gp_regs[27]
-+ std 28, 0x1c8(3) // context->uc_mcontext.gp_regs[28]
-+ std 29, 0x1d0(3) // context->uc_mcontext.gp_regs[29]
-+ std 30, 0x1d8(3) // context->uc_mcontext.gp_regs[30]
-+ std 31, 0x1e0(3) // context->uc_mcontext.gp_regs[31]
-+
-+ // For NIP, we can use the value in the link register
-+ mflr 0
-+ std 0, 0x1e8(3) // context->uc_mcontext.gp_regs[PT_NIP]
-+
-+ // CTR
-+ mfctr 0
-+ std 0, 0x200(3) // context->uc_mcontext.gp_regs[PT_CTR]
-+
-+ // For LNK, we'll use the caller's LR save area (2 stack frames up).
-+ // r4 can be used as a scratch register since it has already been saved.
-+ ld 4, 0(1)
-+ ld 4, 16(4)
-+ std 4, 0x208(3) // context->uc_mcontext.gp_regs[PT_LNK]
-+
-+ // XER
-+ mfxer 0
-+ std 0, 0x210(3) // context->uc_mcontext.gp_regs[PT_XER]
-+
-+ // CCR
-+ mfcr 0
-+ std 0, 0x218(3) // context->uc_mcontext.gp_regs[PT_CCR]
-+
-+ // MSR, orig_r3, MQ, TRAP, DAR, DSISR, RESULT, DSCR,
-+ // not used or not relevant, zero them out.
-+ li 4, 0
-+ std 4, 0x1f0(3) // context->uc_mcontext.gp_regs[PT_MSR]
-+ std 4, 0x1f8(3) // context->uc_mcontext.gp_regs[PT_ORIG_R3]
-+ std 4, 0x220(3) // context->uc_mcontext.gp_regs[PT_MQ]
-+ std 4, 0x228(3) // context->uc_mcontext.gp_regs[PT_TRAP]
-+ std 4, 0x230(3) // context->uc_mcontext.gp_regs[PT_DAR]
-+ std 4, 0x238(3) // context->uc_mcontext.gp_regs[PT_DSISR]
-+ std 4, 0x240(3) // context->uc_mcontext.gp_regs[PT_RESULT]
-+ std 4, 0x248(3) // context->uc_mcontext.gp_regs[PT_DSCR]
-+
-+ // Update context->uc_mcontext.regs to point to gp_regs
-+ addi 0, 3, 0xe8
-+ std 0, 0xe0(3)
-+
-+ // Save floating point registers 0-31
-+ stfd 0, 0x268(3) // context->uc_mcontext.fp_regs[0]
-+ stfd 1, 0x270(3) // context->uc_mcontext.fp_regs[1]
-+ stfd 2, 0x278(3) // context->uc_mcontext.fp_regs[2]
-+ stfd 3, 0x280(3) // context->uc_mcontext.fp_regs[3]
-+ stfd 4, 0x288(3) // context->uc_mcontext.fp_regs[4]
-+ stfd 5, 0x290(3) // context->uc_mcontext.fp_regs[5]
-+ stfd 6, 0x298(3) // context->uc_mcontext.fp_regs[6]
-+ stfd 7, 0x2a0(3) // context->uc_mcontext.fp_regs[7]
-+ stfd 8, 0x2a8(3) // context->uc_mcontext.fp_regs[8]
-+ stfd 9, 0x2b0(3) // context->uc_mcontext.fp_regs[9]
-+ stfd 10, 0x2b8(3) // context->uc_mcontext.fp_regs[10]
-+ stfd 11, 0x2c0(3) // context->uc_mcontext.fp_regs[11]
-+ stfd 12, 0x2c8(3) // context->uc_mcontext.fp_regs[12]
-+ stfd 13, 0x2d0(3) // context->uc_mcontext.fp_regs[13]
-+ stfd 14, 0x2d8(3) // context->uc_mcontext.fp_regs[14]
-+ stfd 15, 0x2e0(3) // context->uc_mcontext.fp_regs[15]
-+ stfd 16, 0x2e8(3) // context->uc_mcontext.fp_regs[16]
-+ stfd 17, 0x2f0(3) // context->uc_mcontext.fp_regs[17]
-+ stfd 18, 0x2f8(3) // context->uc_mcontext.fp_regs[18]
-+ stfd 19, 0x300(3) // context->uc_mcontext.fp_regs[19]
-+ stfd 20, 0x308(3) // context->uc_mcontext.fp_regs[20]
-+ stfd 21, 0x310(3) // context->uc_mcontext.fp_regs[21]
-+ stfd 22, 0x318(3) // context->uc_mcontext.fp_regs[22]
-+ stfd 23, 0x320(3) // context->uc_mcontext.fp_regs[23]
-+ stfd 24, 0x328(3) // context->uc_mcontext.fp_regs[24]
-+ stfd 25, 0x330(3) // context->uc_mcontext.fp_regs[25]
-+ stfd 26, 0x338(3) // context->uc_mcontext.fp_regs[26]
-+ stfd 27, 0x340(3) // context->uc_mcontext.fp_regs[27]
-+ stfd 28, 0x348(3) // context->uc_mcontext.fp_regs[28]
-+ stfd 29, 0x350(3) // context->uc_mcontext.fp_regs[29]
-+ stfd 30, 0x358(3) // context->uc_mcontext.fp_regs[30]
-+ stfd 31, 0x360(3) // context->uc_mcontext.fp_regs[31]
-+
-+ // FPSCR
-+ mffs 0
-+ stfd 0, 0x368(3) // context->uc_mcontext.fp_regs[32]
-+
-+ // Save VMX Vector registers
-+ // Update r4 to contain the base address of vmx_reserve
-+ addi 4, 3, 0x378
-+ // Ensure that it is quadword aligned
-+ andi. 5, 4, 0xF
-+ beq 1f // No alignment is necessary
-+ // Address is doubleword aligned and not quadword aligned, add 8
-+ addi 4, 4, 8
-+
-+1:
-+ // Store VMX registers 0-31
-+ // r4 will contain the base address
-+ // r5 will contain the index
-+ li 5, 0
-+ stvx 0, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 0]
-+ addi 5, 5, 16
-+ stvx 1, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 1]
-+ addi 5, 5, 16
-+ stvx 2, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 2]
-+ addi 5, 5, 16
-+ stvx 3, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 3]
-+ addi 5, 5, 16
-+ stvx 4, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 4]
-+ addi 5, 5, 16
-+ stvx 5, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 5]
-+ addi 5, 5, 16
-+ stvx 6, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 6]
-+ addi 5, 5, 16
-+ stvx 7, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 7]
-+ addi 5, 5, 16
-+ stvx 8, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 8]
-+ addi 5, 5, 16
-+ stvx 9, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 9]
-+ addi 5, 5, 16
-+ stvx 10, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 10]
-+ addi 5, 5, 16
-+ stvx 11, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 11]
-+ addi 5, 5, 16
-+ stvx 12, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 12]
-+ addi 5, 5, 16
-+ stvx 13, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 13]
-+ addi 5, 5, 16
-+ stvx 14, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 14]
-+ addi 5, 5, 16
-+ stvx 15, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 15]
-+ addi 5, 5, 16
-+ stvx 16, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 16]
-+ addi 5, 5, 16
-+ stvx 17, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 17]
-+ addi 5, 5, 16
-+ stvx 18, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 18]
-+ addi 5, 5, 16
-+ stvx 19, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 19]
-+ addi 5, 5, 16
-+ stvx 20, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 20]
-+ addi 5, 5, 16
-+ stvx 21, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 21]
-+ addi 5, 5, 16
-+ stvx 22, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 22]
-+ addi 5, 5, 16
-+ stvx 23, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 23]
-+ addi 5, 5, 16
-+ stvx 24, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 24]
-+ addi 5, 5, 16
-+ stvx 25, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 25]
-+ addi 5, 5, 16
-+ stvx 26, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 26]
-+ addi 5, 5, 16
-+ stvx 27, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 27]
-+ addi 5, 5, 16
-+ stvx 28, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 28]
-+ addi 5, 5, 16
-+ stvx 29, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 29]
-+ addi 5, 5, 16
-+ stvx 30, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 30]
-+ addi 5, 5, 16
-+ stvx 31, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 31]
-+ addi 5, 5, 16
-+
-+ // VSCR
-+ mfvscr 0
-+ stvx 0, 4, 5
-+ addi 5, 5, 16
-+
-+ // VRSAVE
-+ mfvrsave 0
-+ stwx 0, 4, 5
-+
-+ // Update context->uc_mcontext.v_regs to point to vmx_reserve + alignment.
-+ std 4, 0x370(3)
-+
-+ // Zero out all unused fields
-+ li 4, 0
-+ std 4, 0xc8(3) // context->uc_mcontext.signal
-+ std 4, 0xd0(3) // context->uc_mcontext.handler
-+ std 4, 0xd8(3) // context->uc_mcontext.oldmask
-+
-+ blr
- #endif // __i386__
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-index cf23c2def..5f264bc92 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-@@ -57,7 +57,7 @@ void TestCaptureContext() {
- uintptr_t pc = ProgramCounterFromContext(context_1);
-
- #if !defined(ADDRESS_SANITIZER) && !defined(ARCH_CPU_MIPS_FAMILY) && \
-- !defined(MEMORY_SANITIZER)
-+ !defined(MEMORY_SANITIZER) && !defined(ARCH_CPU_PPC64_FAMILY)
- // Sanitizers can cause enough code bloat that the “nearby” check would
- // likely fail.
- const uintptr_t kReferencePC =
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-index 30a2ab21d..60509f21d 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-@@ -35,6 +35,8 @@ void SanityCheckContext(const NativeCPUContext& context) {
- EXPECT_EQ(context.uc_mcontext.regs[0], FromPointerCast<uintptr_t>(&context));
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- EXPECT_EQ(context.uc_mcontext.gregs[4], FromPointerCast<uintptr_t>(&context));
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ EXPECT_EQ(context.uc_mcontext.gp_regs[3], FromPointerCast<uintptr_t>(&context));
- #endif
- }
-
-@@ -49,6 +51,8 @@ uintptr_t ProgramCounterFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.pc;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.pc;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[PT_NIP];
- #endif
- }
-
-@@ -63,6 +67,8 @@ uintptr_t StackPointerFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.sp;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.gregs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[1];
- #endif
- }
-
-diff --git a/third_party/dav1d/config/linux/ppc64/config.h b/third_party/dav1d/config/linux/ppc64/config.h
-new file mode 100644
-index 000000000..9fbbf75cc
---- /dev/null
-+++ b/third_party/dav1d/config/linux/ppc64/config.h
-@@ -0,0 +1,39 @@
-+/*
-+ * Autogenerated by the Meson build system.
-+ * Do not edit, your changes will be lost.
-+ */
-+
-+#pragma once
-+
-+#define ARCH_AARCH64 0
-+
-+#define ARCH_ARM 0
-+
-+#define ARCH_PPC64LE 1
-+
-+#define ARCH_X86 0
-+
-+#define ARCH_X86_32 0
-+
-+#define ARCH_X86_64 0
-+
-+#define CONFIG_16BPC 1
-+
-+#define CONFIG_8BPC 1
-+
-+// #define CONFIG_LOG 1 -- Logging is controlled by Chromium
-+
-+#define ENDIANNESS_BIG 0
-+
-+#define HAVE_ASM 1
-+
-+#define HAVE_CLOCK_GETTIME 1
-+
-+#define HAVE_DLSYM 1
-+
-+#define HAVE_GETAUXVAL 1
-+
-+#define HAVE_POSIX_MEMALIGN 1
-+
-+#define HAVE_UNISTD_H 1
-+
-diff --git a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-index 0b4bd72f0..a0caa5e71 100644
---- a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-+++ b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-@@ -51,4 +51,19 @@
- #define u16l_to_i32(v) ((i32x4) vec_mergel((u16x8) v, vec_splat_u16(0)))
- #define i16l_to_i32(v) ((i32x4) vec_unpackl((i16x8)v))
-
-+#if defined(__clang__)
-+#undef vec_splats
-+#define vec_splats(N) \
-+ _Generic((N), \
-+ unsigned char: ((u8x16)(N)), \
-+ signed char: ((i8x16)(N)), \
-+ unsigned short: ((u16x8)(N)), \
-+ signed short: ((i16x8)(N)), \
-+ unsigned int: ((u32x4)(N)), \
-+ signed int: ((i32x4)(N)), \
-+ unsigned long long: ((u64x2)(N)), \
-+ signed long long: ((i64x2)(N)) \
-+ )
-+#endif
-+
- #endif /* DAV1D_SRC_PPC_TYPES_H */
-diff --git a/third_party/eigen3/BUILD.gn b/third_party/eigen3/BUILD.gn
-index 0d4e184..f2ce484 100644
---- a/third_party/eigen3/BUILD.gn
-+++ b/third_party/eigen3/BUILD.gn
-@@ -22,4 +22,8 @@ config("eigen_includes") {
- # for this component on Windows on Arm due to compilation errors.
- defines += [ "EIGEN_DONT_VECTORIZE" ]
- }
-+
-+ if (target_cpu == "ppc64") {
-+ defines += [ "EIGEN_DONT_VECTORIZE" ]
-+ }
- }
-
-diff --git a/third_party/libaom/BUILD.gn b/third_party/libaom/BUILD.gn
-index 9b065bd..df3af02 100644
---- a/third_party/libaom/BUILD.gn
-+++ b/third_party/libaom/BUILD.gn
-@@ -40,6 +40,8 @@
- cpu_arch_full = "generic"
- } else if (current_cpu == "loong64") {
- cpu_arch_full = "generic"
-+} else if (current_cpu == "ppc64") {
-+ cpu_arch_full = "generic"
- } else {
- cpu_arch_full = current_cpu
- }
-diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h
-index e4ac22644..1c57015db 100644
---- a/third_party/lss/linux_syscall_support.h
-+++ b/third_party/lss/linux_syscall_support.h
-@@ -3947,7 +3947,7 @@ struct kernel_statfs {
- LSS_REG(2, buf);
- LSS_BODY(void*, mmap2, "0"(__r2));
- }
--#else
-+#elif !defined(__powerpc64__) /* ppc64 doesn't have mmap2 */
- #define __NR__mmap2 __NR_mmap2
- LSS_INLINE _syscall6(void*, _mmap2, void*, s,
- size_t, l, int, p,
-@@ -4058,7 +4058,7 @@ struct kernel_statfs {
- #if defined(__i386__) || \
- defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \
- (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \
-- defined(__PPC__) || \
-+ (defined(__PPC__) && !defined(__powerpc64__)) || \
- (defined(__s390__) && !defined(__s390x__))
- /* On these architectures, implement mmap() with mmap2(). */
- LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d,
-@@ -4872,11 +4872,11 @@ struct kernel_statx {
- LSS_SC_BODY(4, int, 8, d, type, protocol, sv);
- }
- #endif
-- #if defined(__NR_recvmsg)
-+ #if defined(__NR_recvmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, recvmsg, int, s, struct kernel_msghdr*, msg,
- int, flags)
- #endif
-- #if defined(__NR_sendmsg)
-+ #if defined(__NR_sendmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, sendmsg, int, s, const struct kernel_msghdr*,
- msg, int, flags)
- #endif
-@@ -4885,13 +4885,13 @@ struct kernel_statx {
- int, flags, const struct kernel_sockaddr*, to,
- unsigned int, tolen)
- #endif
-- #if defined(__NR_shutdown)
-+ #if defined(__NR_shutdown) && !defined(__PPC__)
- LSS_INLINE _syscall2(int, shutdown, int, s, int, how)
- #endif
-- #if defined(__NR_socket)
-+ #if defined(__NR_socket) && !defined(__PPC__)
- LSS_INLINE _syscall3(int, socket, int, domain, int, type, int, protocol)
- #endif
-- #if defined(__NR_socketpair)
-+ #if defined(__NR_socketpair) && !defined(__PPC__)
- LSS_INLINE _syscall4(int, socketpair, int, d, int, type, int, protocol,
- int*, sv)
- #endif
-diff --git a/third_party/pdfium/third_party/libpng16/pngpriv.h b/third_party/pdfium/third_party/libpng16/pngpriv.h
-index 583c26f..e03d697 100644
---- a/third_party/pdfium/third_party/libpng16/pngpriv.h
-+++ b/third_party/pdfium/third_party/libpng16/pngpriv.h
-@@ -196,11 +196,7 @@
- #endif
-
- #ifndef PNG_POWERPC_VSX_OPT
--# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
--# define PNG_POWERPC_VSX_OPT 2
--# else
--# define PNG_POWERPC_VSX_OPT 0
--# endif
-+# define PNG_POWERPC_VSX_OPT 0
- #endif
-
- #ifndef PNG_INTEL_SSE_OPT
-diff --git a/third_party/pffft/src/pffft.c b/third_party/pffft/src/pffft.c
-index bdac4d784..51e0f2cac 100644
---- a/third_party/pffft/src/pffft.c
-+++ b/third_party/pffft/src/pffft.c
-@@ -100,6 +100,7 @@
- Altivec support macros
- */
- #if !defined(PFFFT_SIMD_DISABLE) && (defined(__ppc__) || defined(__ppc64__))
-+#include <altivec.h>
- typedef vector float v4sf;
- # define SIMD_SZ 4
- # define VZERO() ((vector float) vec_splat_u8(0))
-diff --git a/third_party/sqlite/src/amalgamation/sqlite3.c b/third_party/sqlite/src/amalgamation/sqlite3.c
-index 6b4a7899d..b8c7fe414 100644
---- a/third_party/sqlite/src/amalgamation/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation/sqlite3.c
-@@ -14474,7 +14474,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/amalgamation_dev/sqlite3.c b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-index d30c9b7de..cf75a69d9 100644
---- a/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-@@ -14487,7 +14487,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/ext/rtree/rtree.c b/third_party/sqlite/src/ext/rtree/rtree.c
-index f5b57a5e2..80a2d0ad8 100644
---- a/third_party/sqlite/src/ext/rtree/rtree.c
-+++ b/third_party/sqlite/src/ext/rtree/rtree.c
-@@ -450,7 +450,7 @@ struct RtreeMatchArg {
- #if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__arm__)
-+ defined(__arm__) || defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- #elif defined(sparc) || defined(__ppc__)
- # define SQLITE_BYTEORDER 4321
-diff --git a/third_party/sqlite/src/src/sqliteInt.h b/third_party/sqlite/src/src/sqliteInt.h
-index 245070d4f..b25164e95 100644
---- a/third_party/sqlite/src/src/sqliteInt.h
-+++ b/third_party/sqlite/src/src/sqliteInt.h
-@@ -877,7 +877,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/webrtc/rtc_base/system/arch.h b/third_party/webrtc/rtc_base/system/arch.h
-index be2367b85..be4ee4233 100644
---- a/third_party/webrtc/rtc_base/system/arch.h
-+++ b/third_party/webrtc/rtc_base/system/arch.h
-@@ -79,6 +79,18 @@
- #elif defined(__EMSCRIPTEN__)
- #define WEBRTC_ARCH_32_BITS
- #define WEBRTC_ARCH_LITTLE_ENDIAN
-+#elif defined(__PPC__)
-+#define WEBRTC_ARCH_PPC_FAMILY
-+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-+#define WEBRTC_ARCH_LITTLE_ENDIAN
-+#else
-+#define WEBRTC_ARCH_BIG_ENDIAN
-+#endif
-+#if defined(__LP64__)
-+#define WEBRTC_ARCH_64_BITS
-+#else
-+#define WEBRTC_ARCH_32_BITS
-+#endif
- #else
- #error Please add support for your architecture in rtc_base/system/arch.h
- #endif
-diff --git a/v8/BUILD.gn b/v8/BUILD.gn
-index f39529a3a..e84fc449e 100644
---- a/v8/BUILD.gn
-+++ b/v8/BUILD.gn
-@@ -850,6 +850,12 @@ config("toolchain") {
- }
- if (host_byteorder == "little") {
- defines += [ "V8_TARGET_ARCH_PPC_LE" ]
-+ cflags += [
-+ # Enable usage of AltiVec, VSX, and other POWER8 and higher features
-+ "-mcpu=power8",
-+ "-maltivec",
-+ "-mvsx",
-+ ]
- } else if (host_byteorder == "big") {
- defines += [ "V8_TARGET_ARCH_PPC_BE" ]
- if (current_os == "aix") {
---- a/ui/gl/features.gni
-+++ b/ui/gl/features.gni
-@@ -33,5 +33,5 @@
- is_chromeos_ash || is_fuchsia) &&
- (target_cpu == "x86" || target_cpu == "x64" || target_cpu == "arm" ||
- target_cpu == "arm64" || target_cpu == "mipsel" ||
-- target_cpu == "mips64el" || target_cpu == "riscv64")
-+ target_cpu == "mips64el" || target_cpu == "riscv64" || target_cpu == "ppc64")
- }
-diff --git a/v8/test/BUILD.gn b/v8/test/BUILD.gn
-index fb872ad39..45fc585dd 100644
---- a/v8/test/BUILD.gn
-+++ b/v8/test/BUILD.gn
-@@ -42,7 +42,7 @@ group("gn_all") {
- "benchmarks/cpp:gn_all",
- "cctest:cctest",
- "unittests:generate-bytecode-expectations",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
- }
- }
-@@ -84,7 +84,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- "webkit:v8_webkit",
- ]
-
-@@ -109,7 +109,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
-
- if (v8_enable_webassembly) {
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch b/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
deleted file mode 100644
index df453f491d8c..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-+++ b/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-@@ -574,6 +574,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCAsmInfoCOFF.cpp",
- "llvm/lib/MC/MCAsmInfoDarwin.cpp",
- "llvm/lib/MC/MCAsmInfoELF.cpp",
-+ "llvm/lib/MC/MCAsmInfoXCOFF.cpp",
- "llvm/lib/MC/MCAsmMacro.cpp",
- "llvm/lib/MC/MCAsmStreamer.cpp",
- "llvm/lib/MC/MCAssembler.cpp",
-@@ -629,6 +630,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCWinCOFFStreamer.cpp",
- "llvm/lib/MC/MCWinEH.cpp",
- "llvm/lib/MC/MCXCOFFStreamer.cpp",
-+ "llvm/lib/MC/MCXCOFFObjectTargetWriter.cpp",
- "llvm/lib/MC/MachObjectWriter.cpp",
- "llvm/lib/MC/StringTableBuilder.cpp",
- "llvm/lib/MC/SubtargetFeature.cpp",
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 7dea8bbe50d3..50b9a3aec409 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -1,7 +1,7 @@
# Template file for 'chromium'
pkgname=chromium
# See https://chromiumdash.appspot.com/releases?platform=Linux for the latest version
-version=108.0.5359.124
+version=109.0.5414.74
revision=1
archs="i686* x86_64* aarch64* armv7l* ppc64le*"
hostmakedepends="
@@ -28,7 +28,7 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://www.chromium.org/"
distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz"
-checksum=d48dfac2a61b14a5d7d2f460b09b70ef3ab88e27b82e3173938cb54eaa612a75
+checksum=eded233c26ab631be325ad49cb306c338513b6a6528197d42653e66187548e5d
lib32disabled=yes
@@ -220,9 +220,6 @@ do_configure() {
'icu_use_data_file=true'
- 'use_allocator="none"'
- 'use_allocator_shim=false'
-
'enable_widevine=true'
'enable_hangout_services_extension=true'
@@ -318,13 +315,13 @@ do_configure() {
do_build() {
_setup_toolchain
- CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver chrome_crashpad_handler
+ CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver.unstripped chrome_crashpad_handler
}
do_install() {
vinstall out/Release/chrome 755 usr/lib/${pkgname} ${pkgname}
vinstall out/Release/chrome_crashpad_handler 755 usr/lib/${pkgname} chrome_crashpad_handler
- vinstall out/Release/chromedriver 755 usr/lib/${pkgname} chromedriver
+ vinstall out/Release/chromedriver.unstripped 755 usr/lib/${pkgname} chromedriver
vinstall out/Release/libEGL.so 755 usr/lib/${pkgname} libEGL.so
vinstall out/Release/libGLESv2.so 755 usr/lib/${pkgname} libGLESv2.so
vinstall out/Release/libvk_swiftshader.so 755 usr/lib/${pkgname} libvk_swiftshader.so
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] chromium: update to 109.0.5414.74.
2023-01-11 1:12 [PR PATCH] chromium: update to 109.0.5414.74 Duncaen
` (2 preceding siblings ...)
2023-01-11 14:18 ` Duncaen
@ 2023-01-11 14:53 ` Duncaen
2023-01-11 17:20 ` Duncaen
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Duncaen @ 2023-01-11 14:53 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]
There is an updated pull request by Duncaen against master on the void-packages repository
https://github.com/Duncaen/void-packages chromium-109
https://github.com/void-linux/void-packages/pull/41570
chromium: update to 109.0.5414.74.
[ci skip]
* [x] x86_64-glibc
* [ ] x86_64-musl
* [ ] aarch64-musl
* [ ] i686
A patch file from https://github.com/void-linux/void-packages/pull/41570.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-chromium-109-41570.patch --]
[-- Type: text/x-diff, Size: 182224 bytes --]
From a6697de1348e6b06788d44b0ecd83fe23937a6ad Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Wed, 11 Jan 2023 01:28:40 +0100
Subject: [PATCH] chromium: update to 109.0.5414.74.
---
.../musl-patches/xxx-ppc64le-support.patch | 187 -
.../patches/build-add-use_cxx17.patch | 38 +-
.../patches/fix-build-with-old-clang.patch | 20 +
.../patches/fix-constexpr-narrowing.patch | 21 +
.../patches/fix-musl-pthread-stacksize.patch | 40 -
.../chromium/patches/fix-narrowing-cast.patch | 53 -
.../patches/fix-nasm-musl-config.patch | 12 -
srcpkgs/chromium/patches/narrowing-cast.patch | 21 +
...uild-error-on-linux-with-system-zlib.patch | 41 -
.../patches/remove-strip_binary.patch | 32 -
.../patches/xxx-ppc64le-4k-pages.patch | 60 -
.../chromium/patches/xxx-ppc64le-libvpx.patch | 33 -
.../xxx-ppc64le-sandbox-linux-stat.patch | 31 -
.../patches/xxx-ppc64le-support.patch | 3590 -----------------
.../patches/xxx-ppc64le-swiftshader.patch | 18 -
srcpkgs/chromium/template | 41 +-
16 files changed, 87 insertions(+), 4151 deletions(-)
delete mode 100644 srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
create mode 100644 srcpkgs/chromium/patches/fix-build-with-old-clang.patch
create mode 100644 srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
delete mode 100644 srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
delete mode 100644 srcpkgs/chromium/patches/fix-narrowing-cast.patch
delete mode 100644 srcpkgs/chromium/patches/fix-nasm-musl-config.patch
create mode 100644 srcpkgs/chromium/patches/narrowing-cast.patch
delete mode 100644 srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
delete mode 100644 srcpkgs/chromium/patches/remove-strip_binary.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-support.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
diff --git a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 555f69c072c8..000000000000
--- a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,187 +0,0 @@
-diff --git sandbox/linux/bpf_dsl/seccomp_macros.h sandbox/linux/bpf_dsl/seccomp_macros.h
-index a6aec544e..2a4a7f1bc 100644
---- sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,7 +16,7 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
--#elif defined(__powerpc64__)
-+#elif defined(__powerpc64__) && defined(__GLIBC__)
- // Manually define greg_t on ppc64
- typedef unsigned long long greg_t;
- #endif
-@@ -361,11 +361,11 @@ typedef struct pt_regs regs_struct;
- #define SECCOMP_ARCH AUDIT_ARCH_PPC64
- #endif
-
--#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+#define SECCOMP_REG(_ctx, _reg) (((struct pt_regs *)(_ctx)->uc_mcontext.regs)->gpr[_reg])
-
- #define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
--#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_IP(_ctx) ((struct pt_regs *)(_ctx)->uc_mcontext.regs)->nip
- #define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
- #define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-diff --git sandbox/linux/seccomp-bpf/syscall.cc sandbox/linux/seccomp-bpf/syscall.cc
-index d53a7ff56..c290f0e92 100644
---- sandbox/linux/seccomp-bpf/syscall.cc
-+++ sandbox/linux/seccomp-bpf/syscall.cc
-@@ -499,9 +499,9 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // Same as MIPS, need to invert ret and set error register (cr0.SO)
- if (ret_val <= -1 && ret_val >= -4095) {
- ret_val = -ret_val;
-- ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr |= (1 << 28);
- } else {
-- ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr &= ~(1 << 28);
- }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
---- third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-+++ third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-@@ -22,6 +22,7 @@
- // The following platforms have an implementation of a hardware counter.
- #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
- defined(__powerpc__) || defined(__ppc__) || defined(__riscv) || \
-+ ((defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__)) || defined(__riscv) || \
- defined(_M_IX86) || (defined(_M_X64) && !defined(_M_ARM64EC))
- #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1
- #else
---- third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-+++ third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-@@ -64,7 +64,7 @@
- #elif defined(__i386__) || defined(__x86_64__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_x86-inl.inc"
--#elif defined(__ppc__) || defined(__PPC__)
-+#elif (defined(__ppc__) || defined(__PPC__)) && defined(__GLIBC__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_powerpc-inl.inc"
- #elif defined(__aarch64__)
-diff --git third_party/breakpad/BUILD.gn third_party/breakpad/BUILD.gn
-index f9a60e37..25f3a0b7 100644
---- third_party/breakpad/BUILD.gn
-+++ third_party/breakpad/BUILD.gn
-@@ -637,6 +637,7 @@ if (is_linux || is_android) {
-
- if (current_cpu == "ppc64") {
- defines = [ "HAVE_GETCONTEXT" ]
-+ libs += [ "ucontext" ]
- } else {
- sources += [
- "breakpad/src/common/linux/breakpad_getcontext.S"
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index 03afec7a..0264ecf1 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -273,6 +273,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t ThreadInfo::GetInstructionPointer() const {
- return mcontext.gp_regs[PT_NIP];
- }
-@@ -290,9 +293,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->ctr = mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] = \
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 1090470f..e580233d 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -257,6 +257,9 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
- return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
- }
-@@ -280,9 +283,9 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&uc->uc_mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&uc->uc_mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] =
-diff --git third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index 5a7ab50c..ee8b858c 100644
---- third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -105,6 +105,11 @@
- #define PR_SET_PTRACER 0x59616d61
- #endif
-
-+/* musl hack, can't include asm/ptrace.h as that causes conflicts */
-+#if defined(__powerpc64__) && !defined(PT_NIP)
-+#define PT_NIP 32
-+#endif
-+
- namespace google_breakpad {
-
- namespace {
-diff --git third_party/crashpad/crashpad/snapshot/linux/signal_context.h third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 8e335a09..b2a0f155 100644
---- third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -469,7 +469,7 @@ struct MContext64 {
- SignalThreadContext64 gp_regs;
- SignalFloatContext64 fp_regs;
- SignalVectorContext64 *v_regs;
-- int64_t vmx_reserve[69];
-+ int64_t vmx_reserve[101];
- };
-
- struct ContextTraits64 : public Traits64 {
-diff --git third_party/crashpad/crashpad/util/linux/thread_info.h third_party/crashpad/crashpad/util/linux/thread_info.h
-index dea0d1f3..b203e5b2 100644
---- third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -30,6 +30,7 @@
-
- #if defined(ARCH_CPU_PPC64_FAMILY)
- #include <sys/ucontext.h>
-+#include <asm/ptrace.h>
- #endif
-
- namespace crashpad {
-diff --git third_party/lss/linux_syscall_support.h third_party/lss/linux_syscall_support.h
-index 9955ce44..4c1cc488 100644
---- third_party/lss/linux_syscall_support.h
-+++ third_party/lss/linux_syscall_support.h
-@@ -4216,9 +4216,13 @@ struct kernel_statfs {
- }
- #endif
- #if defined(__NR_fstatat64)
-+ // musl does #define fstatat64 fstatat
-+ #undef fstatat64
- LSS_INLINE _syscall4(int, fstatat64, int, d,
- const char *, p,
- struct kernel_stat64 *, b, int, f)
-+ // set it back like it was
-+ #define fstatat64 fstatat
- #endif
- #if defined(__NR_waitpid)
- // waitpid is polyfilled below when not available.
diff --git a/srcpkgs/chromium/patches/build-add-use_cxx17.patch b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
index 091b1c553727..b50825fb7e2c 100644
--- a/srcpkgs/chromium/patches/build-add-use_cxx17.patch
+++ b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
@@ -1,26 +1,22 @@
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
-@@ -167,6 +167,10 @@
- # Enable -H, which prints the include tree during compilation.
- # For use by tools/clang/scripts/analyze_includes.py
- show_includes = false
-+
-+ # Allow projects that wish to stay on C++17 to override Chromium's default.
-+ # TODO(crbug.com/1402249): evaluate removing this end of 2023
-+ use_cxx17 = false
+@@ -191,6 +191,10 @@
+ current_cpu == "x64"))))
}
- declare_args() {
-@@ -596,7 +600,11 @@
- } else if (is_linux) {
- # TODO(crbug.com/1284275): Switch to C++20 on all platforms.
- if (is_clang) {
-- cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ if (use_cxx17) {
-+ cflags_cc += [ "-std=${standard_prefix}++17" ]
-+ } else {
-+ cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ }
++declare_args() {
++ use_cxx17 = false
++}
++
+ if (is_android || (is_chromeos_ash && is_chromeos_device)) {
+ # Set the path to use orderfile for linking Chrome
+ # Note that this is for using only one orderfile for linking
+@@ -605,7 +609,7 @@
+ cflags_cc += [ "-fno-trigraphs" ]
+ }
+ } else if (is_clang) {
+- if (is_chromeos_device) {
++ if (is_chromeos_device || use_cxx17) {
+ # TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
+ cflags_cc += [ "-std=${standard_prefix}++17" ]
} else {
- # The gcc bots are currently using GCC 9, which is not new enough to
- # support "c++20"/"gnu++20".
diff --git a/srcpkgs/chromium/patches/fix-build-with-old-clang.patch b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
new file mode 100644
index 000000000000..f23218e71e4d
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
@@ -0,0 +1,20 @@
+--- a/build/config/compiler/BUILD.gn
++++ b/build/config/compiler/BUILD.gn
+@@ -805,17 +805,6 @@
+ cflags += [ "-fcomplete-member-pointers" ]
+ }
+
+- # Use DWARF simple template names, with the following exceptions:
+- #
+- # * Windows is not supported as it doesn't use DWARF.
+- # * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
+- # lldb doesn't have the needed changes yet.
+- # * Fuchsia isn't supported as zxdb doesn't support simple template names yet.
+- # TODO(crbug.com/1379070): Remove if the upstream default ever changes.
+- if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
+- cflags_cc += [ "-gsimple-template-names" ]
+- }
+-
+ # MLGO specific flags. These flags enable an ML-based inliner trained on
+ # Chrome on Android (arm32) with ThinLTO enabled, optimizing for size.
+ # The "release" ML model is embedded into clang as part of its build.
diff --git a/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch b/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
new file mode 100644
index 000000000000..570ca6e69a80
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
@@ -0,0 +1,21 @@
+--- a/third_party/blink/renderer/platform/media/web_media_player_impl.cc.orig
++++ b/third_party/blink/renderer/platform/media/web_media_player_impl.cc
+@@ -3881,15 +3881,15 @@
+ const T&... values) {
+ std::string strkey = std::string(key);
+
+- if constexpr (Flags & kEncrypted) {
++ if constexpr (Flags & kEncrypted != 0) {
+ if (is_encrypted_)
+ UmaFunction(strkey + ".EME", values...);
+ }
+
+- if constexpr (Flags & kTotal)
++ if constexpr (Flags & kTotal != 0)
+ UmaFunction(strkey + ".All", values...);
+
+- if constexpr (Flags & kPlaybackType) {
++ if constexpr (Flags & kPlaybackType != 0) {
+ auto demuxer_type = GetDemuxerType();
+ if (!demuxer_type.has_value())
+ return;
diff --git a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch b/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
deleted file mode 100644
index cd5533190db9..000000000000
--- a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- a/base/threading/platform_thread_linux.cc
-+++ b/base/threading/platform_thread_linux.cc
-@@ -436,8 +436,13 @@
-
- size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
- #if !defined(THREAD_SANITIZER)
-+#if defined(__GLIBC__)
- return 0;
- #else
-+ // musl libcs default is too small, use 8mb like glibc
-+ return (1 << 23);
-+#endif
-+#else
- // ThreadSanitizer bloats the stack heavily. Evidence has been that the
- // default stack size isn't enough for some browser tests.
- return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux).
---- a/chrome/browser/shutdown_signal_handlers_posix.cc
-+++ b/chrome/browser/shutdown_signal_handlers_posix.cc
-@@ -188,11 +188,21 @@
- g_shutdown_pipe_read_fd = pipefd[0];
- g_shutdown_pipe_write_fd = pipefd[1];
- #if !defined(ADDRESS_SANITIZER)
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
- #else
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 * 8;
-+#endif
-+#else
- // ASan instrumentation bloats the stack frames, so we need to increase the
- // stack size to avoid hitting the guard page.
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
-+#else
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 * 8;
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+#endif
- #endif
- ShutdownDetector* detector = new ShutdownDetector(
- g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);
diff --git a/srcpkgs/chromium/patches/fix-narrowing-cast.patch b/srcpkgs/chromium/patches/fix-narrowing-cast.patch
deleted file mode 100644
index afd42a1489ae..000000000000
--- a/srcpkgs/chromium/patches/fix-narrowing-cast.patch
+++ /dev/null
@@ -1,53 +0,0 @@
---- a/base/files/file_util_linux.cc
-+++ b/base/files/file_util_linux.cc
-@@ -23,14 +23,14 @@
-
- // Not all possible |statfs_buf.f_type| values are in linux/magic.h.
- // Missing values are copied from the statfs man page.
-- switch (statfs_buf.f_type) {
-+ switch (static_cast<uintmax_t>(statfs_buf.f_type)) {
- case 0:
- *type = FILE_SYSTEM_0;
- break;
- case EXT2_SUPER_MAGIC: // Also ext3 and ext4
- case MSDOS_SUPER_MAGIC:
- case REISERFS_SUPER_MAGIC:
-- case static_cast<int>(BTRFS_SUPER_MAGIC):
-+ case BTRFS_SUPER_MAGIC:
- case 0x5346544E: // NTFS
- case 0x58465342: // XFS
- case 0x3153464A: // JFS
-@@ -40,14 +40,14 @@
- *type = FILE_SYSTEM_NFS;
- break;
- case SMB_SUPER_MAGIC:
-- case static_cast<int>(0xFF534D42): // CIFS
-+ case 0xFF534D42: // CIFS
- *type = FILE_SYSTEM_SMB;
- break;
- case CODA_SUPER_MAGIC:
- *type = FILE_SYSTEM_CODA;
- break;
-- case static_cast<int>(HUGETLBFS_MAGIC):
-- case static_cast<int>(RAMFS_MAGIC):
-+ case HUGETLBFS_MAGIC:
-+ case RAMFS_MAGIC:
- case TMPFS_MAGIC:
- *type = FILE_SYSTEM_MEMORY;
- break;
---- a/base/system/sys_info_posix.cc
-+++ b/base/system/sys_info_posix.cc
-@@ -100,10 +100,10 @@
- if (HANDLE_EINTR(statfs(path.value().c_str(), &stats)) != 0)
- return false;
-
-- switch (stats.f_type) {
-+ switch (static_cast<uintmax_t>(stats.f_type)) {
- case TMPFS_MAGIC:
-- case static_cast<int>(HUGETLBFS_MAGIC):
-- case static_cast<int>(RAMFS_MAGIC):
-+ case HUGETLBFS_MAGIC:
-+ case RAMFS_MAGIC:
- return true;
- }
- return false;
diff --git a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch b/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
deleted file mode 100644
index 7a0337f3bf3b..000000000000
--- a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/third_party/nasm/config/config-linux.h
-+++ b/third_party/nasm/config/config-linux.h
-@@ -139,7 +139,9 @@
- #define HAVE_ACCESS 1
-
- /* Define to 1 if you have the `canonicalize_file_name' function. */
-+#ifdef __GLIBC__
- #define HAVE_CANONICALIZE_FILE_NAME 1
-+#endif
-
- /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
- /* #undef HAVE_CPU_TO_LE16 */
diff --git a/srcpkgs/chromium/patches/narrowing-cast.patch b/srcpkgs/chromium/patches/narrowing-cast.patch
new file mode 100644
index 000000000000..d10940eb7e89
--- /dev/null
+++ b/srcpkgs/chromium/patches/narrowing-cast.patch
@@ -0,0 +1,21 @@
+from the manpage for statfs:
+
+The __fsword_t type used for various fields in the statfs structure
+definition is a glibc internal type, not intended for public use. This
+leaves the programmer in a bit of a conundrum when trying to copy or
+compare these fields to local variables in a program. Using
+unsigned int for such variables suffices on most systems.
+
+--- a/base/system/sys_info_posix.cc
++++ b/base/system/sys_info_posix.cc
+@@ -64,8 +64,8 @@
+
+ switch (stats.f_type) {
+ case TMPFS_MAGIC:
+- case static_cast<int>(HUGETLBFS_MAGIC):
+- case static_cast<int>(RAMFS_MAGIC):
++ case static_cast<unsigned int>(HUGETLBFS_MAGIC):
++ case static_cast<unsigned int>(RAMFS_MAGIC):
+ return true;
+ }
+ return false;
diff --git a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch b/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
deleted file mode 100644
index 13d504d3e792..000000000000
--- a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From dda01a706453ded8c01c41775707cb5ef4e316f8 Mon Sep 17 00:00:00 2001
-From: Andres Salomon <dilinger@queued.net>
-Date: Tue, 25 Oct 2022 21:11:46 +0000
-Subject: [PATCH] Re-fix TFLite build error on linux when using the system zlib
-
-In commit ae0f9adb7e14c0d19ca695ef6ad40b321a8cb64c, I fixed some build
-errors related to minizip patch inclusion in TFLite. However, after that
-when TFLite Support was rolled to HEAD, a small part of that patch got
-dropped. The result is the following build error with 107.0.5304.62:
-
-../../third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc:22:10: fatal error: 'contrib/minizip/ioapi.h' file not found
- ^~~~~~~~~~~~~~~~~~~~~~~~~
-1 error generated.
-
-This commit re-adds the lost fix.
-
-R=junzou@chromium.org
-
-Change-Id: Ie96c3571894b5100a1e2a2771da29699eff0beb3
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3972087
-Reviewed-by: Robert Ogden <robertogden@chromium.org>
-Commit-Queue: Robert Ogden <robertogden@chromium.org>
-Auto-Submit: Andres Salomon <dilinger@queued.net>
-Cr-Commit-Position: refs/heads/main@{#1063478}
----
- .../metadata/cc/utils/zip_readonly_mem_file.cc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-index 392b6b411fe..525ae4a2b45 100644
---- a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-+++ b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-@@ -19,7 +19,7 @@ limitations under the License.
- #include <cstdio>
-
- #include "absl/strings/string_view.h" // from @com_google_absl
--#include "contrib/minizip/ioapi.h"
-+#include "third_party/zlib/contrib/minizip/ioapi.h"
-
- namespace tflite {
- namespace metadata {
diff --git a/srcpkgs/chromium/patches/remove-strip_binary.patch b/srcpkgs/chromium/patches/remove-strip_binary.patch
deleted file mode 100644
index 8b13c6a056a8..000000000000
--- a/srcpkgs/chromium/patches/remove-strip_binary.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/chrome/test/chromedriver/BUILD.gn.orig
-+++ b/chrome/test/chromedriver/BUILD.gn
-@@ -308,11 +308,7 @@
- }
- }
-
--if (is_linux) {
-- chromedriver_output = "chromedriver.unstripped"
--} else {
-- chromedriver_output = "chromedriver"
--}
-+chromedriver_output = "chromedriver"
-
- executable("$chromedriver_output") {
- testonly = true
-@@ -336,16 +332,6 @@
- }
- }
-
--if (is_linux) {
-- strip_binary("chromedriver") {
-- testonly = true
-- binary_input = "$root_out_dir/$chromedriver_output"
-- symbol_output = "$root_out_dir/chromedriver.debug"
-- stripped_binary_output = "$root_out_dir/chromedriver"
-- deps = [ ":$chromedriver_output" ]
-- }
--}
--
- python_library("chromedriver_py_tests") {
- testonly = true
- deps = [
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch b/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
deleted file mode 100644
index 28c4ad35f14e..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-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;
-
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch b/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
deleted file mode 100644
index 0c03ad4a65eb..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-commit 981437bc846fcdb854062e89fd3d86f112e5f426
-Author: q66 <daniel@octaforge.org>
-Date: Sat Jun 25 12:35:37 2022 +0200
-
- Use generic target for now.
-
- This is because the source tree is missing vsx optimizations that
- then do not get included and result in failed linking such as:
-
- ld.lld: error: undefined symbol: vpx_mse16x16_vsx
-
-diff --git a/third_party/libvpx/generate_gni.sh b/third_party/libvpx/generate_gni.sh
-index 7429080..43ee29a 100755
---- a/third_party/libvpx/generate_gni.sh
-+++ b/third_party/libvpx/generate_gni.sh
-@@ -405,7 +405,7 @@
- gen_config_files linux/mips64el "--target=mips64-linux-gcc ${all_platforms}"
- gen_config_files linux/loongarch \
- "--target=loongarch64-linux-gcc ${all_platforms}"
--gen_config_files linux/ppc64 "--target=ppc64le-linux-gcc ${all_platforms}"
-+gen_config_files linux/ppc64 "--target=generic-gnu ${all_platforms}"
- gen_config_files linux/generic "--target=generic-gnu $HIGHBD ${all_platforms}"
- gen_config_files win/arm64 \
- "--target=arm64-win64-vs15 ${all_platforms} ${HIGHBD}"
-@@ -468,7 +468,7 @@
- gen_rtcd_header linux/mipsel mipsel
- gen_rtcd_header linux/mips64el mips64el
- gen_rtcd_header linux/loongarch loongarch
--gen_rtcd_header linux/ppc64 ppc
-+gen_rtcd_header linux/ppc64 generic
- gen_rtcd_header linux/generic generic
- gen_rtcd_header win/arm64 armv8
- gen_rtcd_header win/ia32 x86 "${require_sse2}"
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch b/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
deleted file mode 100644
index 4bfb5d494b06..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/sandbox/linux/system_headers/linux_stat.h
-+++ b/sandbox/linux/system_headers/linux_stat.h
-@@ -155,6 +155,28 @@ struct kernel_stat {
- unsigned int __unused4;
- unsigned int __unused5;
- };
-+#elif defined(__powerpc64__)
-+struct kernel_stat {
-+ unsigned long st_dev;
-+ unsigned long st_ino;
-+ unsigned long st_nlink;
-+ unsigned int st_mode;
-+ unsigned int st_uid;
-+ unsigned int st_gid;
-+ unsigned long st_rdev;
-+ long st_size;
-+ unsigned long st_blksize;
-+ unsigned long st_blocks;
-+ unsigned long st_atime_;
-+ unsigned long st_atime_nsec_;
-+ unsigned long st_mtime_;
-+ unsigned long st_mtime_nsec_;
-+ unsigned long st_ctime_;
-+ unsigned long st_ctime_nsec_;
-+ unsigned long __unused4;
-+ unsigned long __unused5;
-+ unsigned long __unused6;
-+};
- #endif
-
- // On 32-bit systems, we default to the 64-bit stat struct like libc
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 0bc505358916..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,3590 +0,0 @@
-commit 2c013a317b1114ef67cdbbc30824b28907b9ea94
-Author: Daniel Kolesa <daniel@octaforge.org>
-Date: Wed Mar 3 19:08:29 2021 +0100
-
- ppc64le support
-
-diff --git a/build/download_nacl_toolchains.py b/build/download_nacl_toolchains.py
-index 286a92a27..ec36a85d3 100755
---- a/build/download_nacl_toolchains.py
-+++ b/build/download_nacl_toolchains.py
-@@ -13,6 +13,10 @@ import sys
-
-
- def Main(args):
-+ # If `disable_nacl=1` is in GYP_DEFINES, exit
-+ if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''):
-+ return 0
-+
- script_dir = os.path.dirname(os.path.abspath(__file__))
- src_dir = os.path.dirname(script_dir)
- nacl_dir = os.path.join(src_dir, 'native_client')
---- a/chrome/installer/linux/BUILD.gn
-+++ b/chrome/installer/linux/BUILD.gn
-@@ -97,8 +97,6 @@
- "$root_out_dir/xdg-mime",
- "$root_out_dir/xdg-settings",
- "$root_out_dir/locales/en-US.pak",
-- "$root_out_dir/MEIPreload/manifest.json",
-- "$root_out_dir/MEIPreload/preloaded_data.pb",
- ]
-
- action_foreach("calculate_deb_dependencies") {
-@@ -377,7 +377,6 @@
- "//chrome",
- "//chrome:packed_resources",
- "//chrome/browser/enterprise/connectors/device_trust/key_management/installer/management_service:chrome_management_service",
-- "//chrome/browser/resources/media/mei_preload:component",
- "//components/crash/core/app:chrome_crashpad_handler",
- "//sandbox/linux:chrome_sandbox",
- ]
-diff --git a/sandbox/features.gni b/sandbox/features.gni
-index db30ae6d6..9dc09bf53 100644
---- a/sandbox/features.gni
-+++ b/sandbox/features.gni
-@@ -11,7 +11,8 @@ import("//build/config/nacl/config.gni")
- use_seccomp_bpf = (is_linux || is_chromeos || is_android) &&
- (current_cpu == "x86" || current_cpu == "x64" ||
- current_cpu == "arm" || current_cpu == "arm64" ||
-- current_cpu == "mipsel" || current_cpu == "mips64el")
-+ current_cpu == "mipsel" || current_cpu == "mips64el" ||
-+ current_cpu == "ppc64")
-
- use_seccomp_bpf = use_seccomp_bpf || is_nacl_nonsfi
-
-diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn
-index e9a94b461..cca1a5da5 100644
---- a/sandbox/linux/BUILD.gn
-+++ b/sandbox/linux/BUILD.gn
-@@ -427,6 +427,8 @@ component("sandbox_services") {
-
- source_set("sandbox_services_headers") {
- sources = [
-+ "system_headers/ppc64_linux_syscalls.h",
-+ "system_headers/ppc64_linux_ucontext.h",
- "system_headers/arm64_linux_syscalls.h",
- "system_headers/arm_linux_syscalls.h",
- "system_headers/arm_linux_ucontext.h",
-diff --git a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-index 313511f22..0ca3a326f 100644
---- a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-+++ b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-@@ -56,6 +56,13 @@
- #define MAX_PUBLIC_SYSCALL __NR_syscalls
- #define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-
-+#elif defined(__powerpc64__)
-+
-+#include <asm-generic/unistd.h>
-+#define MIN_SYSCALL 0u
-+#define MAX_PUBLIC_SYSCALL __NR_syscalls
-+#define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-+
- #else
- #error "Unsupported architecture"
- #endif
-diff --git a/sandbox/linux/bpf_dsl/seccomp_macros.h b/sandbox/linux/bpf_dsl/seccomp_macros.h
-index 1a407b952..a6aec544e 100644
---- a/sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ b/sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,6 +16,9 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
-+#elif defined(__powerpc64__)
-+// Manually define greg_t on ppc64
-+typedef unsigned long long greg_t;
- #endif
- #endif
-
-@@ -346,6 +349,51 @@ struct regs_struct {
- #define SECCOMP_PT_PARM4(_regs) (_regs).regs[3]
- #define SECCOMP_PT_PARM5(_regs) (_regs).regs[4]
- #define SECCOMP_PT_PARM6(_regs) (_regs).regs[5]
-+
-+#elif defined(__powerpc64__)
-+#include <asm/ptrace.h>
-+
-+typedef struct pt_regs regs_struct;
-+
-+#ifdef ARCH_CPU_LITTLE_ENDIAN
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64LE
-+#else
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64
-+#endif
-+
-+#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+
-+#define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
-+#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
-+#define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-+#define SECCOMP_PARM4(_ctx) SECCOMP_REG(_ctx, 6)
-+#define SECCOMP_PARM5(_ctx) SECCOMP_REG(_ctx, 7)
-+#define SECCOMP_PARM6(_ctx) SECCOMP_REG(_ctx, 8)
-+
-+#define SECCOMP_NR_IDX (offsetof(struct arch_seccomp_data, nr))
-+#define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch))
-+#define SECCOMP_IP_MSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 4)
-+#define SECCOMP_IP_LSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 0)
-+#define SECCOMP_ARG_MSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 4)
-+#define SECCOMP_ARG_LSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 0)
-+
-+#define SECCOMP_PT_RESULT(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_SYSCALL(_regs) (_regs).gpr[0]
-+#define SECCOMP_PT_IP(_regs) (_regs).nip
-+#define SECCOMP_PT_PARM1(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_PARM2(_regs) (_regs).gpr[4]
-+#define SECCOMP_PT_PARM3(_regs) (_regs).gpr[5]
-+#define SECCOMP_PT_PARM4(_regs) (_regs).gpr[6]
-+#define SECCOMP_PT_PARM5(_regs) (_regs).gpr[7]
-+#define SECCOMP_PT_PARM6(_regs) (_regs).gpr[8]
-+
- #else
- #error Unsupported target platform
-
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-index 6a1ec2389..f20c582dd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-@@ -88,7 +88,8 @@ bool IsBaselinePolicyWatched(int sysno) {
- SyscallSets::IsPrctl(sysno) ||
- SyscallSets::IsProcessGroupOrSession(sysno) ||
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- SyscallSets::IsSocketCall(sysno) ||
- #endif
- #if defined(__arm__)
-@@ -227,7 +228,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_mmap)
- return RestrictMmapFlags();
- #endif
-@@ -245,7 +246,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- return RestrictPrctl();
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_socketpair) {
- // Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen.
- static_assert(AF_UNIX == PF_UNIX,
-@@ -285,7 +286,8 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- if (SyscallSets::IsSocketCall(sysno))
- return RestrictSocketcallCommand();
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:11:10.481579470 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:12:43.524831376 -0400
-@@ -302,7 +302,7 @@
- TEST_BASELINE_SIGSYS(__NR_syslog)
- TEST_BASELINE_SIGSYS(__NR_timer_create)
-
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- TEST_BASELINE_SIGSYS(__NR_inotify_init)
- TEST_BASELINE_SIGSYS(__NR_vserver)
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-@@ -358,7 +358,16 @@
- if (args.nr == __NR_fstatat_default) {
- if (*reinterpret_cast<const char*>(args.args[1]) == '\0' &&
- args.args[3] == static_cast<uint64_t>(AT_EMPTY_PATH)) {
-- return syscall(__NR_fstat_default, static_cast<int>(args.args[0]),
-+ int fd = static_cast<int>(args.args[0]);
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO: Investigate the root cause and fix in glibc
-+ if (fd < 0)
-+ fd = -fd;
-+#endif
-+ return syscall(__NR_fstat_default, fd,
- reinterpret_cast<default_stat_struct*>(args.args[2]));
- }
- return -reinterpret_cast<intptr_t>(fs_denied_errno);
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
-index 2a97d3916..8e81aa6cf 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-14 14:41:08.000000000 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-15 13:17:57.808715733 -0400
-@@ -37,7 +37,8 @@
-
- #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
- !defined(__arm__) && !defined(__aarch64__) && \
-- !defined(PTRACE_GET_THREAD_AREA)
-+ !defined(PTRACE_GET_THREAD_AREA) && \
-+ !defined(__powerpc64__)
- // Also include asm/ptrace-abi.h since ptrace.h in older libc (for instance
- // the one in Ubuntu 16.04 LTS) is missing PTRACE_GET_THREAD_AREA.
- // asm/ptrace-abi.h doesn't exist on arm32 and PTRACE_GET_THREAD_AREA isn't
-@@ -45,6 +46,11 @@
- #include <asm/ptrace-abi.h>
- #endif
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- #if BUILDFLAG(IS_ANDROID)
-
- #if !defined(F_DUPFD_CLOEXEC)
-@@ -99,6 +105,14 @@
- return true;
- #else
- return false;
-+#endif
-+}
-+
-+inline bool IsArchitecturePPC64() {
-+#if defined(__powerpc64__)
-+ return true;
-+#else
-+ return false;
- #endif
- }
-
-@@ -239,6 +254,8 @@
- uint64_t kOLargeFileFlag = O_LARGEFILE;
- if (IsArchitectureX86_64() || IsArchitectureI386() || IsArchitectureMips())
- kOLargeFileFlag = 0100000;
-+ else if (IsArchitecturePPC64())
-+ kOLargeFileFlag = 0200000;
-
- const Arg<int> cmd(1);
- const Arg<long> long_arg(2);
-@@ -256,7 +273,16 @@
- F_SETLKW,
- F_GETLK,
- F_DUPFD,
-- F_DUPFD_CLOEXEC),
-+ F_DUPFD_CLOEXEC
-+#if defined(__powerpc64__)
-+// On PPC64, F_SETLK, F_GETLK, F_SETLKW are defined as the 64-bit variants
-+// but glibc will sometimes still use the 32-bit versions. Allow both.
-+ ,
-+ 5, /* F_GETLK (32) */
-+ 6, /* F_SETLK (32) */
-+ 7 /* F_SETLKW (32) */
-+#endif
-+ ),
- Allow())
- .Case(F_SETFL,
- If((long_arg & ~kAllowedMask) == 0, Allow()).Else(CrashSIGSYS()))
-@@ -266,7 +292,7 @@
- // clang-format on
- }
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- ResultExpr RestrictSocketcallCommand() {
- // Unfortunately, we are unable to restrict the first parameter to
- // socketpair(2). Whilst initially sounding bad, it's noteworthy that very
-@@ -419,7 +445,7 @@
- #endif
- return Switch(request)
- .CASES((
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- PTRACE_GETREGS, PTRACE_GETFPREGS, PTRACE_GET_THREAD_AREA,
- PTRACE_GETREGSET,
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-index ba4289f05..9a4d5ab2d 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-@@ -48,7 +48,7 @@ SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictMprotectFlags();
- // O_NONBLOCK | O_SYNC | O_LARGEFILE | O_CLOEXEC | O_NOATIME.
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictFcntlCommands();
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- // Restrict socketcall(2) to only allow socketpair(2), send(2), recv(2),
- // sendto(2), recvfrom(2), shutdown(2), sendmsg(2) and recvmsg(2).
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictSocketcallCommand();
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-index 642df7207..34f47eb73 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-@@ -29,7 +29,8 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- switch (sysno) {
- case __NR_gettimeofday:
- #if defined(__i386__) || defined(__x86_64__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_time:
- #endif
- return true;
-@@ -52,12 +53,14 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- case __NR_clock_nanosleep_time64: // Parameters filtered by RestrictClockID().
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ftime: // Obsolete.
- #endif
- case __NR_settimeofday: // Privileged.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stime:
- #endif
- default:
-@@ -135,7 +138,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_faccessat: // EPERM not a valid errno.
- case __NR_fchmodat:
- case __NR_fchownat: // Should be called chownat ?
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat: // fstatat(). EPERM not a valid errno.
- #elif defined(__i386__) || defined(__arm__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-@@ -154,7 +157,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_memfd_create:
- case __NR_mkdirat:
- case __NR_mknodat:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldlstat:
- case __NR_oldstat:
- #endif
-@@ -168,7 +171,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- #endif
- case __NR_statfs: // EPERM not a valid errno.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_statfs64:
- #endif
- case __NR_symlinkat:
-@@ -178,7 +182,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_truncate64:
- #endif
- case __NR_unlinkat:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_utime:
- #endif
- case __NR_utimensat: // New.
-@@ -203,7 +208,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- #endif
- return true;
- // TODO(jln): these should be denied gracefully as well (moved below).
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_fadvise64: // EPERM not a valid errno.
- #endif
- #if defined(__i386__)
-@@ -216,11 +222,12 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_flock: // EPERM not a valid errno.
- case __NR_fstatfs: // Give information about the whole filesystem.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_fstatfs64:
- #endif
- case __NR_fsync: // EPERM not a valid errno.
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldfstat:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-@@ -228,6 +235,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_sync_file_range: // EPERM not a valid errno.
- #elif defined(__arm__)
- case __NR_arm_sync_file_range: // EPERM not a valid errno.
-+#elif defined(__powerpc64__)
-+ case __NR_sync_file_range2: // EPERM not a valid errno.
- #endif
- default:
- return false;
-@@ -248,7 +257,8 @@ bool SyscallSets::IsDeniedFileSystemAccessViaFd(int sysno) {
- #endif
- case __NR_getdents64: // EPERM not a valid errno.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_readdir:
- #endif
- return true;
-@@ -289,7 +299,7 @@ bool SyscallSets::IsGetSimpleId(int sysno) {
- bool SyscallSets::IsProcessPrivilegeChange(int sysno) {
- switch (sysno) {
- case __NR_capset:
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_ioperm: // Intel privilege.
- case __NR_iopl: // Intel privilege.
- #endif
-@@ -340,8 +350,11 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- case __NR_rt_sigreturn:
- case __NR_rt_sigtimedwait:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
-+#ifndef __powerpc64__
- case __NR_rt_sigtimedwait_time64:
-+#endif
- case __NR_sigaction:
- case __NR_sigprocmask:
- case __NR_sigreturn:
-@@ -357,7 +370,8 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- #endif
- case __NR_signalfd4:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_sigpending:
- case __NR_sigsuspend:
- #endif
-@@ -381,7 +395,7 @@ bool SyscallSets::IsAllowedOperationOnFd(int sysno) {
- #endif
- case __NR_dup3:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_shutdown:
- #endif
- return true;
-@@ -414,7 +428,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- case __NR_exit_group:
- case __NR_wait4:
- case __NR_waitid:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_waitpid:
- #endif
- return true;
-@@ -431,7 +445,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- #endif
- case __NR_set_tid_address:
- case __NR_unshare:
--#if !defined(__mips__) && !defined(__aarch64__)
-+#if !defined(__mips__) && !defined(__aarch64__) || defined(__powerpc64__)
- case __NR_vfork:
- #endif
- default:
-@@ -484,7 +498,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- return true;
- default:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_socketpair: // We will want to inspect its argument.
- #endif
- return false;
-@@ -494,7 +508,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- switch (sysno) {
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_accept:
- case __NR_accept4:
- case __NR_bind:
-@@ -509,7 +523,8 @@ bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- bool SyscallSets::IsSocketCall(int sysno) {
- switch (sysno) {
-@@ -523,7 +538,8 @@ bool SyscallSets::IsSocketCall(int sysno) {
- }
- #endif
-
--#if defined(__x86_64__) || defined(__arm__) || defined(__mips__)
-+#if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- bool SyscallSets::IsNetworkSocketInformation(int sysno) {
- switch (sysno) {
- case __NR_getpeername:
-@@ -548,7 +564,7 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
- case __NR_mincore:
- case __NR_mlockall:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_mmap:
- #endif
- #if defined(__i386__) || defined(__arm__) || \
-@@ -578,7 +594,8 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- switch (sysno) {
- case __NR_lseek:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR__llseek:
- #endif
- #if !defined(__aarch64__)
-@@ -598,26 +615,28 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- case __NR_readv:
- case __NR_pread64:
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_recv:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_recvfrom: // Could specify source.
- case __NR_recvmsg: // Could specify source.
- #endif
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_select:
- #endif
--#if defined(__i386__) || defined(__arm__) || defined(__mips__)
-+#if defined(__i386__) || defined(__arm__) || defined(__mips__) || defined(__powerpc64__)
- case __NR__newselect:
- #endif
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_send:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_sendmsg: // Could specify destination.
- case __NR_sendto: // Could specify destination.
- #endif
-@@ -673,7 +692,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- return true;
- case __NR_getpriority:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_nice:
- #endif
- case __NR_setpriority:
-@@ -685,7 +705,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- bool SyscallSets::IsAdminOperation(int sysno) {
- switch (sysno) {
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_bdflush:
- #endif
- case __NR_kexec_load:
-@@ -701,7 +722,8 @@ bool SyscallSets::IsAdminOperation(int sysno) {
-
- bool SyscallSets::IsKernelModule(int sysno) {
- switch (sysno) {
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_create_module:
- case __NR_get_kernel_syms: // Should ENOSYS.
- case __NR_query_module:
-@@ -734,7 +756,8 @@ bool SyscallSets::IsFsControl(int sysno) {
- case __NR_swapoff:
- case __NR_swapon:
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_umount:
- #endif
- case __NR_umount2:
-@@ -750,7 +773,7 @@ bool SyscallSets::IsNuma(int sysno) {
- case __NR_getcpu:
- case __NR_mbind:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_migrate_pages:
- #endif
- case __NR_move_pages:
-@@ -785,14 +808,15 @@ bool SyscallSets::IsGlobalProcessEnvironment(int sysno) {
- switch (sysno) {
- case __NR_acct: // Privileged.
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
--#if defined(__i386__) || defined(__arm__)
-+#if defined(__i386__) || defined(__arm__) || defined(__powerpc64__)
- case __NR_ugetrlimit:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ulimit:
- #endif
- case __NR_getrusage:
-@@ -826,7 +850,7 @@ bool SyscallSets::IsGlobalSystemStatus(int sysno) {
- #endif
- case __NR_sysinfo:
- case __NR_uname:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_olduname:
- case __NR_oldolduname:
- #endif
-@@ -892,8 +916,16 @@ bool SyscallSets::IsSystemVSemaphores(int sysno) {
- }
- #endif
-
-+/* shitty hack around Void's 4.19 kernel headers missing those numbers */
-+#if defined(__powerpc64__) && !defined(__NR_shmget)
-+#define __NR_shmget 395
-+#define __NR_shmctl 396
-+#define __NR_shmat 397
-+#define __NR_shmdt 398
-+#endif
-+
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- bool SyscallSets::IsSystemVSharedMemory(int sysno) {
-@@ -925,7 +957,8 @@ bool SyscallSets::IsSystemVMessageQueue(int sysno) {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- bool SyscallSets::IsSystemVIpc(int sysno) {
- switch (sysno) {
-@@ -945,7 +978,8 @@ bool SyscallSets::IsAnySystemV(int sysno) {
- return IsSystemVMessageQueue(sysno) || IsSystemVSemaphores(sysno) ||
- IsSystemVSharedMemory(sysno);
- #elif defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- return IsSystemVIpc(sysno);
- #endif
- }
-@@ -1002,7 +1036,8 @@ bool SyscallSets::IsFaNotify(int sysno) {
- bool SyscallSets::IsTimer(int sysno) {
- switch (sysno) {
- case __NR_getitimer:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_alarm:
- #endif
- case __NR_setitimer:
-@@ -1084,18 +1119,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_syncfs:
- case __NR_vhangup:
- // The system calls below are not implemented.
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_afs_syscall:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_break:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_getpmsg:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_gtty:
- case __NR_idle:
- case __NR_lock:
-@@ -1103,20 +1142,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_prof:
- case __NR_profil:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_putpmsg:
- #endif
- #if defined(__x86_64__)
- case __NR_security:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stty:
- #endif
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- case __NR_tuxcall:
- #endif
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- case __NR_vserver:
- #endif
- return true;
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-index 923533ec9..411f72acd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-@@ -43,13 +43,14 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsDeniedGetOrModifySocket(int sysno);
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- static bool IsSocketCall(int sysno);
- #endif
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- static bool IsNetworkSocketInformation(int sysno);
- #endif
-
-@@ -76,7 +77,7 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsSystemVSemaphores(int sysno);
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- static bool IsSystemVSharedMemory(int sysno);
-@@ -88,7 +89,8 @@ class SANDBOX_EXPORT SyscallSets {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- static bool IsSystemVIpc(int sysno);
- #endif
-diff --git a/sandbox/linux/seccomp-bpf/syscall.cc b/sandbox/linux/seccomp-bpf/syscall.cc
-index e47e98bf5..d53a7ff56 100644
---- a/sandbox/linux/seccomp-bpf/syscall.cc
-+++ b/sandbox/linux/seccomp-bpf/syscall.cc
-@@ -18,7 +18,7 @@ namespace sandbox {
- namespace {
-
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined (ARCH_CPU_PPC64_FAMILY)
- // Number that's not currently used by any Linux kernel ABIs.
- const int kInvalidSyscallNumber = 0x351d3;
- #else
-@@ -310,12 +310,56 @@ asm(// We need to be able to tell the kernel exactly where we made a
- // Enter the kernel
- "svc 0\n"
- "2:ret\n"
-+ ".cfi_endproc\n"
-+ ".size SyscallAsm, .-SyscallAsm\n"
-+#elif defined(__powerpc64__)
-+ ".text\n"
-+ ".align 4\n"
-+ ".type SyscallAsm @function\n"
-+ "SyscallAsm:\n"
-+ ".cfi_startproc\n"
-+
-+ // Check if r3 is negative
-+ "cmpdi 3, 0\n"
-+ "bgt 2f\n"
-+
-+ // Load address of 3f into r3 and return
-+ "mflr 10\n"
-+ "bl 1f\n"
-+ "1: mflr 3\n"
-+ "mtlr 10\n"
-+ "addi 3, 3, 4*13\n"
-+ "blr\n"
-+
-+ // Load arguments from array into r3-8
-+ // save param 3 in r10
-+ "2:\n"
-+ "mr 0, 3\n"
-+ "ld 3, 0(4)\n"
-+ "ld 5, 16(4)\n"
-+ "ld 6, 24(4)\n"
-+ "ld 7, 32(4)\n"
-+ "ld 8, 40(4)\n"
-+ "ld 4, 8(4)\n"
-+ "li 9, 0\n"
-+
-+ // Enter kernel
-+ "sc\n"
-+
-+ // Magic return address
-+ "3:\n"
-+ // Like MIPS, ppc64 return values are always positive.
-+ // Check for error in cr0.SO and negate upon error
-+ "bc 4, 3, 4f\n"
-+ "neg 3, 3\n"
-+ "4: blr\n"
-+
- ".cfi_endproc\n"
- ".size SyscallAsm, .-SyscallAsm\n"
- #endif
- ); // asm
-
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- extern "C" {
- intptr_t SyscallAsm(intptr_t nr, const intptr_t args[6]);
- }
-@@ -429,6 +473,8 @@ intptr_t Syscall::Call(int nr,
- ret = inout;
- }
-
-+#elif defined(__powerpc64__)
-+ intptr_t ret = SyscallAsm(nr, args);
- #else
- #error "Unimplemented architecture"
- #endif
-@@ -445,8 +491,18 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // needs to be changed back.
- ret_val = -ret_val;
- SECCOMP_PARM4(ctx) = 1;
-- } else
-+ } else {
- SECCOMP_PARM4(ctx) = 0;
-+ }
-+#endif
-+#if defined(__powerpc64__)
-+ // Same as MIPS, need to invert ret and set error register (cr0.SO)
-+ if (ret_val <= -1 && ret_val >= -4095) {
-+ ret_val = -ret_val;
-+ ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ } else {
-+ ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
- }
-diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc
-index f5b86a73a..5e6c4a068 100644
---- a/sandbox/linux/seccomp-bpf/trap.cc
-+++ b/sandbox/linux/seccomp-bpf/trap.cc
-@@ -232,6 +232,20 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
- SetIsInSigHandler();
- }
-
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO(shawn@anastas.io): investigate this issue further
-+ auto nr = SECCOMP_SYSCALL(ctx);
-+ if (nr == __NR_openat || nr == __NR_mkdirat || nr == __NR_faccessat || nr == __NR_readlinkat ||
-+ nr == __NR_renameat || nr == __NR_renameat2 || nr == __NR_newfstatat || nr == __NR_unlinkat) {
-+ if (static_cast<int>(SECCOMP_PARM1(ctx)) > 0) {
-+ SECCOMP_PARM1(ctx) = -SECCOMP_PARM1(ctx);
-+ }
-+ }
-+#endif
-+
- // Copy the seccomp-specific data into a arch_seccomp_data structure. This
- // is what we are showing to TrapFnc callbacks that the system call
- // evaluator registered with the sandbox.
-diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc
-index d7b5d8c44..4adc6d0d4 100644
---- a/sandbox/linux/services/credentials.cc
-+++ b/sandbox/linux/services/credentials.cc
-@@ -81,7 +81,7 @@ bool ChrootToSafeEmptyDir() {
- pid_t pid = -1;
- alignas(16) char stack_buf[PTHREAD_STACK_MIN];
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // The stack grows downward.
- void* stack = stack_buf + sizeof(stack_buf);
- #else
-@@ -90,7 +90,9 @@
-
- int clone_flags = CLONE_FS | LINUX_SIGCHLD;
- void* tls = nullptr;
--#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
-+// RAJA this might be it...
-+#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY) || \
-+ defined(ARCH_CPU_PPC64_FAMILY)) && \
- !defined(MEMORY_SANITIZER)
- // Use CLONE_VM | CLONE_VFORK as an optimization to avoid copying page tables.
- // Since clone writes to the new child's TLS before returning, we must set a
-@@ -98,6 +100,11 @@
- // glibc performs syscalls by calling a function pointer in TLS, so we do not
- // attempt this optimization.
- // TODO(crbug.com/1247458) Broken in MSan builds after LLVM f1bb30a4956f.
-+ //
-+ // NOTE: Without CLONE_VM, fontconfig will attempt to reload configuration
-+ // in every thread. Since the rendered threads are sandboxed without
-+ // filesystem access (e.g. to /etc/fonts/fonts.conf) this will cause font
-+ // configuraiton loading failures and no fonts will be displayed!
- clone_flags |= CLONE_VM | CLONE_VFORK | CLONE_SETTLS;
-
- char tls_buf[PTHREAD_STACK_MIN] = {0};
-diff --git a/sandbox/linux/services/syscall_wrappers.cc b/sandbox/linux/services/syscall_wrappers.cc
-index fcfd2aa12..f6eb32fb7 100644
---- a/sandbox/linux/services/syscall_wrappers.cc
-+++ b/sandbox/linux/services/syscall_wrappers.cc
-@@ -58,7 +58,7 @@ long sys_clone(unsigned long flags,
- #if defined(ARCH_CPU_X86_64)
- return syscall(__NR_clone, flags, child_stack, ptid, ctid, tls);
- #elif defined(ARCH_CPU_X86) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // CONFIG_CLONE_BACKWARDS defined.
- return syscall(__NR_clone, flags, child_stack, ptid, tls, ctid);
- #endif
-diff --git a/sandbox/linux/syscall_broker/broker_process.cc b/sandbox/linux/syscall_broker/broker_process.cc
-index d72c9d238..77f1d95f5 100644
---- a/sandbox/linux/syscall_broker/broker_process.cc
-+++ b/sandbox/linux/syscall_broker/broker_process.cc
-@@ -169,7 +169,7 @@ bool BrokerProcess::IsSyscallBrokerable(int sysno, bool fast_check) const {
- #if defined(__NR_fstatat64)
- case __NR_fstatat64:
- #endif
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat:
- #endif
- return !fast_check || allowed_command_set_.test(COMMAND_STAT);
-diff --git a/sandbox/linux/system_headers/linux_seccomp.h b/sandbox/linux/system_headers/linux_seccomp.h
-index 1fa47ed09..39cc9ab53 100644
---- a/sandbox/linux/system_headers/linux_seccomp.h
-+++ b/sandbox/linux/system_headers/linux_seccomp.h
-@@ -41,6 +41,9 @@
- #ifndef EM_AARCH64
- #define EM_AARCH64 183
- #endif
-+#ifndef EM_PPC64
-+#define EM_PPC64 21
-+#endif
-
- #ifndef __AUDIT_ARCH_64BIT
- #define __AUDIT_ARCH_64BIT 0x80000000
-@@ -73,6 +76,12 @@
- #ifndef AUDIT_ARCH_AARCH64
- #define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
- #endif
-+#ifndef AUDIT_ARCH_PPC64
-+#define AUDIT_ARCH_PPC64 (EM_PPC64 | __AUDIT_ARCH_64BIT)
-+#endif
-+#ifndef AUDIT_ARCH_PPC64LE
-+#define AUDIT_ARCH_PPC64LE (EM_PPC64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
-+#endif
-
- // For prctl.h
- #ifndef PR_SET_SECCOMP
-diff --git a/sandbox/linux/system_headers/linux_signal.h b/sandbox/linux/system_headers/linux_signal.h
-index f5a736761..515b21a5f 100644
---- a/sandbox/linux/system_headers/linux_signal.h
-+++ b/sandbox/linux/system_headers/linux_signal.h
-@@ -13,7 +13,7 @@
- // (not undefined, but defined different values and in different memory
- // layouts). So, fill the gap here.
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
-
- #define LINUX_SIGHUP 1
- #define LINUX_SIGINT 2
-diff --git a/sandbox/linux/system_headers/linux_syscalls.h b/sandbox/linux/system_headers/linux_syscalls.h
-index 2b78a0cc3..0a70f5ea5 100644
---- a/sandbox/linux/system_headers/linux_syscalls.h
-+++ b/sandbox/linux/system_headers/linux_syscalls.h
-@@ -35,5 +35,9 @@
- #include "sandbox/linux/system_headers/arm64_linux_syscalls.h"
- #endif
-
-+#if defined(__powerpc64__)
-+#include "sandbox/linux/system_headers/ppc64_linux_syscalls.h"
-+#endif
-+
- #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SYSCALLS_H_
-
-diff --git a/sandbox/linux/system_headers/ppc64_linux_syscalls.h b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-new file mode 100644
-index 000000000..ccacffe22
---- /dev/null
-+++ b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-@@ -0,0 +1,12 @@
-+// Copyright 2014 The Chromium Authors. All rights reserved.
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+#define SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+
-+#include <asm/unistd.h>
-+
-+//TODO: is it necessary to redefine syscall numbers for PPC64?
-+
-+#endif // SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-diff --git a/sandbox/policy/linux/bpf_utility_policy_linux.cc b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_utility_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-@@ -34,7 +34,7 @@
- case __NR_fdatasync:
- case __NR_fsync:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
- #if defined(__i386__) || defined(__arm__)
-diff --git a/sandbox/policy/linux/bpf_renderer_policy_linux.cc b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-@@ -15,6 +15,11 @@
- #include "sandbox/linux/system_headers/linux_syscalls.h"
- #include "sandbox/policy/linux/sandbox_linux.h"
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- // TODO(vignatti): replace the local definitions below with #include
- // <linux/dma-buf.h> once kernel version 4.6 becomes widely used.
- #include <linux/types.h>
-@@ -77,7 +77,7 @@
- case __NR_ftruncate64:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- case __NR_setrlimit:
- // We allow setrlimit to dynamically adjust the address space limit as
-diff --git a/third_party/angle/src/compiler/translator/InfoSink.h b/third_party/angle/src/compiler/translator/InfoSink.h
-index 3a807e1e3..5258617a7 100644
---- a/third_party/angle/src/compiler/translator/InfoSink.h
-+++ b/third_party/angle/src/compiler/translator/InfoSink.h
-@@ -92,7 +92,16 @@ class TInfoSinkBase
- stream.precision(8);
- stream << f;
- }
-- sink.append(stream.str());
-+
-+ // Hack to work around a bug where negative floating point values
-+ // are rendered like '.0.5' instead of '-0.5'
-+ std::string res(stream.str());
-+
-+ if (signbit(f)) { // test if f is negative
-+ res[0] = '-';
-+ }
-+
-+ sink.append(res);
- return *this;
- }
- // Write boolean values as their names instead of integral value.
-diff --git a/third_party/angle/src/libANGLE/Constants.h b/third_party/angle/src/libANGLE/Constants.h
-index fcbc9246a..39ae66148 100644
---- a/third_party/angle/src/libANGLE/Constants.h
-+++ b/third_party/angle/src/libANGLE/Constants.h
-@@ -9,6 +9,7 @@
- #ifndef LIBANGLE_CONSTANTS_H_
- #define LIBANGLE_CONSTANTS_H_
-
-+#include <cstddef>
- #include "common/platform.h"
-
- #include <stdint.h>
-diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
-index 17cf9cda9..8ce96bd32 100644
---- a/third_party/boringssl/BUILD.gn
-+++ b/third_party/boringssl/BUILD.gn
-@@ -103,6 +103,13 @@ if (is_win && !is_msan && current_cpu != "arm64") {
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-+ } else if (current_cpu == "ppc64") {
-+ if (is_linux) {
-+ # TODO: ppc64 (be) check
-+ sources += crypto_sources_linux_ppc64le
-+ } else {
-+ public_configs = [ ":no_asm_config" ]
-+ }
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-diff --git a/third_party/breakpad/BUILD.gn b/third_party/breakpad/BUILD.gn
-index 4af3d7bbf..adbf54159 100644
---- a/third_party/breakpad/BUILD.gn
-+++ b/third_party/breakpad/BUILD.gn
-@@ -596,7 +596,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/minidump_file_writer.h",
- "breakpad/src/common/convert_UTF.cc",
- "breakpad/src/common/convert_UTF.h",
-- "breakpad/src/common/linux/breakpad_getcontext.S",
- "breakpad/src/common/linux/elf_core_dump.cc",
- "breakpad/src/common/linux/elf_core_dump.h",
- "breakpad/src/common/linux/elfutils.cc",
-@@ -634,6 +633,14 @@ if (is_linux || is_chromeos || is_android) {
-
- libs = [ "dl" ]
-
-+ if (current_cpu == "ppc64") {
-+ defines = [ "HAVE_GETCONTEXT" ]
-+ } else {
-+ sources += [
-+ "breakpad/src/common/linux/breakpad_getcontext.S"
-+ ]
-+ }
-+
- include_dirs = [
- ".",
- "breakpad/src",
-@@ -682,7 +689,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc",
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
- "breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
-- "breakpad/src/common/linux/breakpad_getcontext_unittest.cc",
- "breakpad/src/common/linux/elf_core_dump_unittest.cc",
- "breakpad/src/common/linux/file_id_unittest.cc",
- "breakpad/src/common/linux/linux_libc_support_unittest.cc",
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-index 07d9171a0..9aed4cb36 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-@@ -44,6 +44,8 @@ typedef MDRawContextARM RawContextCPU;
- typedef MDRawContextARM64_Old RawContextCPU;
- #elif defined(__mips__)
- typedef MDRawContextMIPS RawContextCPU;
-+#elif defined(__powerpc64__)
-+typedef MDRawContextPPC64 RawContextCPU;
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index aae1dc13b..03afec7a5 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -270,7 +270,42 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->float_save.fir = mcontext.fpc_eir;
- #endif
- }
--#endif // __mips__
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t ThreadInfo::GetInstructionPointer() const {
-+ return mcontext.gp_regs[PT_NIP];
-+}
-+
-+void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = mcontext.gp_regs[i];
-+
-+ out->lr = mcontext.gp_regs[PT_LNK];
-+ out->srr0 = mcontext.gp_regs[PT_NIP];
-+ out->srr1 = mcontext.gp_regs[PT_MSR];
-+ out->cr = mcontext.gp_regs[PT_CCR];
-+ out->xer = mcontext.gp_regs[PT_XER];
-+ out->ctr = mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] = \
-+ {(((uint64_t)vregs.vrregs[i][0]) << 32)
-+ | vregs.vrregs[i][1],
-+ (((uint64_t)vregs.vrregs[i][2]) << 32)
-+ | vregs.vrregs[i][3]};
-+
-+ out->vrsave = vregs.vrsave;
-+ out->vector_save.save_vscr = {0, vregs.vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+#endif // __powerpc64__
-
- void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- assert(gp_regs || size);
-@@ -279,6 +314,11 @@ void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- *gp_regs = mcontext.gregs;
- if (size)
- *size = sizeof(mcontext.gregs);
-+#elif defined(__powerpc64__)
-+ if (gp_regs)
-+ *gp_regs = mcontext.gp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.gp_regs);
- #else
- if (gp_regs)
- *gp_regs = ®s;
-@@ -294,6 +334,11 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- *fp_regs = &mcontext.fpregs;
- if (size)
- *size = sizeof(mcontext.fpregs);
-+#elif defined(__powerpc64__)
-+ if (fp_regs)
-+ *fp_regs = &mcontext.fp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.fp_regs);
- #else
- if (fp_regs)
- *fp_regs = &fpregs;
-@@ -302,4 +347,13 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- #endif
- }
-
-+#if defined(__powerpc64__)
-+void ThreadInfo::GetVectorRegisters(void** v_regs, size_t* size) {
-+ if (v_regs)
-+ *v_regs = &vregs;
-+ if (size)
-+ *size = sizeof(vregs);
-+}
-+#endif
-+
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-index fb216fa6d..593aac822 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-@@ -68,6 +68,10 @@ struct ThreadInfo {
- // Use the structures defined in <sys/user.h>
- struct user_regs_struct regs;
- struct user_fpsimd_struct fpregs;
-+#elif defined(__powerpc64__)
-+ // Use the structures defined in <sys/ucontext.h>.
-+ mcontext_t mcontext;
-+ vrregset_t vregs;
- #elif defined(__mips__)
- // Use the structure defined in <sys/ucontext.h>.
- mcontext_t mcontext;
-@@ -84,6 +88,11 @@ struct ThreadInfo {
-
- // Returns the pointer and size of float point register area.
- void GetFloatingPointRegisters(void** fp_regs, size_t* size);
-+
-+#if defined(__powerpc64__)
-+ // Returns the pointer and size of the vector register area. (PPC64 only)
-+ void GetVectorRegisters(void** v_regs, size_t* size);
-+#endif
- };
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 6eec1be24..741983a1a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -254,6 +254,48 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc) {
- out->float_save.fir = uc->uc_mcontext.fpc_eir; // Unused.
- #endif
- }
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
-+}
-+
-+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[PT_NIP];
-+}
-+
-+void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
-+ const vrregset_t* vregs) {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = uc->uc_mcontext.gp_regs[i];
-+
-+ out->lr = uc->uc_mcontext.gp_regs[PT_LNK];
-+ out->srr0 = uc->uc_mcontext.gp_regs[PT_NIP];
-+ out->srr1 = uc->uc_mcontext.gp_regs[PT_MSR];
-+ out->cr = uc->uc_mcontext.gp_regs[PT_CCR];
-+ out->xer = uc->uc_mcontext.gp_regs[PT_XER];
-+ out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] =
-+ {(((uint64_t)vregs->vrregs[i][0]) << 32)
-+ | vregs->vrregs[i][1],
-+ (((uint64_t)vregs->vrregs[i][2]) << 32)
-+ | vregs->vrregs[i][3]};
-+
-+ out->vrsave = vregs->vrsave;
-+ out->vector_save.save_vscr = {0, vregs->vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+
- #endif
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-index 7d4100881..c122ac92e 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-@@ -55,6 +55,9 @@ struct UContextReader {
- #elif defined(__aarch64__)
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- const struct fpsimd_context* fpregs);
-+#elif defined(__powerpc64__)
-+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
-+ const vrregset_t* vregs);
- #else
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc);
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index a6cb5f984..ae16b64d9 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -461,9 +461,16 @@ bool ExceptionHandler::HandleSignal(int /*sig*/, siginfo_t* info, void* uc) {
- memcpy(&g_crash_context_.float_state, fp_ptr,
- sizeof(g_crash_context_.float_state));
- }
-+#elif defined(__powerpc64__)
-+ // On PPC64, we must copy VR state
-+ ucontext_t* uc_ptr = (ucontext_t*)uc;
-+ if (uc_ptr->uc_mcontext.v_regs) {
-+ memcpy(&g_crash_context_.vector_state, uc_ptr->uc_mcontext.v_regs,
-+ sizeof(g_crash_context_.vector_state));
-+ }
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- // FP state is not part of user ABI on ARM Linux.
-- // In case of MIPS Linux FP state is already part of ucontext_t
-+ // In case of MIPS, Linux FP state is already part of ucontext_t
- // and 'float_state' is not a member of CrashContext.
- ucontext_t* uc_ptr = (ucontext_t*)uc;
- if (uc_ptr->uc_mcontext.fpregs) {
-@@ -708,11 +715,19 @@ bool ExceptionHandler::WriteMinidump() {
- }
- #endif
-
--#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__)
-+#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__) \
-+ && !defined(__powerpc64__)
- // FPU state is not part of ARM EABI ucontext_t.
- memcpy(&context.float_state, context.context.uc_mcontext.fpregs,
- sizeof(context.float_state));
- #endif
-+
-+#if defined(__powerpc64__)
-+ // Vector registers must be copied on PPC64
-+ memcpy(&context.vector_state, context.context.uc_mcontext.v_regs,
-+ sizeof(context.vector_state));
-+#endif
-+
- context.tid = sys_gettid();
-
- // Add an exception stream to the minidump for better reporting.
-@@ -733,6 +748,9 @@ bool ExceptionHandler::WriteMinidump() {
- #elif defined(__mips__)
- context.siginfo.si_addr =
- reinterpret_cast<void*>(context.context.uc_mcontext.pc);
-+#elif defined(__powerpc64__)
-+ context.siginfo.si_addr =
-+ reinterpret_cast<void*>(context.context.uc_mcontext.gp_regs[PT_NIP]);
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-index f80843ea7..260dd10f7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-@@ -192,7 +192,11 @@ class ExceptionHandler {
- siginfo_t siginfo;
- pid_t tid; // the crashing thread.
- ucontext_t context;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ // PPC64's FP state is a part of ucontext_t like MIPS but the vector
-+ // state is not, so a struct is needed.
-+ vstate_t vector_state;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- // #ifdef this out because FP state is not part of user ABI for Linux ARM.
- // In case of MIPS Linux FP state is already part of ucontext_t so
- // 'float_state' is not required.
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-index 35dcbfd4d..7934370fd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-@@ -307,7 +307,7 @@ TEST(ExceptionHandlerTest, ParallelChildCrashesDontHang) {
- }
-
- // Wait a while until the child should have crashed.
-- usleep(1000000);
-+ usleep(2000000);
- // Kill the child if it is still running.
- kill(child, SIGKILL);
-
-@@ -559,6 +559,8 @@ const unsigned char kIllegalInstruction[] = {
- #if defined(__mips__)
- // mfc2 zero,Impl - usually illegal in userspace.
- 0x48, 0x00, 0x00, 0x48
-+#elif defined(__powerpc64__)
-+ 0x01, 0x01, 0x01, 0x01 // Crashes on a tested POWER9 cpu
- #else
- // This crashes with SIGILL on x86/x86-64/arm.
- 0xff, 0xff, 0xff, 0xff
-@@ -754,10 +756,10 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
-
- // These are defined here so the parent can use them to check the
- // data from the minidump afterwards.
-- // Use 4k here because the OS will hand out a single page even
-+ // Use the page size here because the OS will hand out a single page even
- // if a smaller size is requested, and this test wants to
- // test the upper bound of the memory range.
-- const uint32_t kMemorySize = 4096; // bytes
-+ const uint32_t kMemorySize = getpagesize(); // bytes
- const int kOffset = kMemorySize - sizeof(kIllegalInstruction);
-
- const pid_t child = fork();
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-index fa3c1713a..6ce709e2f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-@@ -138,7 +138,9 @@ class MicrodumpWriter {
- const MicrodumpExtraInfo& microdump_extra_info,
- LinuxDumper* dumper)
- : ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -337,6 +339,8 @@ class MicrodumpWriter {
- # else
- # error "This mips ABI is currently not supported (n32)"
- #endif
-+#elif defined(__powerpc64__)
-+ const char kArch[] = "ppc64";
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -409,7 +413,9 @@ class MicrodumpWriter {
- void DumpCPUState() {
- RawContextCPU cpu;
- my_memset(&cpu, 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(&cpu, ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(&cpu, ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(&cpu, ucontext_);
-@@ -605,7 +611,9 @@ class MicrodumpWriter {
- void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); }
-
- const ucontext_t* const ucontext_;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_;
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-index 6339ac0cd..291af106b 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-@@ -279,10 +279,19 @@ TEST(MicrodumpWriterTest, BasicWithMappings) {
- CrashAndGetMicrodump(mappings, MicrodumpExtraInfo(), &buf);
- ASSERT_TRUE(ContainsMicrodump(buf));
-
-+ int page_size = getpagesize();
- #ifdef __LP64__
-- ASSERT_NE(std::string::npos,
-- buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-- "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ // This test is only available for the following page sizes
-+ ASSERT_TRUE((page_size == 4096) || (page_size == 65536));
-+ if (page_size == 4096) {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ } else {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000010000 000000000000002A 0000000000010000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ }
- #else
- ASSERT_NE(std::string::npos,
- buf.find("M 00001000 0000002A 00001000 "
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-index 415068983..b93e4afcf 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-@@ -112,6 +112,9 @@ bool LinuxCoreDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-@@ -197,7 +200,10 @@ bool LinuxCoreDumper::EnumerateThreads() {
- memset(&info, 0, sizeof(ThreadInfo));
- info.tgid = status->pr_pgrp;
- info.ppid = status->pr_ppid;
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ for (int i = 0; i < 31; i++)
-+ info.mcontext.gp_regs[i] = status->pr_reg[i];
-+#elif defined(__mips__)
- #if defined(__ANDROID__)
- for (int i = EF_R0; i <= EF_R31; i++)
- info.mcontext.gregs[i - EF_R0] = status->pr_reg[i];
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-index 7fd6532ad..199cbfffd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-@@ -765,7 +765,9 @@ bool LinuxDumper::GetStackInfo(const void** stack, size_t* stack_len,
- reinterpret_cast<uint8_t*>(int_stack_pointer & ~(page_size - 1));
-
- // The number of bytes of stack which we try to capture.
-- static const ptrdiff_t kStackToCapture = 32 * 1024;
-+ // This now depends on page_size to avoid missing data
-+ // on systems with larger page sizes.
-+ static const ptrdiff_t kStackToCapture = 8 * page_size;
-
- const MappingInfo* mapping = FindMapping(stack_pointer);
- if (!mapping)
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-index 7bee160f1..07bb2b81a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-@@ -63,7 +63,8 @@ namespace google_breakpad {
- (defined(__mips__) && _MIPS_SIM == _ABIO32)
- typedef Elf32_auxv_t elf_aux_entry;
- #elif defined(__x86_64) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM != _ABIO32)
-+ (defined(__mips__) && _MIPS_SIM != _ABIO32) || \
-+ defined(__powerpc64__)
- typedef Elf64_auxv_t elf_aux_entry;
- #endif
-
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-index 331f4bb34..3f722947f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-@@ -51,6 +51,8 @@
- #define TID_PTR_REGISTER "rcx"
- #elif defined(__mips__)
- #define TID_PTR_REGISTER "$1"
-+#elif defined(__powerpc64__)
-+#define TID_PTR_REGISTER "r8"
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-index e3ddb81a6..fa28575ef 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-@@ -149,19 +149,27 @@ bool LinuxPtraceDumper::CopyFromProcess(void* dest, pid_t child,
- return true;
- }
-
--bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid)
--{
-+bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid) {
- #ifdef PTRACE_GETREGSET
- struct iovec io;
- info->GetGeneralPurposeRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
- return false;
- }
-
- info->GetFloatingPointRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
- return false;
- }
-+
-+#if defined(__powerpc64__)
-+ // Grab the vector registers on PPC64 too
-+ info->GetVectorRegisters(&io.iov_base, &io.iov_len);
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PPC_VMX, (void*)&io) == -1) {
-+ return false;
-+ }
-+#endif // defined(__powerpc64__)
-+
- return true;
- #else
- return false;
-@@ -298,6 +306,9 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-index da71e15dc..12bfb317a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-@@ -462,6 +462,9 @@ TEST(LinuxPtraceDumperTest, VerifyStackReadWithMultipleThreads) {
- #elif defined(__mips__)
- pid_t* process_tid_location =
- reinterpret_cast<pid_t*>(one_thread.mcontext.gregs[1]);
-+#elif defined(__powerpc64__)
-+ pid_t* process_tid_location =
-+ reinterpret_cast<pid_t*>(one_thread.mcontext.gp_regs[8]);
- #else
- #error This test has not been ported to this platform.
- #endif
-@@ -559,6 +562,8 @@ TEST_F(LinuxPtraceDumperTest, SanitizeStackCopy) {
- uintptr_t heap_addr = thread_info.regs.rcx;
- #elif defined(__mips__)
- uintptr_t heap_addr = thread_info.mcontext.gregs[1];
-+#elif defined(__powerpc64__)
-+ uintptr_t heap_addr = thread_info.mcontext.gp_regs[8];
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-index 32634ef00..2a56948de 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-@@ -136,7 +136,9 @@ class MinidumpWriter {
- : fd_(minidump_fd),
- path_(minidump_path),
- ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -468,7 +470,9 @@ class MinidumpWriter {
- if (!cpu.Allocate())
- return false;
- my_memset(cpu.get(), 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(cpu.get(), ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(cpu.get(), ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(cpu.get(), ucontext_);
-@@ -897,7 +901,7 @@ class MinidumpWriter {
- dirent->location.rva = 0;
- }
-
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || defined(__powerpc64__)
- bool WriteCPUInformation(MDRawSystemInfo* sys_info) {
- char vendor_id[sizeof(sys_info->cpu.x86_cpu_info.vendor_id) + 1] = {0};
- static const char vendor_id_name[] = "vendor_id";
-@@ -917,7 +921,9 @@ class MinidumpWriter {
-
- // processor_architecture should always be set, do this first
- sys_info->processor_architecture =
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ MD_CPU_ARCHITECTURE_PPC64;
-+#elif defined(__mips__)
- # if _MIPS_SIM == _ABIO32
- MD_CPU_ARCHITECTURE_MIPS;
- # elif _MIPS_SIM == _ABI64
-@@ -1333,7 +1339,9 @@ class MinidumpWriter {
- const char* path_; // Path to the file where the minidum should be written.
-
- const ucontext_t* const ucontext_; // also from the signal handler
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_; // ditto
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-index e3b0b16da..ccd8aa0a4 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-@@ -48,6 +48,8 @@ class ExceptionHandler;
-
- #if defined(__aarch64__)
- typedef struct fpsimd_context fpstate_t;
-+#elif defined(__powerpc64__)
-+typedef vrregset_t vstate_t;
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- typedef std::remove_pointer<fpregset_t>::type fpstate_t;
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-index d192e5cbb..fc1bfa8d7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-@@ -715,6 +715,9 @@ TEST(MinidumpWriterTest, InvalidStackPointer) {
- #elif defined(__mips__)
- context.context.uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP] =
- invalid_stack_pointer;
-+#elif defined(__powerpc64__)
-+ context.context.uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP] =
-+ invalid_stack_pointer;
- #else
- # error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-index 99362945c..c54ba7145 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-@@ -65,8 +65,7 @@ bool MemoryMappedFile::Map(const char* path, size_t offset) {
- }
-
- #if defined(__x86_64__) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM == _ABI64)
--
-+ (defined(__mips__) && _MIPS_SIM == _ABI64) || defined(__powerpc64__)
- struct kernel_stat st;
- if (sys_fstat(fd, &st) == -1 || st.st_size < 0) {
- #else
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-index fad59f40c..616496d67 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-@@ -176,9 +176,10 @@ TEST_F(MemoryMappedFileTest, RemapAfterMap) {
- TEST_F(MemoryMappedFileTest, MapWithOffset) {
- // Put more data in the test file this time. Offsets can only be
- // done on page boundaries, so we need a two page file to test this.
-- const int page_size = 4096;
-- char data1[2 * page_size];
-- size_t data1_size = sizeof(data1);
-+ const int page_size = getpagesize();
-+ char *data1 = static_cast<char*>(malloc(2 * page_size));
-+ EXPECT_TRUE(data1 != NULL);
-+ size_t data1_size = (2 * page_size);
- for (size_t i = 0; i < data1_size; ++i) {
- data1[i] = i & 0x7f;
- }
-diff --git a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-index 5803b90d5..2a1cf14f0 100644
---- a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-@@ -57,8 +57,9 @@ TEST(PageAllocatorTest, LargeObject) {
-
- EXPECT_EQ(0U, allocator.pages_allocated());
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(10000));
-+ uint64_t expected_pages = 1 + ((10000 - 1) / getpagesize());
- ASSERT_FALSE(p == NULL);
-- EXPECT_EQ(3U, allocator.pages_allocated());
-+ EXPECT_EQ(expected_pages, allocator.pages_allocated());
- for (unsigned i = 1; i < 10; ++i) {
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(i));
- ASSERT_FALSE(p == NULL);
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-index 798056dfa..22bd81fff 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-@@ -202,12 +202,14 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) {
- // Check architecture and set architecture variable to corresponding flag
- // in objdump.
- switch (context->GetContextCPU()) {
-+#if defined(__i386) || defined(__x86_64)
- case MD_CONTEXT_X86:
- architecture = "i386";
- break;
- case MD_CONTEXT_AMD64:
- architecture = "i386:x86-64";
- break;
-+#endif
- default:
- // Unsupported architecture. Note that ARM architectures are not
- // supported because objdump does not support ARM.
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-index 528ee5f21..72764d6c1 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-@@ -104,6 +104,8 @@ ExploitabilityFor(const string& filename) {
- }
-
- TEST(ExploitabilityTest, TestWindowsEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("ascii_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -136,9 +138,12 @@ TEST(ExploitabilityTest, TestWindowsEngine) {
- ExploitabilityFor("read_av_clobber_write.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_LOW,
- ExploitabilityFor("read_av_conditional.dmp"));
-+#endif
- }
-
- TEST(ExploitabilityTest, TestLinuxEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if defined(__i386) || defined(__x86_64)
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_null_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -171,7 +176,8 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_executable_heap.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_jmp_to_module_not_exe_region.dmp"));
--#ifndef _WIN32
-+#endif
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_write_to_nonwritable_module.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -182,10 +188,10 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_write_to_outside_module_via_math.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_write_to_under_4k.dmp"));
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (!defined(__i386) && !defined(__x86_64))
- }
-
--#ifndef _WIN32
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- TEST(ExploitabilityLinuxUtilsTest, DisassembleBytesTest) {
- ASSERT_FALSE(ExploitabilityLinuxTest::DisassembleBytes("", NULL, 5, NULL));
- uint8_t bytes[6] = {0xc7, 0x0, 0x5, 0x0, 0x0, 0x0};
-@@ -301,6 +307,7 @@ TEST(ExploitabilityLinuxUtilsTest, CalculateAddressTest) {
- context,
- &write_address));
- }
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
-+
-
- } // namespace
-diff --git a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-index aade82c99..195aa73f3 100644
---- a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-+++ b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-@@ -77,6 +77,8 @@
- #define ELF_ARCH EM_MIPS
- #elif defined(__aarch64__)
- #define ELF_ARCH EM_AARCH64
-+#elif defined(__powerpc64__)
-+ #define ELF_ARCH EM_PPC64
- #endif
-
- #if defined(__arm__)
-@@ -87,6 +89,8 @@ typedef user_regs user_regs_struct;
- #elif defined (__mips__)
- // This file-local typedef simplifies the source code.
- typedef gregset_t user_regs_struct;
-+#elif defined(__powerpc64__)
-+typedef struct pt_regs user_regs_struct;
- #endif
-
- using google_breakpad::MDTypeHelper;
-@@ -321,6 +325,9 @@ struct CrashedProcess {
- #endif
- #if defined(__aarch64__)
- user_fpsimd_struct fpregs;
-+#endif
-+#if defined(__powerpc64__)
-+ mcontext_t mcontext;
- #endif
- uintptr_t stack_addr;
- const uint8_t* stack;
-@@ -535,6 +542,38 @@ ParseThreadRegisters(CrashedProcess::Thread* thread,
- thread->mcontext.fpc_eir = rawregs->float_save.fir;
- #endif
- }
-+#elif defined(__powerpc64__)
-+static void
-+ParseThreadRegisters(CrashedProcess::Thread* thread,
-+ const MinidumpMemoryRange& range) {
-+ const MDRawContextPPC64* rawregs = range.GetData<MDRawContextPPC64>(0);
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ thread->mcontext.gp_regs[i] = rawregs->gpr[i];
-+
-+ thread->mcontext.gp_regs[PT_LNK] = rawregs->lr;
-+ thread->mcontext.gp_regs[PT_NIP] = rawregs->srr0;
-+ thread->mcontext.gp_regs[PT_MSR] = rawregs->srr1;
-+ thread->mcontext.gp_regs[PT_CCR] = rawregs->cr;
-+ thread->mcontext.gp_regs[PT_XER] = rawregs->xer;
-+ thread->mcontext.gp_regs[PT_CTR] = rawregs->ctr;
-+ thread->mcontext.v_regs->vrsave = rawregs->vrsave;
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ thread->mcontext.fp_regs[i] = rawregs->float_save.fpregs[i];
-+
-+ thread->mcontext.fp_regs[NFPREG-1] = rawregs->float_save.fpscr;
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++) {
-+ thread->mcontext.v_regs->vrregs[i][0] = rawregs->vector_save.save_vr[i].high >> 32;
-+ thread->mcontext.v_regs->vrregs[i][1] = rawregs->vector_save.save_vr[i].high;
-+ thread->mcontext.v_regs->vrregs[i][2] = rawregs->vector_save.save_vr[i].low >> 32;
-+ thread->mcontext.v_regs->vrregs[i][3] = rawregs->vector_save.save_vr[i].low;
-+ }
-+
-+ thread->mcontext.v_regs->vscr.vscr_word = rawregs->vector_save.save_vscr.low & 0xFFFFFFFF;
-+}
-+
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -623,6 +662,12 @@ ParseSystemInfo(const Options& options, CrashedProcess* crashinfo,
- # else
- # error "This mips ABI is currently not supported (n32)"
- # endif
-+#elif defined(__powerpc64__)
-+ if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_PPC64) {
-+ fprintf(stderr,
-+ "This version of minidump-2-core only supports PPC64.\n");
-+ exit(1);
-+ }
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-diff --git a/third_party/crashpad/crashpad/CONTRIBUTORS b/third_party/crashpad/crashpad/CONTRIBUTORS
-index 8724b7f32..8e29424ef 100644
---- a/third_party/crashpad/crashpad/CONTRIBUTORS
-+++ b/third_party/crashpad/crashpad/CONTRIBUTORS
-@@ -13,3 +13,4 @@ Mark Mentovai <mark@chromium.org>
- Robert Sesek <rsesek@chromium.org>
- Scott Graham <scottmg@chromium.org>
- Joshua Peraza <jperaza@chromium.org>
-+Shawn Anastasio <shawn@anastas.io>
-diff --git a/third_party/crashpad/crashpad/compat/linux/sys/user.h b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-index 6ed77a98e..1fd83469a 100644
---- a/third_party/crashpad/crashpad/compat/linux/sys/user.h
-+++ b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_COMPAT_LINUX_SYS_USER_H_
- #define CRASHPAD_COMPAT_LINUX_SYS_USER_H_
-
-+#include <cstddef>
- #include_next <sys/user.h>
-
- #include <features.h>
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context.h b/third_party/crashpad/crashpad/minidump/minidump_context.h
-index 3a3e603cb..3118d9e9f 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context.h
-@@ -592,6 +592,70 @@ struct MinidumpContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief ppc64-specific flags for MinidumpPPC64::context_flags
-+//! Based on minidump_cpu_ppc64.h from breakpad
-+enum MinidumpContextPPC64Flags : uint32_t {
-+ //! \brief Identifies the context as PPC64.
-+ kMinidumpContextPPC64 = 0x01000000,
-+
-+ //! \brief Indicates the validity of general purpose registers.
-+ //!
-+ //! Registers `r0`-`r31`, `nip`, `msr`, `lr`, etc. are valid.
-+ kMinidumpContextPPC64Base = kMinidumpContextPPC64 | 0x00000001,
-+
-+ //! \brief Indicates the validity of floating point registers.
-+ //!
-+ //! Registers `fp0`-`fp31`, `fpscr` are valid.
-+ kMinidumpContextPPC64Floating = kMinidumpContextPPC64 | 0x00000008,
-+
-+ //! \brief Indicates the validity of Altivec/VMX registers.
-+ //!
-+ //! Registers `v0`-`v31`, `vscr`, `vrsave`.
-+ kMinidumpContextPPC64Vector = kMinidumpContextPPC64 | 0x00000020,
-+
-+ //! \brief Indicates the validity of all registers
-+ kMinidumpContextPPC64All = kMinidumpContextPPC64Base |
-+ kMinidumpContextPPC64Floating |
-+ kMinidumpContextPPC64Vector
-+};
-+
-+//! \brief A PPC64 CPU context carried in a minidump file.
-+//! Based on minidump_cpu_ppc64.h from breakpad.
-+struct MinidumpContextPPC64 {
-+ uint64_t context_flags;
-+
-+ //! \brief General purpose registers.
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+
-+ //! \brief Floating point registers.
-+ double fpregs[32];
-+
-+ //! \brief FPU status register.
-+ double fpscr;
-+
-+ //! \brief Altivec/VMX vector registers.
-+ struct {
-+ //! \brief Vector registers are 128bits.
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad5[4];
-+
-+ //! \brief VRSAVE register.
-+ uint32_t save_vrsave;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad6[7];
-+ } vregs;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-index d7e53a493..d89eb9e01 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-@@ -101,6 +101,13 @@ MinidumpContextWriter::CreateFromSnapshot(const CPUContext* context_snapshot) {
- break;
- }
-
-+ case kCPUArchitecturePPC64: {
-+ context = std::make_unique<MinidumpContextPPC64Writer>();
-+ reinterpret_cast<MinidumpContextPPC64Writer*>(context.get())
-+ ->InitalizeFromSnapshot(context_snapshot->ppc64);
-+ break;
-+ }
-+
- default: {
- LOG(ERROR) << "unknown context architecture "
- << context_snapshot->architecture;
-@@ -453,4 +460,47 @@ size_t MinidumpContextMIPS64Writer::ContextSize() const {
- return sizeof(context_);
- }
-
-+MinidumpContextPPC64Writer::MinidumpContextPPC64Writer()
-+ : MinidumpContextWriter(), context_() {
-+ context_.context_flags = kMinidumpContextPPC64;
-+}
-+
-+MinidumpContextPPC64Writer::~MinidumpContextPPC64Writer() = default;
-+
-+void MinidumpContextPPC64Writer::InitalizeFromSnapshot(
-+ const CPUContextPPC64* context_snapshot) {
-+ DCHECK_EQ(state(), kStateMutable);
-+ DCHECK_EQ(context_.context_flags, kMinidumpContextPPC64);
-+
-+ context_.context_flags = kMinidumpContextPPC64All;
-+
-+ memcpy(context_.regs, context_snapshot->regs, sizeof(context_.regs));
-+ context_.nip = context_snapshot->nip;
-+ context_.msr = context_snapshot->msr;
-+ context_.ccr = context_snapshot->ccr;
-+ context_.xer = context_snapshot->xer;
-+ context_.lnk = context_snapshot->lnk;
-+ context_.ctr = context_snapshot->ctr;
-+
-+ memcpy(context_.fpregs, context_snapshot->fpregs, sizeof(context_.fpregs));
-+ context_.fpscr = context_snapshot->fpscr;
-+
-+ memcpy(context_.vregs.save_vr, context_snapshot->vregs.save_vr,
-+ sizeof(context_.vregs.save_vr));
-+ memcpy(&context_.vregs.save_vscr, &context_snapshot->vregs.save_vscr,
-+ sizeof(context_.vregs.save_vscr));
-+ context_.vregs.save_vrsave = context_snapshot->vregs.save_vrsave;
-+}
-+
-+bool MinidumpContextPPC64Writer::WriteObject(
-+ FileWriterInterface* file_writer) {
-+ DCHECK_EQ(state(), kStateWritable);
-+ return file_writer->Write(&context_, sizeof(context_));
-+}
-+
-+size_t MinidumpContextPPC64Writer::ContextSize() const {
-+ DCHECK_GE(state(), kStateFrozen);
-+ return sizeof(context_);
-+}
-+
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-index d4ab936ee..1d22fc59c 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-@@ -315,6 +315,43 @@ class MinidumpContextMIPS64Writer final : public MinidumpContextWriter {
- MinidumpContextMIPS64 context_;
- };
-
-+class MinidumpContextPPC64Writer final : public MinidumpContextWriter {
-+ public:
-+ MinidumpContextPPC64Writer();
-+ ~MinidumpContextPPC64Writer() override;
-+
-+ //! \brief Initalizes the MinidumpContextPPC64 based on \a context_snapshot.
-+ //!
-+ //! \param[in] context_snapshot The context snapshot to use as source data.
-+ //!
-+ //! \note Valid in #kStateMutable. No mutation of context() may be done before
-+ //! calling this method, and it is not normally necessary to alter
-+ //! context() after calling this method.
-+ void InitalizeFromSnapshot(const CPUContextPPC64* context_snapshot);
-+
-+ //! \brief Returns a pointer to the context structure that this object will
-+ //! write.
-+ //!
-+ //! \attention This returns a non-`const` pointer to this object’s private
-+ //! data so that a caller can populate the context structure directly.
-+ //! This is done because providing setter interfaces to each field in the
-+ //! context structure would be unwieldy and cumbersome. Care must be taken
-+ //! to populate the context structure correctly. The context structure
-+ //! must only be modified while this object is in the #kStateMutable
-+ //! state.
-+ MinidumpContextPPC64* context() { return &context_; }
-+
-+ protected:
-+ // MinidumpWritable:
-+ bool WriteObject(FileWriterInterface* file_writer) override;
-+
-+ // MinidumpContextWriter:
-+ size_t ContextSize() const override;
-+
-+ private:
-+ MinidumpContextPPC64 context_;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_WRITER_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-index 3216a906b..a9fcbe9d8 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-@@ -213,6 +213,21 @@ TEST(MinidumpContextWriter, MIPS64_FromSnapshot) {
- context, ExpectMinidumpContextMIPS64, kSeed);
- }
-
-+TEST(MinidumpContextWriter, PPC64_Zeros) {
-+ EmptyContextTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ ExpectMinidumpContextPPC64);
-+}
-+
-+TEST(MinidumpContextWriter, PPC64_FromSnapshot) {
-+ constexpr uint32_t kSeed = 64;
-+ CPUContextPPC64 context_ppc64;
-+ CPUContext context;
-+ context.ppc64 = &context_ppc64;
-+ InitializeCPUContextPPC64(&context, kSeed);
-+ FromSnapshotTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ context, ExpectMinidumpContextPPC64, kSeed);
-+}
-+
- } // namespace
- } // namespace test
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-index 0974e3ddf..b71ec5880 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-@@ -135,6 +135,8 @@ std::string MinidumpMiscInfoDebugBuildString() {
- static constexpr char kCPU[] = "mips";
- #elif defined(ARCH_CPU_MIPS64EL)
- static constexpr char kCPU[] = "mips64";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kCPU[] = "ppc64";
- #else
- #error define kCPU for this CPU
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/capture_memory.cc b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-index 7a1b2763c..beda8da9e 100644
---- a/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-+++ b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-@@ -112,6 +112,11 @@ void CaptureMemory::PointedToByContext(const CPUContext& context,
- for (size_t i = 0; i < std::size(context.mipsel->regs); ++i) {
- MaybeCaptureMemoryAround(delegate, context.mipsel->regs[i]);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->nip);
-+ for (size_t i = 0; i < std::size(context.ppc64->regs); ++i) {
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->regs[i]);
-+ }
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-index 811a72095..f4f83981d 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-@@ -43,7 +43,10 @@ enum CPUArchitecture {
- kCPUArchitectureMIPSEL,
-
- //! \brief 64-bit MIPSEL.
-- kCPUArchitectureMIPS64EL
-+ kCPUArchitectureMIPS64EL,
-+
-+ //! \brief 64-bit PPC64.
-+ kCPUArchitecturePPC64
- };
-
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.cc b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-index c75b5555e..aeade577a 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-@@ -169,6 +169,8 @@ uint64_t CPUContext::InstructionPointer() const {
- return arm->pc;
- case kCPUArchitectureARM64:
- return arm64->pc;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->nip;
- default:
- NOTREACHED();
- return ~0ull;
-@@ -185,6 +187,8 @@ uint64_t CPUContext::StackPointer() const {
- return arm->sp;
- case kCPUArchitectureARM64:
- return arm64->sp;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->regs[1];
- default:
- NOTREACHED();
- return ~0ull;
-@@ -196,6 +200,7 @@ bool CPUContext::Is64Bit() const {
- case kCPUArchitectureX86_64:
- case kCPUArchitectureARM64:
- case kCPUArchitectureMIPS64EL:
-+ case kCPUArchitecturePPC64:
- return true;
- case kCPUArchitectureX86:
- case kCPUArchitectureARM:
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.h b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-index fb23c4679..eebede63c 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-@@ -352,6 +352,24 @@ struct CPUContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief A context structure carrying PPC64 CPU state.
-+struct CPUContextPPC64 {
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+ double fpregs[32];
-+ double fpscr;
-+ struct {
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+ uint32_t save_vrsave;
-+ } vregs;
-+};
-+
- //! \brief A context structure capable of carrying the context of any supported
- //! CPU architecture.
- struct CPUContext {
-@@ -382,6 +400,7 @@ struct CPUContext {
- CPUContextARM64* arm64;
- CPUContextMIPS* mipsel;
- CPUContextMIPS64* mips64;
-+ CPUContextPPC64* ppc64;
- };
- };
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-index 9f46a4897..aa677c4eb 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
- #define CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
-
-+#include <cstring>
- #include "build/build_config.h"
- #include "snapshot/cpu_context.h"
- #include "snapshot/linux/signal_context.h"
-@@ -174,6 +175,78 @@ void InitializeCPUContextMIPS(
-
- #endif // ARCH_CPU_MIPS_FAMILY || DOXYGEN
-
-+#if defined(ARCH_CPU_PPC64_FAMILY) || DOXYGEN
-+
-+//! \brief Initalizes a CPUContextPPC64 structure from native context
-+//! structures on Linux.
-+//!
-+//! \param[in] thread_context The native thread context.
-+//! \param[in] float_context The native float context.
-+//! \param[in] vector_context The native vector context.
-+//! \param[out] context The CPUContextPPC64 structure to initalize.
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const ThreadContext::t64_t& thread_context,
-+ const FloatContext::f64_t& float_context,
-+ const VectorContext::v64_t& vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.gpr, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.fpregs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const SignalThreadContext64 &thread_context,
-+ const SignalFloatContext64 &float_context,
-+ const SignalVectorContext64 &vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.regs, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.regs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+
-+#endif
-+
- } // namespace internal
- } // namespace crashpad
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-index d32bd1937..2dd538c2b 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-@@ -192,6 +192,8 @@ void TestAgainstTarget(PtraceConnection* connection) {
- device == 0 && inode == 0 && mapping_name == "[vdso]";
- #if defined(ARCH_CPU_X86)
- static constexpr char kPrefix[] = "linux-gate.so.";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kPrefix[] = "linux-vdso64.so.";
- #else
- static constexpr char kPrefix[] = "linux-vdso.so.";
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-index cd40b3b12..6bcf23b6f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-@@ -323,6 +323,69 @@ bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
- reader, context_address, context_.mips64);
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+template <typename Traits>
-+static bool ReadContext(ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address,
-+ typename Traits::CPUContext* dest_context) {
-+ const ProcessMemory* memory = reader->Memory();
-+
-+ LinuxVMAddress gp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, gp_regs);
-+
-+ typename Traits::SignalThreadContext thread_context;
-+ if (!memory->Read(gp_regs_address, sizeof(thread_context), &thread_context)) {
-+ LOG(ERROR) << "Couldn't read gp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress fp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, fp_regs);
-+
-+ typename Traits::SignalFloatContext fp_context;
-+ if (!memory->Read(fp_regs_address, sizeof(fp_context), &fp_context)) {
-+ LOG(ERROR) << "Couldn't read fp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress v_regs_ptr_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, vmx_reserve) + 8;
-+
-+ typename Traits::SignalVectorContext v_context;
-+ if (!memory->Read(v_regs_ptr_address, sizeof(v_context), &v_context)) {
-+ LOG(ERROR) << "Couldn't read v_regs!";
-+ return false;
-+ }
-+
-+ InitializeCPUContextPPC64<ContextTraits64>(thread_context, fp_context,
-+ v_context, dest_context);
-+
-+ return true;
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+
-+ return internal::ReadContext<ContextTraits64>(
-+ reader, context_address, context_.ppc64);
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits32>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ // PPC64 is 64-bit
-+ return false;
-+}
-+
- #endif // ARCH_CPU_X86_FAMILY
-
- bool ExceptionSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-index ea0cd2106..e42df520f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-@@ -84,6 +84,8 @@ class ExceptionSnapshotLinux final : public ExceptionSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #endif
- } context_union_;
- CPUContext context_;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-index c17170b43..b6a714cc6 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-@@ -296,7 +296,28 @@ void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
- 0);
- #undef CPU_ARCH_NAME
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+using NativeCPUContext = ucontext_t;
-+
-+void InitializeContext(NativeCPUContext* context) {
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ context->uc_mcontext.gp_regs[reg] = reg;
-+ }
-+
-+ memset(&context->uc_mcontext.fp_regs, 44,
-+ sizeof(context->uc_mcontext.fp_regs));
-+}
-
-+void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
-+ EXPECT_EQ(actual.architecture, kCPUArchitecturePPC64);
-+
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ EXPECT_EQ(actual.ppc64->regs[reg], expected.uc_mcontext.gp_regs[reg]);
-+ }
-+
-+ EXPECT_EQ(memcmp(actual.ppc64->fpregs, expected.uc_mcontext.fp_regs,
-+ sizeof(actual.ppc64->fpregs)), 0);
-+}
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-index ee246e8bc..9555dce04 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-@@ -108,6 +108,8 @@ void ProcessReaderLinux::Thread::InitializeStack(ProcessReaderLinux* reader) {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- stack_pointer = reader->Is64Bit() ? thread_info.thread_context.t64.regs[29]
- : thread_info.thread_context.t32.regs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ stack_pointer = thread_info.thread_context.t64.gpr[1];
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 110024680..a1f2da259 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -422,6 +422,89 @@ static_assert(offsetof(UContext<ContextTraits64>, mcontext.fpregs) ==
- "context offset mismatch");
- #endif
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+struct SignalThreadContext64 {
-+ uint64_t regs[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_r3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
-+ uint64_t dscr;
-+ uint64_t fpr0[3];
-+};
-+
-+struct SignalFloatContext64 {
-+ double regs[32];
-+ double fpscr;
-+};
-+
-+struct SignalVectorContext64 {
-+ int32_t vrregs[32][4];
-+ struct {
-+ int32_t __pad[3];
-+ int32_t vscr_word;
-+ } vscr;
-+ int32_t vrsave;
-+ int32_t __pad[3];
-+} __attribute__((__aligned__(16)));
-+
-+
-+#pragma pack(pop)
-+struct MContext64 {
-+ uint64_t reserved[4];
-+ int32_t signal;
-+ int32_t __pad0;
-+ uint64_t handler;
-+ uint64_t oldmask;
-+ uint64_t pt_regs_ptr;
-+ SignalThreadContext64 gp_regs;
-+ SignalFloatContext64 fp_regs;
-+ SignalVectorContext64 *v_regs;
-+ int64_t vmx_reserve[69];
-+};
-+
-+struct ContextTraits64 : public Traits64 {
-+ using MContext = MContext64;
-+ using SignalThreadContext = SignalThreadContext64;
-+ using SignalFloatContext = SignalFloatContext64;
-+ using SignalVectorContext = SignalVectorContext64;
-+ using CPUContext = CPUContextPPC64;
-+};
-+
-+struct ContextTraits32 : public Traits32 {};
-+
-+struct UContext {
-+ uint64_t flags;
-+ uint64_t link;
-+ SignalStack<ContextTraits64> stack;
-+ Sigset<ContextTraits64> sigmask;
-+ MContext64 mcontext;
-+};
-+#pragma pack(push, 1)
-+
-+static_assert(sizeof(UContext) == sizeof(ucontext_t),
-+ "ucontext_t size mismatch");
-+static_assert(sizeof(MContext64) == sizeof(mcontext_t),
-+ "mcontext_t size mismatch");
-+static_assert(sizeof(SignalThreadContext64) == sizeof(gregset_t),
-+ "gregset_t size mismatch");
-+static_assert(sizeof(SignalFloatContext64) == sizeof(fpregset_t),
-+ "fpregset_t size mismatch");
-+static_assert(sizeof(SignalVectorContext64) == sizeof(vrregset_t),
-+ "vrregset_t size mismatch");
-+static_assert(offsetof(UContext, mcontext) ==
-+ offsetof(ucontext_t, uc_mcontext), "mcontext offset mismatch");
-+static_assert(offsetof(MContext64, gp_regs) ==
-+ offsetof(mcontext_t, gp_regs), "gp_regs offset mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-index a99da3e4b..03b973083 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-@@ -204,6 +204,8 @@ CPUArchitecture SystemSnapshotLinux::GetCPUArchitecture() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return process_reader_->Is64Bit() ? kCPUArchitectureMIPS64EL
- : kCPUArchitectureMIPSEL;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return kCPUArchitecturePPC64;
- #else
- #error port to your architecture
- #endif
-@@ -219,6 +221,9 @@ uint32_t SystemSnapshotLinux::CPURevision() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return 0;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return 0;
- #else
- #error port to your architecture
- #endif
-@@ -239,6 +244,9 @@ std::string SystemSnapshotLinux::CPUVendor() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return std::string();
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return std::string();
- #else
- #error port to your architecture
- #endif
-@@ -372,6 +380,9 @@ bool SystemSnapshotLinux::NXEnabled() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return false;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return false;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-index b2450c206..7ba78b2ae 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-@@ -110,6 +110,8 @@ bool WriteTestModule(const base::FilePath& module_path,
- module.ehdr.e_machine = EM_AARCH64;
- #elif defined(ARCH_CPU_MIPSEL) || defined(ARCH_CPU_MIPS64EL)
- module.ehdr.e_machine = EM_MIPS;
-+#elif defined(ARCH_CPU_PPC64)
-+ module.ehdr.e_machine = EM_PPC64;
- #endif
-
- module.ehdr.e_version = EV_CURRENT;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-index e3e2bebdd..8ef43752e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-@@ -186,6 +186,14 @@ bool ThreadSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
- thread.thread_info.float_context.f32,
- context_.mipsel);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+ InitializeCPUContextPPC64<ContextTraits64>(
-+ thread.thread_info.thread_context.t64,
-+ thread.thread_info.float_context.f64,
-+ thread.thread_info.vector_context.v64,
-+ context_.ppc64);
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-index 44cc6f6d9..d4136461e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-@@ -68,6 +68,8 @@ class ThreadSnapshotLinux final : public ThreadSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
---- a/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-+++ b/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-@@ -236,6 +236,12 @@
- #elif defined(ARCH_CPU_BIG_ENDIAN)
- static constexpr char arch[] = "aarch64_be";
- #endif
-+#elif defined(__powerpc64__)
-+#if defined(ARCH_CPU_LITTLE_ENDIAN)
-+ static constexpr char arch[] = "ppc64le";
-+#elif defined(ARCH_CPU_BIG_ENDIAN)
-+ static constexpr char arch[] = "ppc64";
-+#endif
- #else
- #error Port
- #endif
-diff --git a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-index d3d5ebdfb..3fd730cb5 100644
---- a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-+++ b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-@@ -56,6 +56,11 @@ bool AuxiliaryVector::Read(PtraceConnection* connection) {
- if (type == AT_IGNORE) {
- continue;
- }
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ if (type == AT_IGNOREPPC) {
-+ continue;
-+ }
-+#endif
- if (!MapInsertOrReplace(&values_, type, value, nullptr)) {
- LOG(ERROR) << "duplicate auxv entry";
- return false;
-diff --git a/third_party/crashpad/crashpad/util/linux/ptracer.cc b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-index 557e0d363..08ae434b8 100644
---- a/third_party/crashpad/crashpad/util/linux/ptracer.cc
-+++ b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-@@ -398,6 +398,64 @@ bool GetThreadArea64(pid_t tid,
- return true;
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+// PPC64 has had HAVE_ARCH_TRACEHOOK set since 2.6.27 (even before x86 had it).
-+// That means we can simply use PTRACE_GETREGESET.
-+
-+template <typename Destination>
-+bool GetRegisterSet(pid_t tid, int set, Destination* dest, bool can_log) {
-+ iovec iov;
-+ iov.iov_base = reinterpret_cast<void*>(dest);
-+ iov.iov_len = sizeof(*dest);
-+ if (ptrace(PTRACE_GETREGSET, tid, reinterpret_cast<void*>(set), &iov) != 0) {
-+ PLOG_IF(ERROR, can_log) << "ptrace";
-+ return false;
-+ }
-+ if (iov.iov_len != sizeof(*dest)) {
-+ LOG_IF(ERROR, can_log) << "Unexpected registers size";
-+ return false;
-+ }
-+ return true;
-+}
-+
-+bool GetVectorRegisters64(pid_t tid,
-+ VectorContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PPC_VMX, &context->v64, can_log);
-+}
-+
-+bool GetFloatingPointRegisters64(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PRFPREG, &context->f64, can_log);
-+}
-+
-+bool GetThreadArea64(pid_t tid,
-+ const ThreadContext& context,
-+ LinuxVMAddress* address,
-+ bool can_log) {
-+ // PPC64 doesn't have PTRACE_GET_THREAD_AREA since the thread pointer
-+ // is stored in GPR 13.
-+ ThreadContext::t64_t tc;
-+ if (!GetRegisterSet(tid, NT_PRSTATUS, &tc, can_log)) {
-+ LOG_IF(ERROR, can_log) << "Unable to get thread pointer!";
-+ return false;
-+ }
-+
-+ *address = tc.gpr[13];
-+
-+ return true;
-+}
-+
-+// Stubs for 32-bit functions not applicable on PPC64
-+bool GetFloatingPointRegisters32(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) { return false; }
-+bool GetThreadArea32(pid_t tid,
-+ const ThreadContext &context,
-+ LinuxVMAddress *address,
-+ bool can_log) { return false; }
-+
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -494,6 +552,9 @@ bool Ptracer::GetThreadInfo(pid_t tid, ThreadInfo* info) {
- if (is_64_bit_) {
- return GetGeneralPurposeRegisters64(tid, &info->thread_context, can_log_) &&
- GetFloatingPointRegisters64(tid, &info->float_context, can_log_) &&
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ GetVectorRegisters64(tid, &info->vector_context, can_log_) &&
-+#endif
- GetThreadArea64(tid,
- info->thread_context,
- &info->thread_specific_data_address,
-diff --git a/third_party/crashpad/crashpad/util/linux/thread_info.h b/third_party/crashpad/crashpad/util/linux/thread_info.h
-index 5b55c24a7..dea0d1f39 100644
---- a/third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ b/third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -28,6 +28,10 @@
- #include <android/api-level.h>
- #endif
-
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+#include <sys/ucontext.h>
-+#endif
-+
- namespace crashpad {
-
- //! \brief The set of general purpose registers for an architecture family.
-@@ -79,6 +83,8 @@ union ThreadContext {
- uint32_t cp0_status;
- uint32_t cp0_cause;
- uint32_t padding1_;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // PPC64 is 64-bit
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -132,6 +138,21 @@ union ThreadContext {
- uint64_t cp0_badvaddr;
- uint64_t cp0_status;
- uint64_t cp0_cause;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects struct pt_regs in asm/ptrace.h.
-+ uint64_t gpr[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_gpr3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -143,6 +164,8 @@ union ThreadContext {
- using NativeThreadContext = user_regs;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate NativeThreadsContext type available for MIPS
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ using NativeThreadContext = struct pt_regs;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY || ARCH_CPU_ARM64
-@@ -218,6 +241,9 @@ union FloatContext {
- } fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Crashpad's PPC support is 64-bit only, so this
-+ // 32bit-only struct is declared as empty.
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -252,6 +278,10 @@ union FloatContext {
- double fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects fpregset_t in sys/ucontext.h
-+ double fpregs[32];
-+ double fpscr;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -280,6 +310,8 @@ union FloatContext {
- static_assert(sizeof(f64) == sizeof(user_fpsimd_struct), "Size mismatch");
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate floating point context native type for available MIPS.
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ static_assert(sizeof(f64) == sizeof(fpregset_t), "Size mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86
-@@ -287,6 +319,26 @@ union FloatContext {
- static_assert(std::is_standard_layout<FloatContext>::value,
- "Not standard layout");
-
-+//! \brief The vector registers used for an architecture family
-+union VectorContext {
-+ struct v32_t {} v32;
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ __attribute__((__aligned__(16))) // Vector context must be doubleword aligned.
-+#endif
-+ struct v64_t {
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects vrregset_t in sys/ucontext.h
-+ uint32_t vrregs[32][4];
-+ struct {
-+ uint32_t __pad[3];
-+ uint32_t vscr_word;
-+ } vscr;
-+ uint32_t vrsave;
-+ uint32_t __pad[3];
-+#endif
-+ } v64;
-+};
-+
- //! \brief A collection of `ptrace`-able information about a thread.
- struct ThreadInfo {
- ThreadInfo();
-@@ -298,6 +350,9 @@ struct ThreadInfo {
- //! \brief The floating point registers for the thread.
- FloatContext float_context;
-
-+ //! \brief (Optional) The vector registers used for the thread.
-+ VectorContext vector_context;
-+
- //! \brief The thread-local storage address for the thread.
- LinuxVMAddress thread_specific_data_address;
- };
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context.h b/third_party/crashpad/crashpad/util/misc/capture_context.h
-index d21a24f19..acc325349 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context.h
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context.h
-@@ -69,6 +69,7 @@ using NativeCPUContext = ucontext_t;
- //! macOS/Linux/Fuchsia | x86_64 | `%%rdi`
- //! Linux | ARM/ARM64 | `r0`/`x0`
- //! Linux | MIPS/MIPS64 | `$a0`
-+//! Linux | PPC64 | `r3`
- //!
- //! Additionally, the value `LR` on ARM/ARM64 will be the return address of
- //! this function.
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-index 52215ee5d..b3e4a3ec7 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-@@ -32,7 +32,7 @@
- .balign 4, 0x0
- .type CAPTURECONTEXT_SYMBOL, %function
- .type CAPTURECONTEXT_SYMBOL2, %function
--#elif defined(__mips__)
-+#elif defined(__mips__) || defined(__powerpc64__)
- .balign 4, 0x0
- #endif
-
-@@ -423,4 +423,214 @@ CAPTURECONTEXT_SYMBOL2:
- jr $ra
-
- .set at
-+#elif defined(__powerpc64__)
-+ // Store r0-r31
-+ std 0, 0xe8(3) // context->uc_mcontext.gp_regs[0]
-+ std 1, 0xf0(3) // context->uc_mcontext.gp_regs[1]
-+ std 2, 0xf8(3) // context->uc_mcontext.gp_regs[2]
-+ // note that r3's original value was lost
-+ std 3, 0x100(3) // context->uc_mcontext.gp_regs[3]
-+ std 4, 0x108(3) // context->uc_mcontext.gp_regs[4]
-+ std 5, 0x110(3) // context->uc_mcontext.gp_regs[5]
-+ std 6, 0x118(3) // context->uc_mcontext.gp_regs[6]
-+ std 7, 0x120(3) // context->uc_mcontext.gp_regs[7]
-+ std 8, 0x128(3) // context->uc_mcontext.gp_regs[8]
-+ std 9, 0x130(3) // context->uc_mcontext.gp_regs[9]
-+ std 10, 0x138(3) // context->uc_mcontext.gp_regs[10]
-+ std 11, 0x140(3) // context->uc_mcontext.gp_regs[11]
-+ std 12, 0x148(3) // context->uc_mcontext.gp_regs[12]
-+ std 13, 0x150(3) // context->uc_mcontext.gp_regs[13]
-+ std 14, 0x158(3) // context->uc_mcontext.gp_regs[14]
-+ std 15, 0x160(3) // context->uc_mcontext.gp_regs[15]
-+ std 16, 0x168(3) // context->uc_mcontext.gp_regs[16]
-+ std 17, 0x170(3) // context->uc_mcontext.gp_regs[17]
-+ std 18, 0x178(3) // context->uc_mcontext.gp_regs[18]
-+ std 19, 0x180(3) // context->uc_mcontext.gp_regs[19]
-+ std 20, 0x188(3) // context->uc_mcontext.gp_regs[20]
-+ std 21, 0x190(3) // context->uc_mcontext.gp_regs[21]
-+ std 22, 0x198(3) // context->uc_mcontext.gp_regs[22]
-+ std 23, 0x1a0(3) // context->uc_mcontext.gp_regs[23]
-+ std 24, 0x1a8(3) // context->uc_mcontext.gp_regs[24]
-+ std 25, 0x1b0(3) // context->uc_mcontext.gp_regs[25]
-+ std 26, 0x1b8(3) // context->uc_mcontext.gp_regs[26]
-+ std 27, 0x1c0(3) // context->uc_mcontext.gp_regs[27]
-+ std 28, 0x1c8(3) // context->uc_mcontext.gp_regs[28]
-+ std 29, 0x1d0(3) // context->uc_mcontext.gp_regs[29]
-+ std 30, 0x1d8(3) // context->uc_mcontext.gp_regs[30]
-+ std 31, 0x1e0(3) // context->uc_mcontext.gp_regs[31]
-+
-+ // For NIP, we can use the value in the link register
-+ mflr 0
-+ std 0, 0x1e8(3) // context->uc_mcontext.gp_regs[PT_NIP]
-+
-+ // CTR
-+ mfctr 0
-+ std 0, 0x200(3) // context->uc_mcontext.gp_regs[PT_CTR]
-+
-+ // For LNK, we'll use the caller's LR save area (2 stack frames up).
-+ // r4 can be used as a scratch register since it has already been saved.
-+ ld 4, 0(1)
-+ ld 4, 16(4)
-+ std 4, 0x208(3) // context->uc_mcontext.gp_regs[PT_LNK]
-+
-+ // XER
-+ mfxer 0
-+ std 0, 0x210(3) // context->uc_mcontext.gp_regs[PT_XER]
-+
-+ // CCR
-+ mfcr 0
-+ std 0, 0x218(3) // context->uc_mcontext.gp_regs[PT_CCR]
-+
-+ // MSR, orig_r3, MQ, TRAP, DAR, DSISR, RESULT, DSCR,
-+ // not used or not relevant, zero them out.
-+ li 4, 0
-+ std 4, 0x1f0(3) // context->uc_mcontext.gp_regs[PT_MSR]
-+ std 4, 0x1f8(3) // context->uc_mcontext.gp_regs[PT_ORIG_R3]
-+ std 4, 0x220(3) // context->uc_mcontext.gp_regs[PT_MQ]
-+ std 4, 0x228(3) // context->uc_mcontext.gp_regs[PT_TRAP]
-+ std 4, 0x230(3) // context->uc_mcontext.gp_regs[PT_DAR]
-+ std 4, 0x238(3) // context->uc_mcontext.gp_regs[PT_DSISR]
-+ std 4, 0x240(3) // context->uc_mcontext.gp_regs[PT_RESULT]
-+ std 4, 0x248(3) // context->uc_mcontext.gp_regs[PT_DSCR]
-+
-+ // Update context->uc_mcontext.regs to point to gp_regs
-+ addi 0, 3, 0xe8
-+ std 0, 0xe0(3)
-+
-+ // Save floating point registers 0-31
-+ stfd 0, 0x268(3) // context->uc_mcontext.fp_regs[0]
-+ stfd 1, 0x270(3) // context->uc_mcontext.fp_regs[1]
-+ stfd 2, 0x278(3) // context->uc_mcontext.fp_regs[2]
-+ stfd 3, 0x280(3) // context->uc_mcontext.fp_regs[3]
-+ stfd 4, 0x288(3) // context->uc_mcontext.fp_regs[4]
-+ stfd 5, 0x290(3) // context->uc_mcontext.fp_regs[5]
-+ stfd 6, 0x298(3) // context->uc_mcontext.fp_regs[6]
-+ stfd 7, 0x2a0(3) // context->uc_mcontext.fp_regs[7]
-+ stfd 8, 0x2a8(3) // context->uc_mcontext.fp_regs[8]
-+ stfd 9, 0x2b0(3) // context->uc_mcontext.fp_regs[9]
-+ stfd 10, 0x2b8(3) // context->uc_mcontext.fp_regs[10]
-+ stfd 11, 0x2c0(3) // context->uc_mcontext.fp_regs[11]
-+ stfd 12, 0x2c8(3) // context->uc_mcontext.fp_regs[12]
-+ stfd 13, 0x2d0(3) // context->uc_mcontext.fp_regs[13]
-+ stfd 14, 0x2d8(3) // context->uc_mcontext.fp_regs[14]
-+ stfd 15, 0x2e0(3) // context->uc_mcontext.fp_regs[15]
-+ stfd 16, 0x2e8(3) // context->uc_mcontext.fp_regs[16]
-+ stfd 17, 0x2f0(3) // context->uc_mcontext.fp_regs[17]
-+ stfd 18, 0x2f8(3) // context->uc_mcontext.fp_regs[18]
-+ stfd 19, 0x300(3) // context->uc_mcontext.fp_regs[19]
-+ stfd 20, 0x308(3) // context->uc_mcontext.fp_regs[20]
-+ stfd 21, 0x310(3) // context->uc_mcontext.fp_regs[21]
-+ stfd 22, 0x318(3) // context->uc_mcontext.fp_regs[22]
-+ stfd 23, 0x320(3) // context->uc_mcontext.fp_regs[23]
-+ stfd 24, 0x328(3) // context->uc_mcontext.fp_regs[24]
-+ stfd 25, 0x330(3) // context->uc_mcontext.fp_regs[25]
-+ stfd 26, 0x338(3) // context->uc_mcontext.fp_regs[26]
-+ stfd 27, 0x340(3) // context->uc_mcontext.fp_regs[27]
-+ stfd 28, 0x348(3) // context->uc_mcontext.fp_regs[28]
-+ stfd 29, 0x350(3) // context->uc_mcontext.fp_regs[29]
-+ stfd 30, 0x358(3) // context->uc_mcontext.fp_regs[30]
-+ stfd 31, 0x360(3) // context->uc_mcontext.fp_regs[31]
-+
-+ // FPSCR
-+ mffs 0
-+ stfd 0, 0x368(3) // context->uc_mcontext.fp_regs[32]
-+
-+ // Save VMX Vector registers
-+ // Update r4 to contain the base address of vmx_reserve
-+ addi 4, 3, 0x378
-+ // Ensure that it is quadword aligned
-+ andi. 5, 4, 0xF
-+ beq 1f // No alignment is necessary
-+ // Address is doubleword aligned and not quadword aligned, add 8
-+ addi 4, 4, 8
-+
-+1:
-+ // Store VMX registers 0-31
-+ // r4 will contain the base address
-+ // r5 will contain the index
-+ li 5, 0
-+ stvx 0, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 0]
-+ addi 5, 5, 16
-+ stvx 1, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 1]
-+ addi 5, 5, 16
-+ stvx 2, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 2]
-+ addi 5, 5, 16
-+ stvx 3, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 3]
-+ addi 5, 5, 16
-+ stvx 4, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 4]
-+ addi 5, 5, 16
-+ stvx 5, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 5]
-+ addi 5, 5, 16
-+ stvx 6, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 6]
-+ addi 5, 5, 16
-+ stvx 7, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 7]
-+ addi 5, 5, 16
-+ stvx 8, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 8]
-+ addi 5, 5, 16
-+ stvx 9, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 9]
-+ addi 5, 5, 16
-+ stvx 10, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 10]
-+ addi 5, 5, 16
-+ stvx 11, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 11]
-+ addi 5, 5, 16
-+ stvx 12, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 12]
-+ addi 5, 5, 16
-+ stvx 13, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 13]
-+ addi 5, 5, 16
-+ stvx 14, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 14]
-+ addi 5, 5, 16
-+ stvx 15, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 15]
-+ addi 5, 5, 16
-+ stvx 16, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 16]
-+ addi 5, 5, 16
-+ stvx 17, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 17]
-+ addi 5, 5, 16
-+ stvx 18, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 18]
-+ addi 5, 5, 16
-+ stvx 19, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 19]
-+ addi 5, 5, 16
-+ stvx 20, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 20]
-+ addi 5, 5, 16
-+ stvx 21, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 21]
-+ addi 5, 5, 16
-+ stvx 22, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 22]
-+ addi 5, 5, 16
-+ stvx 23, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 23]
-+ addi 5, 5, 16
-+ stvx 24, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 24]
-+ addi 5, 5, 16
-+ stvx 25, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 25]
-+ addi 5, 5, 16
-+ stvx 26, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 26]
-+ addi 5, 5, 16
-+ stvx 27, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 27]
-+ addi 5, 5, 16
-+ stvx 28, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 28]
-+ addi 5, 5, 16
-+ stvx 29, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 29]
-+ addi 5, 5, 16
-+ stvx 30, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 30]
-+ addi 5, 5, 16
-+ stvx 31, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 31]
-+ addi 5, 5, 16
-+
-+ // VSCR
-+ mfvscr 0
-+ stvx 0, 4, 5
-+ addi 5, 5, 16
-+
-+ // VRSAVE
-+ mfvrsave 0
-+ stwx 0, 4, 5
-+
-+ // Update context->uc_mcontext.v_regs to point to vmx_reserve + alignment.
-+ std 4, 0x370(3)
-+
-+ // Zero out all unused fields
-+ li 4, 0
-+ std 4, 0xc8(3) // context->uc_mcontext.signal
-+ std 4, 0xd0(3) // context->uc_mcontext.handler
-+ std 4, 0xd8(3) // context->uc_mcontext.oldmask
-+
-+ blr
- #endif // __i386__
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-index cf23c2def..5f264bc92 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-@@ -57,7 +57,7 @@ void TestCaptureContext() {
- uintptr_t pc = ProgramCounterFromContext(context_1);
-
- #if !defined(ADDRESS_SANITIZER) && !defined(ARCH_CPU_MIPS_FAMILY) && \
-- !defined(MEMORY_SANITIZER)
-+ !defined(MEMORY_SANITIZER) && !defined(ARCH_CPU_PPC64_FAMILY)
- // Sanitizers can cause enough code bloat that the “nearby” check would
- // likely fail.
- const uintptr_t kReferencePC =
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-index 30a2ab21d..60509f21d 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-@@ -35,6 +35,8 @@ void SanityCheckContext(const NativeCPUContext& context) {
- EXPECT_EQ(context.uc_mcontext.regs[0], FromPointerCast<uintptr_t>(&context));
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- EXPECT_EQ(context.uc_mcontext.gregs[4], FromPointerCast<uintptr_t>(&context));
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ EXPECT_EQ(context.uc_mcontext.gp_regs[3], FromPointerCast<uintptr_t>(&context));
- #endif
- }
-
-@@ -49,6 +51,8 @@ uintptr_t ProgramCounterFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.pc;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.pc;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[PT_NIP];
- #endif
- }
-
-@@ -63,6 +67,8 @@ uintptr_t StackPointerFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.sp;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.gregs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[1];
- #endif
- }
-
-diff --git a/third_party/dav1d/config/linux/ppc64/config.h b/third_party/dav1d/config/linux/ppc64/config.h
-new file mode 100644
-index 000000000..9fbbf75cc
---- /dev/null
-+++ b/third_party/dav1d/config/linux/ppc64/config.h
-@@ -0,0 +1,39 @@
-+/*
-+ * Autogenerated by the Meson build system.
-+ * Do not edit, your changes will be lost.
-+ */
-+
-+#pragma once
-+
-+#define ARCH_AARCH64 0
-+
-+#define ARCH_ARM 0
-+
-+#define ARCH_PPC64LE 1
-+
-+#define ARCH_X86 0
-+
-+#define ARCH_X86_32 0
-+
-+#define ARCH_X86_64 0
-+
-+#define CONFIG_16BPC 1
-+
-+#define CONFIG_8BPC 1
-+
-+// #define CONFIG_LOG 1 -- Logging is controlled by Chromium
-+
-+#define ENDIANNESS_BIG 0
-+
-+#define HAVE_ASM 1
-+
-+#define HAVE_CLOCK_GETTIME 1
-+
-+#define HAVE_DLSYM 1
-+
-+#define HAVE_GETAUXVAL 1
-+
-+#define HAVE_POSIX_MEMALIGN 1
-+
-+#define HAVE_UNISTD_H 1
-+
-diff --git a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-index 0b4bd72f0..a0caa5e71 100644
---- a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-+++ b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-@@ -51,4 +51,19 @@
- #define u16l_to_i32(v) ((i32x4) vec_mergel((u16x8) v, vec_splat_u16(0)))
- #define i16l_to_i32(v) ((i32x4) vec_unpackl((i16x8)v))
-
-+#if defined(__clang__)
-+#undef vec_splats
-+#define vec_splats(N) \
-+ _Generic((N), \
-+ unsigned char: ((u8x16)(N)), \
-+ signed char: ((i8x16)(N)), \
-+ unsigned short: ((u16x8)(N)), \
-+ signed short: ((i16x8)(N)), \
-+ unsigned int: ((u32x4)(N)), \
-+ signed int: ((i32x4)(N)), \
-+ unsigned long long: ((u64x2)(N)), \
-+ signed long long: ((i64x2)(N)) \
-+ )
-+#endif
-+
- #endif /* DAV1D_SRC_PPC_TYPES_H */
-diff --git a/third_party/eigen3/BUILD.gn b/third_party/eigen3/BUILD.gn
-index 0d4e184..f2ce484 100644
---- a/third_party/eigen3/BUILD.gn
-+++ b/third_party/eigen3/BUILD.gn
-@@ -22,4 +22,8 @@ config("eigen_includes") {
- # for this component on Windows on Arm due to compilation errors.
- defines += [ "EIGEN_DONT_VECTORIZE" ]
- }
-+
-+ if (target_cpu == "ppc64") {
-+ defines += [ "EIGEN_DONT_VECTORIZE" ]
-+ }
- }
-
-diff --git a/third_party/libaom/BUILD.gn b/third_party/libaom/BUILD.gn
-index 9b065bd..df3af02 100644
---- a/third_party/libaom/BUILD.gn
-+++ b/third_party/libaom/BUILD.gn
-@@ -40,6 +40,8 @@
- cpu_arch_full = "generic"
- } else if (current_cpu == "loong64") {
- cpu_arch_full = "generic"
-+} else if (current_cpu == "ppc64") {
-+ cpu_arch_full = "generic"
- } else {
- cpu_arch_full = current_cpu
- }
-diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h
-index e4ac22644..1c57015db 100644
---- a/third_party/lss/linux_syscall_support.h
-+++ b/third_party/lss/linux_syscall_support.h
-@@ -3947,7 +3947,7 @@ struct kernel_statfs {
- LSS_REG(2, buf);
- LSS_BODY(void*, mmap2, "0"(__r2));
- }
--#else
-+#elif !defined(__powerpc64__) /* ppc64 doesn't have mmap2 */
- #define __NR__mmap2 __NR_mmap2
- LSS_INLINE _syscall6(void*, _mmap2, void*, s,
- size_t, l, int, p,
-@@ -4058,7 +4058,7 @@ struct kernel_statfs {
- #if defined(__i386__) || \
- defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \
- (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \
-- defined(__PPC__) || \
-+ (defined(__PPC__) && !defined(__powerpc64__)) || \
- (defined(__s390__) && !defined(__s390x__))
- /* On these architectures, implement mmap() with mmap2(). */
- LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d,
-@@ -4872,11 +4872,11 @@ struct kernel_statx {
- LSS_SC_BODY(4, int, 8, d, type, protocol, sv);
- }
- #endif
-- #if defined(__NR_recvmsg)
-+ #if defined(__NR_recvmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, recvmsg, int, s, struct kernel_msghdr*, msg,
- int, flags)
- #endif
-- #if defined(__NR_sendmsg)
-+ #if defined(__NR_sendmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, sendmsg, int, s, const struct kernel_msghdr*,
- msg, int, flags)
- #endif
-@@ -4885,13 +4885,13 @@ struct kernel_statx {
- int, flags, const struct kernel_sockaddr*, to,
- unsigned int, tolen)
- #endif
-- #if defined(__NR_shutdown)
-+ #if defined(__NR_shutdown) && !defined(__PPC__)
- LSS_INLINE _syscall2(int, shutdown, int, s, int, how)
- #endif
-- #if defined(__NR_socket)
-+ #if defined(__NR_socket) && !defined(__PPC__)
- LSS_INLINE _syscall3(int, socket, int, domain, int, type, int, protocol)
- #endif
-- #if defined(__NR_socketpair)
-+ #if defined(__NR_socketpair) && !defined(__PPC__)
- LSS_INLINE _syscall4(int, socketpair, int, d, int, type, int, protocol,
- int*, sv)
- #endif
-diff --git a/third_party/pdfium/third_party/libpng16/pngpriv.h b/third_party/pdfium/third_party/libpng16/pngpriv.h
-index 583c26f..e03d697 100644
---- a/third_party/pdfium/third_party/libpng16/pngpriv.h
-+++ b/third_party/pdfium/third_party/libpng16/pngpriv.h
-@@ -196,11 +196,7 @@
- #endif
-
- #ifndef PNG_POWERPC_VSX_OPT
--# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
--# define PNG_POWERPC_VSX_OPT 2
--# else
--# define PNG_POWERPC_VSX_OPT 0
--# endif
-+# define PNG_POWERPC_VSX_OPT 0
- #endif
-
- #ifndef PNG_INTEL_SSE_OPT
-diff --git a/third_party/pffft/src/pffft.c b/third_party/pffft/src/pffft.c
-index bdac4d784..51e0f2cac 100644
---- a/third_party/pffft/src/pffft.c
-+++ b/third_party/pffft/src/pffft.c
-@@ -100,6 +100,7 @@
- Altivec support macros
- */
- #if !defined(PFFFT_SIMD_DISABLE) && (defined(__ppc__) || defined(__ppc64__))
-+#include <altivec.h>
- typedef vector float v4sf;
- # define SIMD_SZ 4
- # define VZERO() ((vector float) vec_splat_u8(0))
-diff --git a/third_party/sqlite/src/amalgamation/sqlite3.c b/third_party/sqlite/src/amalgamation/sqlite3.c
-index 6b4a7899d..b8c7fe414 100644
---- a/third_party/sqlite/src/amalgamation/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation/sqlite3.c
-@@ -14474,7 +14474,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/amalgamation_dev/sqlite3.c b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-index d30c9b7de..cf75a69d9 100644
---- a/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-@@ -14487,7 +14487,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/ext/rtree/rtree.c b/third_party/sqlite/src/ext/rtree/rtree.c
-index f5b57a5e2..80a2d0ad8 100644
---- a/third_party/sqlite/src/ext/rtree/rtree.c
-+++ b/third_party/sqlite/src/ext/rtree/rtree.c
-@@ -450,7 +450,7 @@ struct RtreeMatchArg {
- #if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__arm__)
-+ defined(__arm__) || defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- #elif defined(sparc) || defined(__ppc__)
- # define SQLITE_BYTEORDER 4321
-diff --git a/third_party/sqlite/src/src/sqliteInt.h b/third_party/sqlite/src/src/sqliteInt.h
-index 245070d4f..b25164e95 100644
---- a/third_party/sqlite/src/src/sqliteInt.h
-+++ b/third_party/sqlite/src/src/sqliteInt.h
-@@ -877,7 +877,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/webrtc/rtc_base/system/arch.h b/third_party/webrtc/rtc_base/system/arch.h
-index be2367b85..be4ee4233 100644
---- a/third_party/webrtc/rtc_base/system/arch.h
-+++ b/third_party/webrtc/rtc_base/system/arch.h
-@@ -79,6 +79,18 @@
- #elif defined(__EMSCRIPTEN__)
- #define WEBRTC_ARCH_32_BITS
- #define WEBRTC_ARCH_LITTLE_ENDIAN
-+#elif defined(__PPC__)
-+#define WEBRTC_ARCH_PPC_FAMILY
-+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-+#define WEBRTC_ARCH_LITTLE_ENDIAN
-+#else
-+#define WEBRTC_ARCH_BIG_ENDIAN
-+#endif
-+#if defined(__LP64__)
-+#define WEBRTC_ARCH_64_BITS
-+#else
-+#define WEBRTC_ARCH_32_BITS
-+#endif
- #else
- #error Please add support for your architecture in rtc_base/system/arch.h
- #endif
-diff --git a/v8/BUILD.gn b/v8/BUILD.gn
-index f39529a3a..e84fc449e 100644
---- a/v8/BUILD.gn
-+++ b/v8/BUILD.gn
-@@ -850,6 +850,12 @@ config("toolchain") {
- }
- if (host_byteorder == "little") {
- defines += [ "V8_TARGET_ARCH_PPC_LE" ]
-+ cflags += [
-+ # Enable usage of AltiVec, VSX, and other POWER8 and higher features
-+ "-mcpu=power8",
-+ "-maltivec",
-+ "-mvsx",
-+ ]
- } else if (host_byteorder == "big") {
- defines += [ "V8_TARGET_ARCH_PPC_BE" ]
- if (current_os == "aix") {
---- a/ui/gl/features.gni
-+++ b/ui/gl/features.gni
-@@ -33,5 +33,5 @@
- is_chromeos_ash || is_fuchsia) &&
- (target_cpu == "x86" || target_cpu == "x64" || target_cpu == "arm" ||
- target_cpu == "arm64" || target_cpu == "mipsel" ||
-- target_cpu == "mips64el" || target_cpu == "riscv64")
-+ target_cpu == "mips64el" || target_cpu == "riscv64" || target_cpu == "ppc64")
- }
-diff --git a/v8/test/BUILD.gn b/v8/test/BUILD.gn
-index fb872ad39..45fc585dd 100644
---- a/v8/test/BUILD.gn
-+++ b/v8/test/BUILD.gn
-@@ -42,7 +42,7 @@ group("gn_all") {
- "benchmarks/cpp:gn_all",
- "cctest:cctest",
- "unittests:generate-bytecode-expectations",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
- }
- }
-@@ -84,7 +84,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- "webkit:v8_webkit",
- ]
-
-@@ -109,7 +109,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
-
- if (v8_enable_webassembly) {
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch b/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
deleted file mode 100644
index df453f491d8c..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-+++ b/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-@@ -574,6 +574,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCAsmInfoCOFF.cpp",
- "llvm/lib/MC/MCAsmInfoDarwin.cpp",
- "llvm/lib/MC/MCAsmInfoELF.cpp",
-+ "llvm/lib/MC/MCAsmInfoXCOFF.cpp",
- "llvm/lib/MC/MCAsmMacro.cpp",
- "llvm/lib/MC/MCAsmStreamer.cpp",
- "llvm/lib/MC/MCAssembler.cpp",
-@@ -629,6 +630,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCWinCOFFStreamer.cpp",
- "llvm/lib/MC/MCWinEH.cpp",
- "llvm/lib/MC/MCXCOFFStreamer.cpp",
-+ "llvm/lib/MC/MCXCOFFObjectTargetWriter.cpp",
- "llvm/lib/MC/MachObjectWriter.cpp",
- "llvm/lib/MC/StringTableBuilder.cpp",
- "llvm/lib/MC/SubtargetFeature.cpp",
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 7dea8bbe50d3..784b8a8c5d29 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -1,9 +1,9 @@
# Template file for 'chromium'
pkgname=chromium
# See https://chromiumdash.appspot.com/releases?platform=Linux for the latest version
-version=108.0.5359.124
+version=109.0.5414.74
revision=1
-archs="i686* x86_64* aarch64* armv7l* ppc64le*"
+archs="i686* x86_64* aarch64* armv7l*"
hostmakedepends="
$(vopt_if clang "clang lld llvm12")
$(vopt_if js_optimize openjdk)
@@ -28,7 +28,7 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://www.chromium.org/"
distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz"
-checksum=d48dfac2a61b14a5d7d2f460b09b70ef3ab88e27b82e3173938cb54eaa612a75
+checksum=eded233c26ab631be325ad49cb306c338513b6a6528197d42653e66187548e5d
lib32disabled=yes
@@ -39,10 +39,9 @@ desc_option_debug="Build with debug symbols"
desc_option_js_optimize="Optimize the JS used for Chromium's UI"
desc_option_pipewire="Enable support for screen sharing for WebRTC via PipeWire"
-
-case "$XBPS_TARGET_MACHINE" in
- ppc64*-musl) makedepends+=" libucontext-devel" ;;
-esac
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+ makedepends+=" musl-legacy-compat"
+fi
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" libX11-devel libxcb-devel pciutils-devel libXext-devel libglvnd-devel
@@ -135,20 +134,6 @@ do_configure() {
CFLAGS=$CFLAGS_FOR_BUILD CXXFLAGS=$CXXFLAGS_FOR_BUILD LDFLAGS=$LDFLAGS_FOR_BUILD \
tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles
- # we need to generate ppc64 stuff for libvpx as it's not shipped
- # this has to be done before unbundling, but after gn is built
- # comment out if we switch back to system libvpx again later
- case "$XBPS_TARGET_MACHINE" in
- ppc64*)
- pushd third_party/libvpx
- mkdir -p source/config/linux/ppc64
- # need PATH to find gn
- PATH="${wrksrc}/out/Release:$PATH" ./generate_gni.sh || \
- msg_error "failed to generate libvpx gni"
- popd
- ;;
- esac
-
# Use system-provided libraries.
# TODO: use_system_hunspell (upstream changes needed).
# TODO: use_system_libsrtp.
@@ -220,9 +205,6 @@ do_configure() {
'icu_use_data_file=true'
- 'use_allocator="none"'
- 'use_allocator_shim=false'
-
'enable_widevine=true'
'enable_hangout_services_extension=true'
@@ -286,11 +268,6 @@ do_configure() {
)
fi
- # this does not work on ppc64 yet
- case "$XBPS_TARGET_MACHINE" in
- ppc64*) conf+=( "enable_jxl_decoder=false" );;
- esac
-
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
conf+=( 'is_musl=true' )
fi
@@ -300,7 +277,6 @@ do_configure() {
i686*) conf+=( 'target_cpu="x86"' ) ;;
arm*) conf+=( 'target_cpu="arm"' ) ;;
aarch64*) conf+=( 'target_cpu="arm64"' ) ;;
- ppc64*) conf+=( 'target_cpu="ppc64"' ) ;;
esac
if [ "$CROSS_BUILD" ]; then
@@ -309,7 +285,6 @@ do_configure() {
i686*) conf+=( 'host_cpu="x86"' ) ;;
arm*) conf+=( 'host_cpu="arm"' ) ;;
aarch64*) conf+=( 'host_cpu="arm64"' ) ;;
- ppc64*) conf+=( 'host_cpu="ppc64"' ) ;;
esac
fi
_setup_toolchain
@@ -318,13 +293,13 @@ do_configure() {
do_build() {
_setup_toolchain
- CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver chrome_crashpad_handler
+ CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver.unstripped chrome_crashpad_handler
}
do_install() {
vinstall out/Release/chrome 755 usr/lib/${pkgname} ${pkgname}
vinstall out/Release/chrome_crashpad_handler 755 usr/lib/${pkgname} chrome_crashpad_handler
- vinstall out/Release/chromedriver 755 usr/lib/${pkgname} chromedriver
+ vinstall out/Release/chromedriver.unstripped 755 usr/lib/${pkgname} chromedriver
vinstall out/Release/libEGL.so 755 usr/lib/${pkgname} libEGL.so
vinstall out/Release/libGLESv2.so 755 usr/lib/${pkgname} libGLESv2.so
vinstall out/Release/libvk_swiftshader.so 755 usr/lib/${pkgname} libvk_swiftshader.so
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] chromium: update to 109.0.5414.74.
2023-01-11 1:12 [PR PATCH] chromium: update to 109.0.5414.74 Duncaen
` (3 preceding siblings ...)
2023-01-11 14:53 ` Duncaen
@ 2023-01-11 17:20 ` Duncaen
2023-01-11 17:41 ` Duncaen
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Duncaen @ 2023-01-11 17:20 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]
There is an updated pull request by Duncaen against master on the void-packages repository
https://github.com/Duncaen/void-packages chromium-109
https://github.com/void-linux/void-packages/pull/41570
chromium: update to 109.0.5414.74.
[ci skip]
* [x] x86_64-glibc
* [ ] x86_64-musl
* [ ] aarch64-musl
* [ ] i686
A patch file from https://github.com/void-linux/void-packages/pull/41570.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-chromium-109-41570.patch --]
[-- Type: text/x-diff, Size: 184163 bytes --]
From 4caa6ae93ee6ae2f751c7ecce0c47debe4e80600 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Wed, 11 Jan 2023 01:28:40 +0100
Subject: [PATCH] chromium: update to 109.0.5414.74.
---
.../musl-patches/xxx-ppc64le-support.patch | 187 -
.../patches/build-add-use_cxx17.patch | 38 +-
.../patches/fix-build-with-old-clang.patch | 20 +
.../patches/fix-constexpr-narrowing.patch | 21 +
.../patches/fix-musl-no-mallinfo.patch | 11 +
.../patches/fix-musl-pthread-stacksize.patch | 40 -
.../chromium/patches/fix-narrowing-cast.patch | 53 -
.../patches/fix-nasm-musl-config.patch | 12 -
.../patches/musl-partition-atfork.patch | 11 +
srcpkgs/chromium/patches/narrowing-cast.patch | 21 +
...uild-error-on-linux-with-system-zlib.patch | 41 -
.../patches/remove-strip_binary.patch | 32 -
.../patches/xxx-ppc64le-4k-pages.patch | 60 -
.../chromium/patches/xxx-ppc64le-libvpx.patch | 33 -
.../xxx-ppc64le-sandbox-linux-stat.patch | 31 -
.../patches/xxx-ppc64le-support.patch | 3590 -----------------
.../patches/xxx-ppc64le-swiftshader.patch | 18 -
srcpkgs/chromium/template | 41 +-
18 files changed, 109 insertions(+), 4151 deletions(-)
delete mode 100644 srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
create mode 100644 srcpkgs/chromium/patches/fix-build-with-old-clang.patch
create mode 100644 srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
create mode 100644 srcpkgs/chromium/patches/fix-musl-no-mallinfo.patch
delete mode 100644 srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
delete mode 100644 srcpkgs/chromium/patches/fix-narrowing-cast.patch
delete mode 100644 srcpkgs/chromium/patches/fix-nasm-musl-config.patch
create mode 100644 srcpkgs/chromium/patches/musl-partition-atfork.patch
create mode 100644 srcpkgs/chromium/patches/narrowing-cast.patch
delete mode 100644 srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
delete mode 100644 srcpkgs/chromium/patches/remove-strip_binary.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-support.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
diff --git a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 555f69c072c8..000000000000
--- a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,187 +0,0 @@
-diff --git sandbox/linux/bpf_dsl/seccomp_macros.h sandbox/linux/bpf_dsl/seccomp_macros.h
-index a6aec544e..2a4a7f1bc 100644
---- sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,7 +16,7 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
--#elif defined(__powerpc64__)
-+#elif defined(__powerpc64__) && defined(__GLIBC__)
- // Manually define greg_t on ppc64
- typedef unsigned long long greg_t;
- #endif
-@@ -361,11 +361,11 @@ typedef struct pt_regs regs_struct;
- #define SECCOMP_ARCH AUDIT_ARCH_PPC64
- #endif
-
--#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+#define SECCOMP_REG(_ctx, _reg) (((struct pt_regs *)(_ctx)->uc_mcontext.regs)->gpr[_reg])
-
- #define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
--#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_IP(_ctx) ((struct pt_regs *)(_ctx)->uc_mcontext.regs)->nip
- #define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
- #define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-diff --git sandbox/linux/seccomp-bpf/syscall.cc sandbox/linux/seccomp-bpf/syscall.cc
-index d53a7ff56..c290f0e92 100644
---- sandbox/linux/seccomp-bpf/syscall.cc
-+++ sandbox/linux/seccomp-bpf/syscall.cc
-@@ -499,9 +499,9 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // Same as MIPS, need to invert ret and set error register (cr0.SO)
- if (ret_val <= -1 && ret_val >= -4095) {
- ret_val = -ret_val;
-- ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr |= (1 << 28);
- } else {
-- ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr &= ~(1 << 28);
- }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
---- third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-+++ third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-@@ -22,6 +22,7 @@
- // The following platforms have an implementation of a hardware counter.
- #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
- defined(__powerpc__) || defined(__ppc__) || defined(__riscv) || \
-+ ((defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__)) || defined(__riscv) || \
- defined(_M_IX86) || (defined(_M_X64) && !defined(_M_ARM64EC))
- #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1
- #else
---- third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-+++ third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-@@ -64,7 +64,7 @@
- #elif defined(__i386__) || defined(__x86_64__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_x86-inl.inc"
--#elif defined(__ppc__) || defined(__PPC__)
-+#elif (defined(__ppc__) || defined(__PPC__)) && defined(__GLIBC__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_powerpc-inl.inc"
- #elif defined(__aarch64__)
-diff --git third_party/breakpad/BUILD.gn third_party/breakpad/BUILD.gn
-index f9a60e37..25f3a0b7 100644
---- third_party/breakpad/BUILD.gn
-+++ third_party/breakpad/BUILD.gn
-@@ -637,6 +637,7 @@ if (is_linux || is_android) {
-
- if (current_cpu == "ppc64") {
- defines = [ "HAVE_GETCONTEXT" ]
-+ libs += [ "ucontext" ]
- } else {
- sources += [
- "breakpad/src/common/linux/breakpad_getcontext.S"
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index 03afec7a..0264ecf1 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -273,6 +273,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t ThreadInfo::GetInstructionPointer() const {
- return mcontext.gp_regs[PT_NIP];
- }
-@@ -290,9 +293,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->ctr = mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] = \
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 1090470f..e580233d 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -257,6 +257,9 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
- return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
- }
-@@ -280,9 +283,9 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&uc->uc_mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&uc->uc_mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] =
-diff --git third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index 5a7ab50c..ee8b858c 100644
---- third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -105,6 +105,11 @@
- #define PR_SET_PTRACER 0x59616d61
- #endif
-
-+/* musl hack, can't include asm/ptrace.h as that causes conflicts */
-+#if defined(__powerpc64__) && !defined(PT_NIP)
-+#define PT_NIP 32
-+#endif
-+
- namespace google_breakpad {
-
- namespace {
-diff --git third_party/crashpad/crashpad/snapshot/linux/signal_context.h third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 8e335a09..b2a0f155 100644
---- third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -469,7 +469,7 @@ struct MContext64 {
- SignalThreadContext64 gp_regs;
- SignalFloatContext64 fp_regs;
- SignalVectorContext64 *v_regs;
-- int64_t vmx_reserve[69];
-+ int64_t vmx_reserve[101];
- };
-
- struct ContextTraits64 : public Traits64 {
-diff --git third_party/crashpad/crashpad/util/linux/thread_info.h third_party/crashpad/crashpad/util/linux/thread_info.h
-index dea0d1f3..b203e5b2 100644
---- third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -30,6 +30,7 @@
-
- #if defined(ARCH_CPU_PPC64_FAMILY)
- #include <sys/ucontext.h>
-+#include <asm/ptrace.h>
- #endif
-
- namespace crashpad {
-diff --git third_party/lss/linux_syscall_support.h third_party/lss/linux_syscall_support.h
-index 9955ce44..4c1cc488 100644
---- third_party/lss/linux_syscall_support.h
-+++ third_party/lss/linux_syscall_support.h
-@@ -4216,9 +4216,13 @@ struct kernel_statfs {
- }
- #endif
- #if defined(__NR_fstatat64)
-+ // musl does #define fstatat64 fstatat
-+ #undef fstatat64
- LSS_INLINE _syscall4(int, fstatat64, int, d,
- const char *, p,
- struct kernel_stat64 *, b, int, f)
-+ // set it back like it was
-+ #define fstatat64 fstatat
- #endif
- #if defined(__NR_waitpid)
- // waitpid is polyfilled below when not available.
diff --git a/srcpkgs/chromium/patches/build-add-use_cxx17.patch b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
index 091b1c553727..b50825fb7e2c 100644
--- a/srcpkgs/chromium/patches/build-add-use_cxx17.patch
+++ b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
@@ -1,26 +1,22 @@
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
-@@ -167,6 +167,10 @@
- # Enable -H, which prints the include tree during compilation.
- # For use by tools/clang/scripts/analyze_includes.py
- show_includes = false
-+
-+ # Allow projects that wish to stay on C++17 to override Chromium's default.
-+ # TODO(crbug.com/1402249): evaluate removing this end of 2023
-+ use_cxx17 = false
+@@ -191,6 +191,10 @@
+ current_cpu == "x64"))))
}
- declare_args() {
-@@ -596,7 +600,11 @@
- } else if (is_linux) {
- # TODO(crbug.com/1284275): Switch to C++20 on all platforms.
- if (is_clang) {
-- cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ if (use_cxx17) {
-+ cflags_cc += [ "-std=${standard_prefix}++17" ]
-+ } else {
-+ cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ }
++declare_args() {
++ use_cxx17 = false
++}
++
+ if (is_android || (is_chromeos_ash && is_chromeos_device)) {
+ # Set the path to use orderfile for linking Chrome
+ # Note that this is for using only one orderfile for linking
+@@ -605,7 +609,7 @@
+ cflags_cc += [ "-fno-trigraphs" ]
+ }
+ } else if (is_clang) {
+- if (is_chromeos_device) {
++ if (is_chromeos_device || use_cxx17) {
+ # TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
+ cflags_cc += [ "-std=${standard_prefix}++17" ]
} else {
- # The gcc bots are currently using GCC 9, which is not new enough to
- # support "c++20"/"gnu++20".
diff --git a/srcpkgs/chromium/patches/fix-build-with-old-clang.patch b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
new file mode 100644
index 000000000000..f23218e71e4d
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
@@ -0,0 +1,20 @@
+--- a/build/config/compiler/BUILD.gn
++++ b/build/config/compiler/BUILD.gn
+@@ -805,17 +805,6 @@
+ cflags += [ "-fcomplete-member-pointers" ]
+ }
+
+- # Use DWARF simple template names, with the following exceptions:
+- #
+- # * Windows is not supported as it doesn't use DWARF.
+- # * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
+- # lldb doesn't have the needed changes yet.
+- # * Fuchsia isn't supported as zxdb doesn't support simple template names yet.
+- # TODO(crbug.com/1379070): Remove if the upstream default ever changes.
+- if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
+- cflags_cc += [ "-gsimple-template-names" ]
+- }
+-
+ # MLGO specific flags. These flags enable an ML-based inliner trained on
+ # Chrome on Android (arm32) with ThinLTO enabled, optimizing for size.
+ # The "release" ML model is embedded into clang as part of its build.
diff --git a/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch b/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
new file mode 100644
index 000000000000..570ca6e69a80
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
@@ -0,0 +1,21 @@
+--- a/third_party/blink/renderer/platform/media/web_media_player_impl.cc.orig
++++ b/third_party/blink/renderer/platform/media/web_media_player_impl.cc
+@@ -3881,15 +3881,15 @@
+ const T&... values) {
+ std::string strkey = std::string(key);
+
+- if constexpr (Flags & kEncrypted) {
++ if constexpr (Flags & kEncrypted != 0) {
+ if (is_encrypted_)
+ UmaFunction(strkey + ".EME", values...);
+ }
+
+- if constexpr (Flags & kTotal)
++ if constexpr (Flags & kTotal != 0)
+ UmaFunction(strkey + ".All", values...);
+
+- if constexpr (Flags & kPlaybackType) {
++ if constexpr (Flags & kPlaybackType != 0) {
+ auto demuxer_type = GetDemuxerType();
+ if (!demuxer_type.has_value())
+ return;
diff --git a/srcpkgs/chromium/patches/fix-musl-no-mallinfo.patch b/srcpkgs/chromium/patches/fix-musl-no-mallinfo.patch
new file mode 100644
index 000000000000..1718eccb2204
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-musl-no-mallinfo.patch
@@ -0,0 +1,11 @@
+--- a/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
++++ b/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
+@@ -717,7 +717,7 @@
+
+ #endif // !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS)
+ SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW {
+ base::SimplePartitionStatsDumper allocator_dumper;
+ Allocator()->DumpStats("malloc", true, &allocator_dumper);
diff --git a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch b/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
deleted file mode 100644
index cd5533190db9..000000000000
--- a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- a/base/threading/platform_thread_linux.cc
-+++ b/base/threading/platform_thread_linux.cc
-@@ -436,8 +436,13 @@
-
- size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
- #if !defined(THREAD_SANITIZER)
-+#if defined(__GLIBC__)
- return 0;
- #else
-+ // musl libcs default is too small, use 8mb like glibc
-+ return (1 << 23);
-+#endif
-+#else
- // ThreadSanitizer bloats the stack heavily. Evidence has been that the
- // default stack size isn't enough for some browser tests.
- return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux).
---- a/chrome/browser/shutdown_signal_handlers_posix.cc
-+++ b/chrome/browser/shutdown_signal_handlers_posix.cc
-@@ -188,11 +188,21 @@
- g_shutdown_pipe_read_fd = pipefd[0];
- g_shutdown_pipe_write_fd = pipefd[1];
- #if !defined(ADDRESS_SANITIZER)
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
- #else
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 * 8;
-+#endif
-+#else
- // ASan instrumentation bloats the stack frames, so we need to increase the
- // stack size to avoid hitting the guard page.
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
-+#else
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 * 8;
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+#endif
- #endif
- ShutdownDetector* detector = new ShutdownDetector(
- g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);
diff --git a/srcpkgs/chromium/patches/fix-narrowing-cast.patch b/srcpkgs/chromium/patches/fix-narrowing-cast.patch
deleted file mode 100644
index afd42a1489ae..000000000000
--- a/srcpkgs/chromium/patches/fix-narrowing-cast.patch
+++ /dev/null
@@ -1,53 +0,0 @@
---- a/base/files/file_util_linux.cc
-+++ b/base/files/file_util_linux.cc
-@@ -23,14 +23,14 @@
-
- // Not all possible |statfs_buf.f_type| values are in linux/magic.h.
- // Missing values are copied from the statfs man page.
-- switch (statfs_buf.f_type) {
-+ switch (static_cast<uintmax_t>(statfs_buf.f_type)) {
- case 0:
- *type = FILE_SYSTEM_0;
- break;
- case EXT2_SUPER_MAGIC: // Also ext3 and ext4
- case MSDOS_SUPER_MAGIC:
- case REISERFS_SUPER_MAGIC:
-- case static_cast<int>(BTRFS_SUPER_MAGIC):
-+ case BTRFS_SUPER_MAGIC:
- case 0x5346544E: // NTFS
- case 0x58465342: // XFS
- case 0x3153464A: // JFS
-@@ -40,14 +40,14 @@
- *type = FILE_SYSTEM_NFS;
- break;
- case SMB_SUPER_MAGIC:
-- case static_cast<int>(0xFF534D42): // CIFS
-+ case 0xFF534D42: // CIFS
- *type = FILE_SYSTEM_SMB;
- break;
- case CODA_SUPER_MAGIC:
- *type = FILE_SYSTEM_CODA;
- break;
-- case static_cast<int>(HUGETLBFS_MAGIC):
-- case static_cast<int>(RAMFS_MAGIC):
-+ case HUGETLBFS_MAGIC:
-+ case RAMFS_MAGIC:
- case TMPFS_MAGIC:
- *type = FILE_SYSTEM_MEMORY;
- break;
---- a/base/system/sys_info_posix.cc
-+++ b/base/system/sys_info_posix.cc
-@@ -100,10 +100,10 @@
- if (HANDLE_EINTR(statfs(path.value().c_str(), &stats)) != 0)
- return false;
-
-- switch (stats.f_type) {
-+ switch (static_cast<uintmax_t>(stats.f_type)) {
- case TMPFS_MAGIC:
-- case static_cast<int>(HUGETLBFS_MAGIC):
-- case static_cast<int>(RAMFS_MAGIC):
-+ case HUGETLBFS_MAGIC:
-+ case RAMFS_MAGIC:
- return true;
- }
- return false;
diff --git a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch b/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
deleted file mode 100644
index 7a0337f3bf3b..000000000000
--- a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/third_party/nasm/config/config-linux.h
-+++ b/third_party/nasm/config/config-linux.h
-@@ -139,7 +139,9 @@
- #define HAVE_ACCESS 1
-
- /* Define to 1 if you have the `canonicalize_file_name' function. */
-+#ifdef __GLIBC__
- #define HAVE_CANONICALIZE_FILE_NAME 1
-+#endif
-
- /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
- /* #undef HAVE_CPU_TO_LE16 */
diff --git a/srcpkgs/chromium/patches/musl-partition-atfork.patch b/srcpkgs/chromium/patches/musl-partition-atfork.patch
new file mode 100644
index 000000000000..2910aa2bbf9b
--- /dev/null
+++ b/srcpkgs/chromium/patches/musl-partition-atfork.patch
@@ -0,0 +1,11 @@
+--- a/base/allocator/partition_allocator/partition_root.cc
++++ b/base/allocator/partition_allocator/partition_root.cc
+@@ -239,7 +239,7 @@
+ if (!g_global_init_called.compare_exchange_strong(expected, true))
+ return;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS)
+ // When fork() is called, only the current thread continues to execute in the
+ // child process. If the lock is held, but *not* by this thread when fork() is
+ // called, we have a deadlock.
diff --git a/srcpkgs/chromium/patches/narrowing-cast.patch b/srcpkgs/chromium/patches/narrowing-cast.patch
new file mode 100644
index 000000000000..d10940eb7e89
--- /dev/null
+++ b/srcpkgs/chromium/patches/narrowing-cast.patch
@@ -0,0 +1,21 @@
+from the manpage for statfs:
+
+The __fsword_t type used for various fields in the statfs structure
+definition is a glibc internal type, not intended for public use. This
+leaves the programmer in a bit of a conundrum when trying to copy or
+compare these fields to local variables in a program. Using
+unsigned int for such variables suffices on most systems.
+
+--- a/base/system/sys_info_posix.cc
++++ b/base/system/sys_info_posix.cc
+@@ -64,8 +64,8 @@
+
+ switch (stats.f_type) {
+ case TMPFS_MAGIC:
+- case static_cast<int>(HUGETLBFS_MAGIC):
+- case static_cast<int>(RAMFS_MAGIC):
++ case static_cast<unsigned int>(HUGETLBFS_MAGIC):
++ case static_cast<unsigned int>(RAMFS_MAGIC):
+ return true;
+ }
+ return false;
diff --git a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch b/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
deleted file mode 100644
index 13d504d3e792..000000000000
--- a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From dda01a706453ded8c01c41775707cb5ef4e316f8 Mon Sep 17 00:00:00 2001
-From: Andres Salomon <dilinger@queued.net>
-Date: Tue, 25 Oct 2022 21:11:46 +0000
-Subject: [PATCH] Re-fix TFLite build error on linux when using the system zlib
-
-In commit ae0f9adb7e14c0d19ca695ef6ad40b321a8cb64c, I fixed some build
-errors related to minizip patch inclusion in TFLite. However, after that
-when TFLite Support was rolled to HEAD, a small part of that patch got
-dropped. The result is the following build error with 107.0.5304.62:
-
-../../third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc:22:10: fatal error: 'contrib/minizip/ioapi.h' file not found
- ^~~~~~~~~~~~~~~~~~~~~~~~~
-1 error generated.
-
-This commit re-adds the lost fix.
-
-R=junzou@chromium.org
-
-Change-Id: Ie96c3571894b5100a1e2a2771da29699eff0beb3
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3972087
-Reviewed-by: Robert Ogden <robertogden@chromium.org>
-Commit-Queue: Robert Ogden <robertogden@chromium.org>
-Auto-Submit: Andres Salomon <dilinger@queued.net>
-Cr-Commit-Position: refs/heads/main@{#1063478}
----
- .../metadata/cc/utils/zip_readonly_mem_file.cc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-index 392b6b411fe..525ae4a2b45 100644
---- a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-+++ b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-@@ -19,7 +19,7 @@ limitations under the License.
- #include <cstdio>
-
- #include "absl/strings/string_view.h" // from @com_google_absl
--#include "contrib/minizip/ioapi.h"
-+#include "third_party/zlib/contrib/minizip/ioapi.h"
-
- namespace tflite {
- namespace metadata {
diff --git a/srcpkgs/chromium/patches/remove-strip_binary.patch b/srcpkgs/chromium/patches/remove-strip_binary.patch
deleted file mode 100644
index 8b13c6a056a8..000000000000
--- a/srcpkgs/chromium/patches/remove-strip_binary.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/chrome/test/chromedriver/BUILD.gn.orig
-+++ b/chrome/test/chromedriver/BUILD.gn
-@@ -308,11 +308,7 @@
- }
- }
-
--if (is_linux) {
-- chromedriver_output = "chromedriver.unstripped"
--} else {
-- chromedriver_output = "chromedriver"
--}
-+chromedriver_output = "chromedriver"
-
- executable("$chromedriver_output") {
- testonly = true
-@@ -336,16 +332,6 @@
- }
- }
-
--if (is_linux) {
-- strip_binary("chromedriver") {
-- testonly = true
-- binary_input = "$root_out_dir/$chromedriver_output"
-- symbol_output = "$root_out_dir/chromedriver.debug"
-- stripped_binary_output = "$root_out_dir/chromedriver"
-- deps = [ ":$chromedriver_output" ]
-- }
--}
--
- python_library("chromedriver_py_tests") {
- testonly = true
- deps = [
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch b/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
deleted file mode 100644
index 28c4ad35f14e..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-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;
-
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch b/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
deleted file mode 100644
index 0c03ad4a65eb..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-commit 981437bc846fcdb854062e89fd3d86f112e5f426
-Author: q66 <daniel@octaforge.org>
-Date: Sat Jun 25 12:35:37 2022 +0200
-
- Use generic target for now.
-
- This is because the source tree is missing vsx optimizations that
- then do not get included and result in failed linking such as:
-
- ld.lld: error: undefined symbol: vpx_mse16x16_vsx
-
-diff --git a/third_party/libvpx/generate_gni.sh b/third_party/libvpx/generate_gni.sh
-index 7429080..43ee29a 100755
---- a/third_party/libvpx/generate_gni.sh
-+++ b/third_party/libvpx/generate_gni.sh
-@@ -405,7 +405,7 @@
- gen_config_files linux/mips64el "--target=mips64-linux-gcc ${all_platforms}"
- gen_config_files linux/loongarch \
- "--target=loongarch64-linux-gcc ${all_platforms}"
--gen_config_files linux/ppc64 "--target=ppc64le-linux-gcc ${all_platforms}"
-+gen_config_files linux/ppc64 "--target=generic-gnu ${all_platforms}"
- gen_config_files linux/generic "--target=generic-gnu $HIGHBD ${all_platforms}"
- gen_config_files win/arm64 \
- "--target=arm64-win64-vs15 ${all_platforms} ${HIGHBD}"
-@@ -468,7 +468,7 @@
- gen_rtcd_header linux/mipsel mipsel
- gen_rtcd_header linux/mips64el mips64el
- gen_rtcd_header linux/loongarch loongarch
--gen_rtcd_header linux/ppc64 ppc
-+gen_rtcd_header linux/ppc64 generic
- gen_rtcd_header linux/generic generic
- gen_rtcd_header win/arm64 armv8
- gen_rtcd_header win/ia32 x86 "${require_sse2}"
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch b/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
deleted file mode 100644
index 4bfb5d494b06..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/sandbox/linux/system_headers/linux_stat.h
-+++ b/sandbox/linux/system_headers/linux_stat.h
-@@ -155,6 +155,28 @@ struct kernel_stat {
- unsigned int __unused4;
- unsigned int __unused5;
- };
-+#elif defined(__powerpc64__)
-+struct kernel_stat {
-+ unsigned long st_dev;
-+ unsigned long st_ino;
-+ unsigned long st_nlink;
-+ unsigned int st_mode;
-+ unsigned int st_uid;
-+ unsigned int st_gid;
-+ unsigned long st_rdev;
-+ long st_size;
-+ unsigned long st_blksize;
-+ unsigned long st_blocks;
-+ unsigned long st_atime_;
-+ unsigned long st_atime_nsec_;
-+ unsigned long st_mtime_;
-+ unsigned long st_mtime_nsec_;
-+ unsigned long st_ctime_;
-+ unsigned long st_ctime_nsec_;
-+ unsigned long __unused4;
-+ unsigned long __unused5;
-+ unsigned long __unused6;
-+};
- #endif
-
- // On 32-bit systems, we default to the 64-bit stat struct like libc
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 0bc505358916..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,3590 +0,0 @@
-commit 2c013a317b1114ef67cdbbc30824b28907b9ea94
-Author: Daniel Kolesa <daniel@octaforge.org>
-Date: Wed Mar 3 19:08:29 2021 +0100
-
- ppc64le support
-
-diff --git a/build/download_nacl_toolchains.py b/build/download_nacl_toolchains.py
-index 286a92a27..ec36a85d3 100755
---- a/build/download_nacl_toolchains.py
-+++ b/build/download_nacl_toolchains.py
-@@ -13,6 +13,10 @@ import sys
-
-
- def Main(args):
-+ # If `disable_nacl=1` is in GYP_DEFINES, exit
-+ if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''):
-+ return 0
-+
- script_dir = os.path.dirname(os.path.abspath(__file__))
- src_dir = os.path.dirname(script_dir)
- nacl_dir = os.path.join(src_dir, 'native_client')
---- a/chrome/installer/linux/BUILD.gn
-+++ b/chrome/installer/linux/BUILD.gn
-@@ -97,8 +97,6 @@
- "$root_out_dir/xdg-mime",
- "$root_out_dir/xdg-settings",
- "$root_out_dir/locales/en-US.pak",
-- "$root_out_dir/MEIPreload/manifest.json",
-- "$root_out_dir/MEIPreload/preloaded_data.pb",
- ]
-
- action_foreach("calculate_deb_dependencies") {
-@@ -377,7 +377,6 @@
- "//chrome",
- "//chrome:packed_resources",
- "//chrome/browser/enterprise/connectors/device_trust/key_management/installer/management_service:chrome_management_service",
-- "//chrome/browser/resources/media/mei_preload:component",
- "//components/crash/core/app:chrome_crashpad_handler",
- "//sandbox/linux:chrome_sandbox",
- ]
-diff --git a/sandbox/features.gni b/sandbox/features.gni
-index db30ae6d6..9dc09bf53 100644
---- a/sandbox/features.gni
-+++ b/sandbox/features.gni
-@@ -11,7 +11,8 @@ import("//build/config/nacl/config.gni")
- use_seccomp_bpf = (is_linux || is_chromeos || is_android) &&
- (current_cpu == "x86" || current_cpu == "x64" ||
- current_cpu == "arm" || current_cpu == "arm64" ||
-- current_cpu == "mipsel" || current_cpu == "mips64el")
-+ current_cpu == "mipsel" || current_cpu == "mips64el" ||
-+ current_cpu == "ppc64")
-
- use_seccomp_bpf = use_seccomp_bpf || is_nacl_nonsfi
-
-diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn
-index e9a94b461..cca1a5da5 100644
---- a/sandbox/linux/BUILD.gn
-+++ b/sandbox/linux/BUILD.gn
-@@ -427,6 +427,8 @@ component("sandbox_services") {
-
- source_set("sandbox_services_headers") {
- sources = [
-+ "system_headers/ppc64_linux_syscalls.h",
-+ "system_headers/ppc64_linux_ucontext.h",
- "system_headers/arm64_linux_syscalls.h",
- "system_headers/arm_linux_syscalls.h",
- "system_headers/arm_linux_ucontext.h",
-diff --git a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-index 313511f22..0ca3a326f 100644
---- a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-+++ b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-@@ -56,6 +56,13 @@
- #define MAX_PUBLIC_SYSCALL __NR_syscalls
- #define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-
-+#elif defined(__powerpc64__)
-+
-+#include <asm-generic/unistd.h>
-+#define MIN_SYSCALL 0u
-+#define MAX_PUBLIC_SYSCALL __NR_syscalls
-+#define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-+
- #else
- #error "Unsupported architecture"
- #endif
-diff --git a/sandbox/linux/bpf_dsl/seccomp_macros.h b/sandbox/linux/bpf_dsl/seccomp_macros.h
-index 1a407b952..a6aec544e 100644
---- a/sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ b/sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,6 +16,9 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
-+#elif defined(__powerpc64__)
-+// Manually define greg_t on ppc64
-+typedef unsigned long long greg_t;
- #endif
- #endif
-
-@@ -346,6 +349,51 @@ struct regs_struct {
- #define SECCOMP_PT_PARM4(_regs) (_regs).regs[3]
- #define SECCOMP_PT_PARM5(_regs) (_regs).regs[4]
- #define SECCOMP_PT_PARM6(_regs) (_regs).regs[5]
-+
-+#elif defined(__powerpc64__)
-+#include <asm/ptrace.h>
-+
-+typedef struct pt_regs regs_struct;
-+
-+#ifdef ARCH_CPU_LITTLE_ENDIAN
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64LE
-+#else
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64
-+#endif
-+
-+#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+
-+#define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
-+#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
-+#define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-+#define SECCOMP_PARM4(_ctx) SECCOMP_REG(_ctx, 6)
-+#define SECCOMP_PARM5(_ctx) SECCOMP_REG(_ctx, 7)
-+#define SECCOMP_PARM6(_ctx) SECCOMP_REG(_ctx, 8)
-+
-+#define SECCOMP_NR_IDX (offsetof(struct arch_seccomp_data, nr))
-+#define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch))
-+#define SECCOMP_IP_MSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 4)
-+#define SECCOMP_IP_LSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 0)
-+#define SECCOMP_ARG_MSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 4)
-+#define SECCOMP_ARG_LSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 0)
-+
-+#define SECCOMP_PT_RESULT(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_SYSCALL(_regs) (_regs).gpr[0]
-+#define SECCOMP_PT_IP(_regs) (_regs).nip
-+#define SECCOMP_PT_PARM1(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_PARM2(_regs) (_regs).gpr[4]
-+#define SECCOMP_PT_PARM3(_regs) (_regs).gpr[5]
-+#define SECCOMP_PT_PARM4(_regs) (_regs).gpr[6]
-+#define SECCOMP_PT_PARM5(_regs) (_regs).gpr[7]
-+#define SECCOMP_PT_PARM6(_regs) (_regs).gpr[8]
-+
- #else
- #error Unsupported target platform
-
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-index 6a1ec2389..f20c582dd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-@@ -88,7 +88,8 @@ bool IsBaselinePolicyWatched(int sysno) {
- SyscallSets::IsPrctl(sysno) ||
- SyscallSets::IsProcessGroupOrSession(sysno) ||
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- SyscallSets::IsSocketCall(sysno) ||
- #endif
- #if defined(__arm__)
-@@ -227,7 +228,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_mmap)
- return RestrictMmapFlags();
- #endif
-@@ -245,7 +246,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- return RestrictPrctl();
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_socketpair) {
- // Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen.
- static_assert(AF_UNIX == PF_UNIX,
-@@ -285,7 +286,8 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- if (SyscallSets::IsSocketCall(sysno))
- return RestrictSocketcallCommand();
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:11:10.481579470 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:12:43.524831376 -0400
-@@ -302,7 +302,7 @@
- TEST_BASELINE_SIGSYS(__NR_syslog)
- TEST_BASELINE_SIGSYS(__NR_timer_create)
-
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- TEST_BASELINE_SIGSYS(__NR_inotify_init)
- TEST_BASELINE_SIGSYS(__NR_vserver)
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-@@ -358,7 +358,16 @@
- if (args.nr == __NR_fstatat_default) {
- if (*reinterpret_cast<const char*>(args.args[1]) == '\0' &&
- args.args[3] == static_cast<uint64_t>(AT_EMPTY_PATH)) {
-- return syscall(__NR_fstat_default, static_cast<int>(args.args[0]),
-+ int fd = static_cast<int>(args.args[0]);
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO: Investigate the root cause and fix in glibc
-+ if (fd < 0)
-+ fd = -fd;
-+#endif
-+ return syscall(__NR_fstat_default, fd,
- reinterpret_cast<default_stat_struct*>(args.args[2]));
- }
- return -reinterpret_cast<intptr_t>(fs_denied_errno);
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
-index 2a97d3916..8e81aa6cf 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-14 14:41:08.000000000 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-15 13:17:57.808715733 -0400
-@@ -37,7 +37,8 @@
-
- #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
- !defined(__arm__) && !defined(__aarch64__) && \
-- !defined(PTRACE_GET_THREAD_AREA)
-+ !defined(PTRACE_GET_THREAD_AREA) && \
-+ !defined(__powerpc64__)
- // Also include asm/ptrace-abi.h since ptrace.h in older libc (for instance
- // the one in Ubuntu 16.04 LTS) is missing PTRACE_GET_THREAD_AREA.
- // asm/ptrace-abi.h doesn't exist on arm32 and PTRACE_GET_THREAD_AREA isn't
-@@ -45,6 +46,11 @@
- #include <asm/ptrace-abi.h>
- #endif
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- #if BUILDFLAG(IS_ANDROID)
-
- #if !defined(F_DUPFD_CLOEXEC)
-@@ -99,6 +105,14 @@
- return true;
- #else
- return false;
-+#endif
-+}
-+
-+inline bool IsArchitecturePPC64() {
-+#if defined(__powerpc64__)
-+ return true;
-+#else
-+ return false;
- #endif
- }
-
-@@ -239,6 +254,8 @@
- uint64_t kOLargeFileFlag = O_LARGEFILE;
- if (IsArchitectureX86_64() || IsArchitectureI386() || IsArchitectureMips())
- kOLargeFileFlag = 0100000;
-+ else if (IsArchitecturePPC64())
-+ kOLargeFileFlag = 0200000;
-
- const Arg<int> cmd(1);
- const Arg<long> long_arg(2);
-@@ -256,7 +273,16 @@
- F_SETLKW,
- F_GETLK,
- F_DUPFD,
-- F_DUPFD_CLOEXEC),
-+ F_DUPFD_CLOEXEC
-+#if defined(__powerpc64__)
-+// On PPC64, F_SETLK, F_GETLK, F_SETLKW are defined as the 64-bit variants
-+// but glibc will sometimes still use the 32-bit versions. Allow both.
-+ ,
-+ 5, /* F_GETLK (32) */
-+ 6, /* F_SETLK (32) */
-+ 7 /* F_SETLKW (32) */
-+#endif
-+ ),
- Allow())
- .Case(F_SETFL,
- If((long_arg & ~kAllowedMask) == 0, Allow()).Else(CrashSIGSYS()))
-@@ -266,7 +292,7 @@
- // clang-format on
- }
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- ResultExpr RestrictSocketcallCommand() {
- // Unfortunately, we are unable to restrict the first parameter to
- // socketpair(2). Whilst initially sounding bad, it's noteworthy that very
-@@ -419,7 +445,7 @@
- #endif
- return Switch(request)
- .CASES((
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- PTRACE_GETREGS, PTRACE_GETFPREGS, PTRACE_GET_THREAD_AREA,
- PTRACE_GETREGSET,
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-index ba4289f05..9a4d5ab2d 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-@@ -48,7 +48,7 @@ SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictMprotectFlags();
- // O_NONBLOCK | O_SYNC | O_LARGEFILE | O_CLOEXEC | O_NOATIME.
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictFcntlCommands();
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- // Restrict socketcall(2) to only allow socketpair(2), send(2), recv(2),
- // sendto(2), recvfrom(2), shutdown(2), sendmsg(2) and recvmsg(2).
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictSocketcallCommand();
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-index 642df7207..34f47eb73 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-@@ -29,7 +29,8 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- switch (sysno) {
- case __NR_gettimeofday:
- #if defined(__i386__) || defined(__x86_64__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_time:
- #endif
- return true;
-@@ -52,12 +53,14 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- case __NR_clock_nanosleep_time64: // Parameters filtered by RestrictClockID().
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ftime: // Obsolete.
- #endif
- case __NR_settimeofday: // Privileged.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stime:
- #endif
- default:
-@@ -135,7 +138,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_faccessat: // EPERM not a valid errno.
- case __NR_fchmodat:
- case __NR_fchownat: // Should be called chownat ?
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat: // fstatat(). EPERM not a valid errno.
- #elif defined(__i386__) || defined(__arm__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-@@ -154,7 +157,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_memfd_create:
- case __NR_mkdirat:
- case __NR_mknodat:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldlstat:
- case __NR_oldstat:
- #endif
-@@ -168,7 +171,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- #endif
- case __NR_statfs: // EPERM not a valid errno.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_statfs64:
- #endif
- case __NR_symlinkat:
-@@ -178,7 +182,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_truncate64:
- #endif
- case __NR_unlinkat:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_utime:
- #endif
- case __NR_utimensat: // New.
-@@ -203,7 +208,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- #endif
- return true;
- // TODO(jln): these should be denied gracefully as well (moved below).
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_fadvise64: // EPERM not a valid errno.
- #endif
- #if defined(__i386__)
-@@ -216,11 +222,12 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_flock: // EPERM not a valid errno.
- case __NR_fstatfs: // Give information about the whole filesystem.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_fstatfs64:
- #endif
- case __NR_fsync: // EPERM not a valid errno.
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldfstat:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-@@ -228,6 +235,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_sync_file_range: // EPERM not a valid errno.
- #elif defined(__arm__)
- case __NR_arm_sync_file_range: // EPERM not a valid errno.
-+#elif defined(__powerpc64__)
-+ case __NR_sync_file_range2: // EPERM not a valid errno.
- #endif
- default:
- return false;
-@@ -248,7 +257,8 @@ bool SyscallSets::IsDeniedFileSystemAccessViaFd(int sysno) {
- #endif
- case __NR_getdents64: // EPERM not a valid errno.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_readdir:
- #endif
- return true;
-@@ -289,7 +299,7 @@ bool SyscallSets::IsGetSimpleId(int sysno) {
- bool SyscallSets::IsProcessPrivilegeChange(int sysno) {
- switch (sysno) {
- case __NR_capset:
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_ioperm: // Intel privilege.
- case __NR_iopl: // Intel privilege.
- #endif
-@@ -340,8 +350,11 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- case __NR_rt_sigreturn:
- case __NR_rt_sigtimedwait:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
-+#ifndef __powerpc64__
- case __NR_rt_sigtimedwait_time64:
-+#endif
- case __NR_sigaction:
- case __NR_sigprocmask:
- case __NR_sigreturn:
-@@ -357,7 +370,8 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- #endif
- case __NR_signalfd4:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_sigpending:
- case __NR_sigsuspend:
- #endif
-@@ -381,7 +395,7 @@ bool SyscallSets::IsAllowedOperationOnFd(int sysno) {
- #endif
- case __NR_dup3:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_shutdown:
- #endif
- return true;
-@@ -414,7 +428,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- case __NR_exit_group:
- case __NR_wait4:
- case __NR_waitid:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_waitpid:
- #endif
- return true;
-@@ -431,7 +445,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- #endif
- case __NR_set_tid_address:
- case __NR_unshare:
--#if !defined(__mips__) && !defined(__aarch64__)
-+#if !defined(__mips__) && !defined(__aarch64__) || defined(__powerpc64__)
- case __NR_vfork:
- #endif
- default:
-@@ -484,7 +498,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- return true;
- default:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_socketpair: // We will want to inspect its argument.
- #endif
- return false;
-@@ -494,7 +508,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- switch (sysno) {
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_accept:
- case __NR_accept4:
- case __NR_bind:
-@@ -509,7 +523,8 @@ bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- bool SyscallSets::IsSocketCall(int sysno) {
- switch (sysno) {
-@@ -523,7 +538,8 @@ bool SyscallSets::IsSocketCall(int sysno) {
- }
- #endif
-
--#if defined(__x86_64__) || defined(__arm__) || defined(__mips__)
-+#if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- bool SyscallSets::IsNetworkSocketInformation(int sysno) {
- switch (sysno) {
- case __NR_getpeername:
-@@ -548,7 +564,7 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
- case __NR_mincore:
- case __NR_mlockall:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_mmap:
- #endif
- #if defined(__i386__) || defined(__arm__) || \
-@@ -578,7 +594,8 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- switch (sysno) {
- case __NR_lseek:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR__llseek:
- #endif
- #if !defined(__aarch64__)
-@@ -598,26 +615,28 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- case __NR_readv:
- case __NR_pread64:
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_recv:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_recvfrom: // Could specify source.
- case __NR_recvmsg: // Could specify source.
- #endif
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_select:
- #endif
--#if defined(__i386__) || defined(__arm__) || defined(__mips__)
-+#if defined(__i386__) || defined(__arm__) || defined(__mips__) || defined(__powerpc64__)
- case __NR__newselect:
- #endif
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_send:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_sendmsg: // Could specify destination.
- case __NR_sendto: // Could specify destination.
- #endif
-@@ -673,7 +692,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- return true;
- case __NR_getpriority:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_nice:
- #endif
- case __NR_setpriority:
-@@ -685,7 +705,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- bool SyscallSets::IsAdminOperation(int sysno) {
- switch (sysno) {
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_bdflush:
- #endif
- case __NR_kexec_load:
-@@ -701,7 +722,8 @@ bool SyscallSets::IsAdminOperation(int sysno) {
-
- bool SyscallSets::IsKernelModule(int sysno) {
- switch (sysno) {
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_create_module:
- case __NR_get_kernel_syms: // Should ENOSYS.
- case __NR_query_module:
-@@ -734,7 +756,8 @@ bool SyscallSets::IsFsControl(int sysno) {
- case __NR_swapoff:
- case __NR_swapon:
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_umount:
- #endif
- case __NR_umount2:
-@@ -750,7 +773,7 @@ bool SyscallSets::IsNuma(int sysno) {
- case __NR_getcpu:
- case __NR_mbind:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_migrate_pages:
- #endif
- case __NR_move_pages:
-@@ -785,14 +808,15 @@ bool SyscallSets::IsGlobalProcessEnvironment(int sysno) {
- switch (sysno) {
- case __NR_acct: // Privileged.
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
--#if defined(__i386__) || defined(__arm__)
-+#if defined(__i386__) || defined(__arm__) || defined(__powerpc64__)
- case __NR_ugetrlimit:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ulimit:
- #endif
- case __NR_getrusage:
-@@ -826,7 +850,7 @@ bool SyscallSets::IsGlobalSystemStatus(int sysno) {
- #endif
- case __NR_sysinfo:
- case __NR_uname:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_olduname:
- case __NR_oldolduname:
- #endif
-@@ -892,8 +916,16 @@ bool SyscallSets::IsSystemVSemaphores(int sysno) {
- }
- #endif
-
-+/* shitty hack around Void's 4.19 kernel headers missing those numbers */
-+#if defined(__powerpc64__) && !defined(__NR_shmget)
-+#define __NR_shmget 395
-+#define __NR_shmctl 396
-+#define __NR_shmat 397
-+#define __NR_shmdt 398
-+#endif
-+
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- bool SyscallSets::IsSystemVSharedMemory(int sysno) {
-@@ -925,7 +957,8 @@ bool SyscallSets::IsSystemVMessageQueue(int sysno) {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- bool SyscallSets::IsSystemVIpc(int sysno) {
- switch (sysno) {
-@@ -945,7 +978,8 @@ bool SyscallSets::IsAnySystemV(int sysno) {
- return IsSystemVMessageQueue(sysno) || IsSystemVSemaphores(sysno) ||
- IsSystemVSharedMemory(sysno);
- #elif defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- return IsSystemVIpc(sysno);
- #endif
- }
-@@ -1002,7 +1036,8 @@ bool SyscallSets::IsFaNotify(int sysno) {
- bool SyscallSets::IsTimer(int sysno) {
- switch (sysno) {
- case __NR_getitimer:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_alarm:
- #endif
- case __NR_setitimer:
-@@ -1084,18 +1119,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_syncfs:
- case __NR_vhangup:
- // The system calls below are not implemented.
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_afs_syscall:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_break:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_getpmsg:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_gtty:
- case __NR_idle:
- case __NR_lock:
-@@ -1103,20 +1142,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_prof:
- case __NR_profil:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_putpmsg:
- #endif
- #if defined(__x86_64__)
- case __NR_security:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stty:
- #endif
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- case __NR_tuxcall:
- #endif
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- case __NR_vserver:
- #endif
- return true;
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-index 923533ec9..411f72acd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-@@ -43,13 +43,14 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsDeniedGetOrModifySocket(int sysno);
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- static bool IsSocketCall(int sysno);
- #endif
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- static bool IsNetworkSocketInformation(int sysno);
- #endif
-
-@@ -76,7 +77,7 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsSystemVSemaphores(int sysno);
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- static bool IsSystemVSharedMemory(int sysno);
-@@ -88,7 +89,8 @@ class SANDBOX_EXPORT SyscallSets {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- static bool IsSystemVIpc(int sysno);
- #endif
-diff --git a/sandbox/linux/seccomp-bpf/syscall.cc b/sandbox/linux/seccomp-bpf/syscall.cc
-index e47e98bf5..d53a7ff56 100644
---- a/sandbox/linux/seccomp-bpf/syscall.cc
-+++ b/sandbox/linux/seccomp-bpf/syscall.cc
-@@ -18,7 +18,7 @@ namespace sandbox {
- namespace {
-
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined (ARCH_CPU_PPC64_FAMILY)
- // Number that's not currently used by any Linux kernel ABIs.
- const int kInvalidSyscallNumber = 0x351d3;
- #else
-@@ -310,12 +310,56 @@ asm(// We need to be able to tell the kernel exactly where we made a
- // Enter the kernel
- "svc 0\n"
- "2:ret\n"
-+ ".cfi_endproc\n"
-+ ".size SyscallAsm, .-SyscallAsm\n"
-+#elif defined(__powerpc64__)
-+ ".text\n"
-+ ".align 4\n"
-+ ".type SyscallAsm @function\n"
-+ "SyscallAsm:\n"
-+ ".cfi_startproc\n"
-+
-+ // Check if r3 is negative
-+ "cmpdi 3, 0\n"
-+ "bgt 2f\n"
-+
-+ // Load address of 3f into r3 and return
-+ "mflr 10\n"
-+ "bl 1f\n"
-+ "1: mflr 3\n"
-+ "mtlr 10\n"
-+ "addi 3, 3, 4*13\n"
-+ "blr\n"
-+
-+ // Load arguments from array into r3-8
-+ // save param 3 in r10
-+ "2:\n"
-+ "mr 0, 3\n"
-+ "ld 3, 0(4)\n"
-+ "ld 5, 16(4)\n"
-+ "ld 6, 24(4)\n"
-+ "ld 7, 32(4)\n"
-+ "ld 8, 40(4)\n"
-+ "ld 4, 8(4)\n"
-+ "li 9, 0\n"
-+
-+ // Enter kernel
-+ "sc\n"
-+
-+ // Magic return address
-+ "3:\n"
-+ // Like MIPS, ppc64 return values are always positive.
-+ // Check for error in cr0.SO and negate upon error
-+ "bc 4, 3, 4f\n"
-+ "neg 3, 3\n"
-+ "4: blr\n"
-+
- ".cfi_endproc\n"
- ".size SyscallAsm, .-SyscallAsm\n"
- #endif
- ); // asm
-
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- extern "C" {
- intptr_t SyscallAsm(intptr_t nr, const intptr_t args[6]);
- }
-@@ -429,6 +473,8 @@ intptr_t Syscall::Call(int nr,
- ret = inout;
- }
-
-+#elif defined(__powerpc64__)
-+ intptr_t ret = SyscallAsm(nr, args);
- #else
- #error "Unimplemented architecture"
- #endif
-@@ -445,8 +491,18 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // needs to be changed back.
- ret_val = -ret_val;
- SECCOMP_PARM4(ctx) = 1;
-- } else
-+ } else {
- SECCOMP_PARM4(ctx) = 0;
-+ }
-+#endif
-+#if defined(__powerpc64__)
-+ // Same as MIPS, need to invert ret and set error register (cr0.SO)
-+ if (ret_val <= -1 && ret_val >= -4095) {
-+ ret_val = -ret_val;
-+ ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ } else {
-+ ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
- }
-diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc
-index f5b86a73a..5e6c4a068 100644
---- a/sandbox/linux/seccomp-bpf/trap.cc
-+++ b/sandbox/linux/seccomp-bpf/trap.cc
-@@ -232,6 +232,20 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
- SetIsInSigHandler();
- }
-
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO(shawn@anastas.io): investigate this issue further
-+ auto nr = SECCOMP_SYSCALL(ctx);
-+ if (nr == __NR_openat || nr == __NR_mkdirat || nr == __NR_faccessat || nr == __NR_readlinkat ||
-+ nr == __NR_renameat || nr == __NR_renameat2 || nr == __NR_newfstatat || nr == __NR_unlinkat) {
-+ if (static_cast<int>(SECCOMP_PARM1(ctx)) > 0) {
-+ SECCOMP_PARM1(ctx) = -SECCOMP_PARM1(ctx);
-+ }
-+ }
-+#endif
-+
- // Copy the seccomp-specific data into a arch_seccomp_data structure. This
- // is what we are showing to TrapFnc callbacks that the system call
- // evaluator registered with the sandbox.
-diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc
-index d7b5d8c44..4adc6d0d4 100644
---- a/sandbox/linux/services/credentials.cc
-+++ b/sandbox/linux/services/credentials.cc
-@@ -81,7 +81,7 @@ bool ChrootToSafeEmptyDir() {
- pid_t pid = -1;
- alignas(16) char stack_buf[PTHREAD_STACK_MIN];
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // The stack grows downward.
- void* stack = stack_buf + sizeof(stack_buf);
- #else
-@@ -90,7 +90,9 @@
-
- int clone_flags = CLONE_FS | LINUX_SIGCHLD;
- void* tls = nullptr;
--#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
-+// RAJA this might be it...
-+#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY) || \
-+ defined(ARCH_CPU_PPC64_FAMILY)) && \
- !defined(MEMORY_SANITIZER)
- // Use CLONE_VM | CLONE_VFORK as an optimization to avoid copying page tables.
- // Since clone writes to the new child's TLS before returning, we must set a
-@@ -98,6 +100,11 @@
- // glibc performs syscalls by calling a function pointer in TLS, so we do not
- // attempt this optimization.
- // TODO(crbug.com/1247458) Broken in MSan builds after LLVM f1bb30a4956f.
-+ //
-+ // NOTE: Without CLONE_VM, fontconfig will attempt to reload configuration
-+ // in every thread. Since the rendered threads are sandboxed without
-+ // filesystem access (e.g. to /etc/fonts/fonts.conf) this will cause font
-+ // configuraiton loading failures and no fonts will be displayed!
- clone_flags |= CLONE_VM | CLONE_VFORK | CLONE_SETTLS;
-
- char tls_buf[PTHREAD_STACK_MIN] = {0};
-diff --git a/sandbox/linux/services/syscall_wrappers.cc b/sandbox/linux/services/syscall_wrappers.cc
-index fcfd2aa12..f6eb32fb7 100644
---- a/sandbox/linux/services/syscall_wrappers.cc
-+++ b/sandbox/linux/services/syscall_wrappers.cc
-@@ -58,7 +58,7 @@ long sys_clone(unsigned long flags,
- #if defined(ARCH_CPU_X86_64)
- return syscall(__NR_clone, flags, child_stack, ptid, ctid, tls);
- #elif defined(ARCH_CPU_X86) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // CONFIG_CLONE_BACKWARDS defined.
- return syscall(__NR_clone, flags, child_stack, ptid, tls, ctid);
- #endif
-diff --git a/sandbox/linux/syscall_broker/broker_process.cc b/sandbox/linux/syscall_broker/broker_process.cc
-index d72c9d238..77f1d95f5 100644
---- a/sandbox/linux/syscall_broker/broker_process.cc
-+++ b/sandbox/linux/syscall_broker/broker_process.cc
-@@ -169,7 +169,7 @@ bool BrokerProcess::IsSyscallBrokerable(int sysno, bool fast_check) const {
- #if defined(__NR_fstatat64)
- case __NR_fstatat64:
- #endif
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat:
- #endif
- return !fast_check || allowed_command_set_.test(COMMAND_STAT);
-diff --git a/sandbox/linux/system_headers/linux_seccomp.h b/sandbox/linux/system_headers/linux_seccomp.h
-index 1fa47ed09..39cc9ab53 100644
---- a/sandbox/linux/system_headers/linux_seccomp.h
-+++ b/sandbox/linux/system_headers/linux_seccomp.h
-@@ -41,6 +41,9 @@
- #ifndef EM_AARCH64
- #define EM_AARCH64 183
- #endif
-+#ifndef EM_PPC64
-+#define EM_PPC64 21
-+#endif
-
- #ifndef __AUDIT_ARCH_64BIT
- #define __AUDIT_ARCH_64BIT 0x80000000
-@@ -73,6 +76,12 @@
- #ifndef AUDIT_ARCH_AARCH64
- #define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
- #endif
-+#ifndef AUDIT_ARCH_PPC64
-+#define AUDIT_ARCH_PPC64 (EM_PPC64 | __AUDIT_ARCH_64BIT)
-+#endif
-+#ifndef AUDIT_ARCH_PPC64LE
-+#define AUDIT_ARCH_PPC64LE (EM_PPC64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
-+#endif
-
- // For prctl.h
- #ifndef PR_SET_SECCOMP
-diff --git a/sandbox/linux/system_headers/linux_signal.h b/sandbox/linux/system_headers/linux_signal.h
-index f5a736761..515b21a5f 100644
---- a/sandbox/linux/system_headers/linux_signal.h
-+++ b/sandbox/linux/system_headers/linux_signal.h
-@@ -13,7 +13,7 @@
- // (not undefined, but defined different values and in different memory
- // layouts). So, fill the gap here.
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
-
- #define LINUX_SIGHUP 1
- #define LINUX_SIGINT 2
-diff --git a/sandbox/linux/system_headers/linux_syscalls.h b/sandbox/linux/system_headers/linux_syscalls.h
-index 2b78a0cc3..0a70f5ea5 100644
---- a/sandbox/linux/system_headers/linux_syscalls.h
-+++ b/sandbox/linux/system_headers/linux_syscalls.h
-@@ -35,5 +35,9 @@
- #include "sandbox/linux/system_headers/arm64_linux_syscalls.h"
- #endif
-
-+#if defined(__powerpc64__)
-+#include "sandbox/linux/system_headers/ppc64_linux_syscalls.h"
-+#endif
-+
- #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SYSCALLS_H_
-
-diff --git a/sandbox/linux/system_headers/ppc64_linux_syscalls.h b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-new file mode 100644
-index 000000000..ccacffe22
---- /dev/null
-+++ b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-@@ -0,0 +1,12 @@
-+// Copyright 2014 The Chromium Authors. All rights reserved.
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+#define SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+
-+#include <asm/unistd.h>
-+
-+//TODO: is it necessary to redefine syscall numbers for PPC64?
-+
-+#endif // SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-diff --git a/sandbox/policy/linux/bpf_utility_policy_linux.cc b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_utility_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-@@ -34,7 +34,7 @@
- case __NR_fdatasync:
- case __NR_fsync:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
- #if defined(__i386__) || defined(__arm__)
-diff --git a/sandbox/policy/linux/bpf_renderer_policy_linux.cc b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-@@ -15,6 +15,11 @@
- #include "sandbox/linux/system_headers/linux_syscalls.h"
- #include "sandbox/policy/linux/sandbox_linux.h"
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- // TODO(vignatti): replace the local definitions below with #include
- // <linux/dma-buf.h> once kernel version 4.6 becomes widely used.
- #include <linux/types.h>
-@@ -77,7 +77,7 @@
- case __NR_ftruncate64:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- case __NR_setrlimit:
- // We allow setrlimit to dynamically adjust the address space limit as
-diff --git a/third_party/angle/src/compiler/translator/InfoSink.h b/third_party/angle/src/compiler/translator/InfoSink.h
-index 3a807e1e3..5258617a7 100644
---- a/third_party/angle/src/compiler/translator/InfoSink.h
-+++ b/third_party/angle/src/compiler/translator/InfoSink.h
-@@ -92,7 +92,16 @@ class TInfoSinkBase
- stream.precision(8);
- stream << f;
- }
-- sink.append(stream.str());
-+
-+ // Hack to work around a bug where negative floating point values
-+ // are rendered like '.0.5' instead of '-0.5'
-+ std::string res(stream.str());
-+
-+ if (signbit(f)) { // test if f is negative
-+ res[0] = '-';
-+ }
-+
-+ sink.append(res);
- return *this;
- }
- // Write boolean values as their names instead of integral value.
-diff --git a/third_party/angle/src/libANGLE/Constants.h b/third_party/angle/src/libANGLE/Constants.h
-index fcbc9246a..39ae66148 100644
---- a/third_party/angle/src/libANGLE/Constants.h
-+++ b/third_party/angle/src/libANGLE/Constants.h
-@@ -9,6 +9,7 @@
- #ifndef LIBANGLE_CONSTANTS_H_
- #define LIBANGLE_CONSTANTS_H_
-
-+#include <cstddef>
- #include "common/platform.h"
-
- #include <stdint.h>
-diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
-index 17cf9cda9..8ce96bd32 100644
---- a/third_party/boringssl/BUILD.gn
-+++ b/third_party/boringssl/BUILD.gn
-@@ -103,6 +103,13 @@ if (is_win && !is_msan && current_cpu != "arm64") {
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-+ } else if (current_cpu == "ppc64") {
-+ if (is_linux) {
-+ # TODO: ppc64 (be) check
-+ sources += crypto_sources_linux_ppc64le
-+ } else {
-+ public_configs = [ ":no_asm_config" ]
-+ }
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-diff --git a/third_party/breakpad/BUILD.gn b/third_party/breakpad/BUILD.gn
-index 4af3d7bbf..adbf54159 100644
---- a/third_party/breakpad/BUILD.gn
-+++ b/third_party/breakpad/BUILD.gn
-@@ -596,7 +596,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/minidump_file_writer.h",
- "breakpad/src/common/convert_UTF.cc",
- "breakpad/src/common/convert_UTF.h",
-- "breakpad/src/common/linux/breakpad_getcontext.S",
- "breakpad/src/common/linux/elf_core_dump.cc",
- "breakpad/src/common/linux/elf_core_dump.h",
- "breakpad/src/common/linux/elfutils.cc",
-@@ -634,6 +633,14 @@ if (is_linux || is_chromeos || is_android) {
-
- libs = [ "dl" ]
-
-+ if (current_cpu == "ppc64") {
-+ defines = [ "HAVE_GETCONTEXT" ]
-+ } else {
-+ sources += [
-+ "breakpad/src/common/linux/breakpad_getcontext.S"
-+ ]
-+ }
-+
- include_dirs = [
- ".",
- "breakpad/src",
-@@ -682,7 +689,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc",
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
- "breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
-- "breakpad/src/common/linux/breakpad_getcontext_unittest.cc",
- "breakpad/src/common/linux/elf_core_dump_unittest.cc",
- "breakpad/src/common/linux/file_id_unittest.cc",
- "breakpad/src/common/linux/linux_libc_support_unittest.cc",
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-index 07d9171a0..9aed4cb36 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-@@ -44,6 +44,8 @@ typedef MDRawContextARM RawContextCPU;
- typedef MDRawContextARM64_Old RawContextCPU;
- #elif defined(__mips__)
- typedef MDRawContextMIPS RawContextCPU;
-+#elif defined(__powerpc64__)
-+typedef MDRawContextPPC64 RawContextCPU;
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index aae1dc13b..03afec7a5 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -270,7 +270,42 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->float_save.fir = mcontext.fpc_eir;
- #endif
- }
--#endif // __mips__
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t ThreadInfo::GetInstructionPointer() const {
-+ return mcontext.gp_regs[PT_NIP];
-+}
-+
-+void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = mcontext.gp_regs[i];
-+
-+ out->lr = mcontext.gp_regs[PT_LNK];
-+ out->srr0 = mcontext.gp_regs[PT_NIP];
-+ out->srr1 = mcontext.gp_regs[PT_MSR];
-+ out->cr = mcontext.gp_regs[PT_CCR];
-+ out->xer = mcontext.gp_regs[PT_XER];
-+ out->ctr = mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] = \
-+ {(((uint64_t)vregs.vrregs[i][0]) << 32)
-+ | vregs.vrregs[i][1],
-+ (((uint64_t)vregs.vrregs[i][2]) << 32)
-+ | vregs.vrregs[i][3]};
-+
-+ out->vrsave = vregs.vrsave;
-+ out->vector_save.save_vscr = {0, vregs.vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+#endif // __powerpc64__
-
- void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- assert(gp_regs || size);
-@@ -279,6 +314,11 @@ void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- *gp_regs = mcontext.gregs;
- if (size)
- *size = sizeof(mcontext.gregs);
-+#elif defined(__powerpc64__)
-+ if (gp_regs)
-+ *gp_regs = mcontext.gp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.gp_regs);
- #else
- if (gp_regs)
- *gp_regs = ®s;
-@@ -294,6 +334,11 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- *fp_regs = &mcontext.fpregs;
- if (size)
- *size = sizeof(mcontext.fpregs);
-+#elif defined(__powerpc64__)
-+ if (fp_regs)
-+ *fp_regs = &mcontext.fp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.fp_regs);
- #else
- if (fp_regs)
- *fp_regs = &fpregs;
-@@ -302,4 +347,13 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- #endif
- }
-
-+#if defined(__powerpc64__)
-+void ThreadInfo::GetVectorRegisters(void** v_regs, size_t* size) {
-+ if (v_regs)
-+ *v_regs = &vregs;
-+ if (size)
-+ *size = sizeof(vregs);
-+}
-+#endif
-+
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-index fb216fa6d..593aac822 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-@@ -68,6 +68,10 @@ struct ThreadInfo {
- // Use the structures defined in <sys/user.h>
- struct user_regs_struct regs;
- struct user_fpsimd_struct fpregs;
-+#elif defined(__powerpc64__)
-+ // Use the structures defined in <sys/ucontext.h>.
-+ mcontext_t mcontext;
-+ vrregset_t vregs;
- #elif defined(__mips__)
- // Use the structure defined in <sys/ucontext.h>.
- mcontext_t mcontext;
-@@ -84,6 +88,11 @@ struct ThreadInfo {
-
- // Returns the pointer and size of float point register area.
- void GetFloatingPointRegisters(void** fp_regs, size_t* size);
-+
-+#if defined(__powerpc64__)
-+ // Returns the pointer and size of the vector register area. (PPC64 only)
-+ void GetVectorRegisters(void** v_regs, size_t* size);
-+#endif
- };
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 6eec1be24..741983a1a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -254,6 +254,48 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc) {
- out->float_save.fir = uc->uc_mcontext.fpc_eir; // Unused.
- #endif
- }
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
-+}
-+
-+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[PT_NIP];
-+}
-+
-+void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
-+ const vrregset_t* vregs) {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = uc->uc_mcontext.gp_regs[i];
-+
-+ out->lr = uc->uc_mcontext.gp_regs[PT_LNK];
-+ out->srr0 = uc->uc_mcontext.gp_regs[PT_NIP];
-+ out->srr1 = uc->uc_mcontext.gp_regs[PT_MSR];
-+ out->cr = uc->uc_mcontext.gp_regs[PT_CCR];
-+ out->xer = uc->uc_mcontext.gp_regs[PT_XER];
-+ out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] =
-+ {(((uint64_t)vregs->vrregs[i][0]) << 32)
-+ | vregs->vrregs[i][1],
-+ (((uint64_t)vregs->vrregs[i][2]) << 32)
-+ | vregs->vrregs[i][3]};
-+
-+ out->vrsave = vregs->vrsave;
-+ out->vector_save.save_vscr = {0, vregs->vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+
- #endif
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-index 7d4100881..c122ac92e 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-@@ -55,6 +55,9 @@ struct UContextReader {
- #elif defined(__aarch64__)
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- const struct fpsimd_context* fpregs);
-+#elif defined(__powerpc64__)
-+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
-+ const vrregset_t* vregs);
- #else
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc);
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index a6cb5f984..ae16b64d9 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -461,9 +461,16 @@ bool ExceptionHandler::HandleSignal(int /*sig*/, siginfo_t* info, void* uc) {
- memcpy(&g_crash_context_.float_state, fp_ptr,
- sizeof(g_crash_context_.float_state));
- }
-+#elif defined(__powerpc64__)
-+ // On PPC64, we must copy VR state
-+ ucontext_t* uc_ptr = (ucontext_t*)uc;
-+ if (uc_ptr->uc_mcontext.v_regs) {
-+ memcpy(&g_crash_context_.vector_state, uc_ptr->uc_mcontext.v_regs,
-+ sizeof(g_crash_context_.vector_state));
-+ }
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- // FP state is not part of user ABI on ARM Linux.
-- // In case of MIPS Linux FP state is already part of ucontext_t
-+ // In case of MIPS, Linux FP state is already part of ucontext_t
- // and 'float_state' is not a member of CrashContext.
- ucontext_t* uc_ptr = (ucontext_t*)uc;
- if (uc_ptr->uc_mcontext.fpregs) {
-@@ -708,11 +715,19 @@ bool ExceptionHandler::WriteMinidump() {
- }
- #endif
-
--#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__)
-+#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__) \
-+ && !defined(__powerpc64__)
- // FPU state is not part of ARM EABI ucontext_t.
- memcpy(&context.float_state, context.context.uc_mcontext.fpregs,
- sizeof(context.float_state));
- #endif
-+
-+#if defined(__powerpc64__)
-+ // Vector registers must be copied on PPC64
-+ memcpy(&context.vector_state, context.context.uc_mcontext.v_regs,
-+ sizeof(context.vector_state));
-+#endif
-+
- context.tid = sys_gettid();
-
- // Add an exception stream to the minidump for better reporting.
-@@ -733,6 +748,9 @@ bool ExceptionHandler::WriteMinidump() {
- #elif defined(__mips__)
- context.siginfo.si_addr =
- reinterpret_cast<void*>(context.context.uc_mcontext.pc);
-+#elif defined(__powerpc64__)
-+ context.siginfo.si_addr =
-+ reinterpret_cast<void*>(context.context.uc_mcontext.gp_regs[PT_NIP]);
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-index f80843ea7..260dd10f7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-@@ -192,7 +192,11 @@ class ExceptionHandler {
- siginfo_t siginfo;
- pid_t tid; // the crashing thread.
- ucontext_t context;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ // PPC64's FP state is a part of ucontext_t like MIPS but the vector
-+ // state is not, so a struct is needed.
-+ vstate_t vector_state;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- // #ifdef this out because FP state is not part of user ABI for Linux ARM.
- // In case of MIPS Linux FP state is already part of ucontext_t so
- // 'float_state' is not required.
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-index 35dcbfd4d..7934370fd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-@@ -307,7 +307,7 @@ TEST(ExceptionHandlerTest, ParallelChildCrashesDontHang) {
- }
-
- // Wait a while until the child should have crashed.
-- usleep(1000000);
-+ usleep(2000000);
- // Kill the child if it is still running.
- kill(child, SIGKILL);
-
-@@ -559,6 +559,8 @@ const unsigned char kIllegalInstruction[] = {
- #if defined(__mips__)
- // mfc2 zero,Impl - usually illegal in userspace.
- 0x48, 0x00, 0x00, 0x48
-+#elif defined(__powerpc64__)
-+ 0x01, 0x01, 0x01, 0x01 // Crashes on a tested POWER9 cpu
- #else
- // This crashes with SIGILL on x86/x86-64/arm.
- 0xff, 0xff, 0xff, 0xff
-@@ -754,10 +756,10 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
-
- // These are defined here so the parent can use them to check the
- // data from the minidump afterwards.
-- // Use 4k here because the OS will hand out a single page even
-+ // Use the page size here because the OS will hand out a single page even
- // if a smaller size is requested, and this test wants to
- // test the upper bound of the memory range.
-- const uint32_t kMemorySize = 4096; // bytes
-+ const uint32_t kMemorySize = getpagesize(); // bytes
- const int kOffset = kMemorySize - sizeof(kIllegalInstruction);
-
- const pid_t child = fork();
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-index fa3c1713a..6ce709e2f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-@@ -138,7 +138,9 @@ class MicrodumpWriter {
- const MicrodumpExtraInfo& microdump_extra_info,
- LinuxDumper* dumper)
- : ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -337,6 +339,8 @@ class MicrodumpWriter {
- # else
- # error "This mips ABI is currently not supported (n32)"
- #endif
-+#elif defined(__powerpc64__)
-+ const char kArch[] = "ppc64";
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -409,7 +413,9 @@ class MicrodumpWriter {
- void DumpCPUState() {
- RawContextCPU cpu;
- my_memset(&cpu, 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(&cpu, ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(&cpu, ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(&cpu, ucontext_);
-@@ -605,7 +611,9 @@ class MicrodumpWriter {
- void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); }
-
- const ucontext_t* const ucontext_;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_;
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-index 6339ac0cd..291af106b 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-@@ -279,10 +279,19 @@ TEST(MicrodumpWriterTest, BasicWithMappings) {
- CrashAndGetMicrodump(mappings, MicrodumpExtraInfo(), &buf);
- ASSERT_TRUE(ContainsMicrodump(buf));
-
-+ int page_size = getpagesize();
- #ifdef __LP64__
-- ASSERT_NE(std::string::npos,
-- buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-- "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ // This test is only available for the following page sizes
-+ ASSERT_TRUE((page_size == 4096) || (page_size == 65536));
-+ if (page_size == 4096) {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ } else {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000010000 000000000000002A 0000000000010000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ }
- #else
- ASSERT_NE(std::string::npos,
- buf.find("M 00001000 0000002A 00001000 "
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-index 415068983..b93e4afcf 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-@@ -112,6 +112,9 @@ bool LinuxCoreDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-@@ -197,7 +200,10 @@ bool LinuxCoreDumper::EnumerateThreads() {
- memset(&info, 0, sizeof(ThreadInfo));
- info.tgid = status->pr_pgrp;
- info.ppid = status->pr_ppid;
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ for (int i = 0; i < 31; i++)
-+ info.mcontext.gp_regs[i] = status->pr_reg[i];
-+#elif defined(__mips__)
- #if defined(__ANDROID__)
- for (int i = EF_R0; i <= EF_R31; i++)
- info.mcontext.gregs[i - EF_R0] = status->pr_reg[i];
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-index 7fd6532ad..199cbfffd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-@@ -765,7 +765,9 @@ bool LinuxDumper::GetStackInfo(const void** stack, size_t* stack_len,
- reinterpret_cast<uint8_t*>(int_stack_pointer & ~(page_size - 1));
-
- // The number of bytes of stack which we try to capture.
-- static const ptrdiff_t kStackToCapture = 32 * 1024;
-+ // This now depends on page_size to avoid missing data
-+ // on systems with larger page sizes.
-+ static const ptrdiff_t kStackToCapture = 8 * page_size;
-
- const MappingInfo* mapping = FindMapping(stack_pointer);
- if (!mapping)
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-index 7bee160f1..07bb2b81a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-@@ -63,7 +63,8 @@ namespace google_breakpad {
- (defined(__mips__) && _MIPS_SIM == _ABIO32)
- typedef Elf32_auxv_t elf_aux_entry;
- #elif defined(__x86_64) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM != _ABIO32)
-+ (defined(__mips__) && _MIPS_SIM != _ABIO32) || \
-+ defined(__powerpc64__)
- typedef Elf64_auxv_t elf_aux_entry;
- #endif
-
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-index 331f4bb34..3f722947f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-@@ -51,6 +51,8 @@
- #define TID_PTR_REGISTER "rcx"
- #elif defined(__mips__)
- #define TID_PTR_REGISTER "$1"
-+#elif defined(__powerpc64__)
-+#define TID_PTR_REGISTER "r8"
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-index e3ddb81a6..fa28575ef 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-@@ -149,19 +149,27 @@ bool LinuxPtraceDumper::CopyFromProcess(void* dest, pid_t child,
- return true;
- }
-
--bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid)
--{
-+bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid) {
- #ifdef PTRACE_GETREGSET
- struct iovec io;
- info->GetGeneralPurposeRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
- return false;
- }
-
- info->GetFloatingPointRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
- return false;
- }
-+
-+#if defined(__powerpc64__)
-+ // Grab the vector registers on PPC64 too
-+ info->GetVectorRegisters(&io.iov_base, &io.iov_len);
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PPC_VMX, (void*)&io) == -1) {
-+ return false;
-+ }
-+#endif // defined(__powerpc64__)
-+
- return true;
- #else
- return false;
-@@ -298,6 +306,9 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-index da71e15dc..12bfb317a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-@@ -462,6 +462,9 @@ TEST(LinuxPtraceDumperTest, VerifyStackReadWithMultipleThreads) {
- #elif defined(__mips__)
- pid_t* process_tid_location =
- reinterpret_cast<pid_t*>(one_thread.mcontext.gregs[1]);
-+#elif defined(__powerpc64__)
-+ pid_t* process_tid_location =
-+ reinterpret_cast<pid_t*>(one_thread.mcontext.gp_regs[8]);
- #else
- #error This test has not been ported to this platform.
- #endif
-@@ -559,6 +562,8 @@ TEST_F(LinuxPtraceDumperTest, SanitizeStackCopy) {
- uintptr_t heap_addr = thread_info.regs.rcx;
- #elif defined(__mips__)
- uintptr_t heap_addr = thread_info.mcontext.gregs[1];
-+#elif defined(__powerpc64__)
-+ uintptr_t heap_addr = thread_info.mcontext.gp_regs[8];
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-index 32634ef00..2a56948de 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-@@ -136,7 +136,9 @@ class MinidumpWriter {
- : fd_(minidump_fd),
- path_(minidump_path),
- ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -468,7 +470,9 @@ class MinidumpWriter {
- if (!cpu.Allocate())
- return false;
- my_memset(cpu.get(), 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(cpu.get(), ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(cpu.get(), ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(cpu.get(), ucontext_);
-@@ -897,7 +901,7 @@ class MinidumpWriter {
- dirent->location.rva = 0;
- }
-
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || defined(__powerpc64__)
- bool WriteCPUInformation(MDRawSystemInfo* sys_info) {
- char vendor_id[sizeof(sys_info->cpu.x86_cpu_info.vendor_id) + 1] = {0};
- static const char vendor_id_name[] = "vendor_id";
-@@ -917,7 +921,9 @@ class MinidumpWriter {
-
- // processor_architecture should always be set, do this first
- sys_info->processor_architecture =
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ MD_CPU_ARCHITECTURE_PPC64;
-+#elif defined(__mips__)
- # if _MIPS_SIM == _ABIO32
- MD_CPU_ARCHITECTURE_MIPS;
- # elif _MIPS_SIM == _ABI64
-@@ -1333,7 +1339,9 @@ class MinidumpWriter {
- const char* path_; // Path to the file where the minidum should be written.
-
- const ucontext_t* const ucontext_; // also from the signal handler
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_; // ditto
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-index e3b0b16da..ccd8aa0a4 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-@@ -48,6 +48,8 @@ class ExceptionHandler;
-
- #if defined(__aarch64__)
- typedef struct fpsimd_context fpstate_t;
-+#elif defined(__powerpc64__)
-+typedef vrregset_t vstate_t;
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- typedef std::remove_pointer<fpregset_t>::type fpstate_t;
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-index d192e5cbb..fc1bfa8d7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-@@ -715,6 +715,9 @@ TEST(MinidumpWriterTest, InvalidStackPointer) {
- #elif defined(__mips__)
- context.context.uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP] =
- invalid_stack_pointer;
-+#elif defined(__powerpc64__)
-+ context.context.uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP] =
-+ invalid_stack_pointer;
- #else
- # error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-index 99362945c..c54ba7145 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-@@ -65,8 +65,7 @@ bool MemoryMappedFile::Map(const char* path, size_t offset) {
- }
-
- #if defined(__x86_64__) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM == _ABI64)
--
-+ (defined(__mips__) && _MIPS_SIM == _ABI64) || defined(__powerpc64__)
- struct kernel_stat st;
- if (sys_fstat(fd, &st) == -1 || st.st_size < 0) {
- #else
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-index fad59f40c..616496d67 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-@@ -176,9 +176,10 @@ TEST_F(MemoryMappedFileTest, RemapAfterMap) {
- TEST_F(MemoryMappedFileTest, MapWithOffset) {
- // Put more data in the test file this time. Offsets can only be
- // done on page boundaries, so we need a two page file to test this.
-- const int page_size = 4096;
-- char data1[2 * page_size];
-- size_t data1_size = sizeof(data1);
-+ const int page_size = getpagesize();
-+ char *data1 = static_cast<char*>(malloc(2 * page_size));
-+ EXPECT_TRUE(data1 != NULL);
-+ size_t data1_size = (2 * page_size);
- for (size_t i = 0; i < data1_size; ++i) {
- data1[i] = i & 0x7f;
- }
-diff --git a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-index 5803b90d5..2a1cf14f0 100644
---- a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-@@ -57,8 +57,9 @@ TEST(PageAllocatorTest, LargeObject) {
-
- EXPECT_EQ(0U, allocator.pages_allocated());
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(10000));
-+ uint64_t expected_pages = 1 + ((10000 - 1) / getpagesize());
- ASSERT_FALSE(p == NULL);
-- EXPECT_EQ(3U, allocator.pages_allocated());
-+ EXPECT_EQ(expected_pages, allocator.pages_allocated());
- for (unsigned i = 1; i < 10; ++i) {
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(i));
- ASSERT_FALSE(p == NULL);
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-index 798056dfa..22bd81fff 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-@@ -202,12 +202,14 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) {
- // Check architecture and set architecture variable to corresponding flag
- // in objdump.
- switch (context->GetContextCPU()) {
-+#if defined(__i386) || defined(__x86_64)
- case MD_CONTEXT_X86:
- architecture = "i386";
- break;
- case MD_CONTEXT_AMD64:
- architecture = "i386:x86-64";
- break;
-+#endif
- default:
- // Unsupported architecture. Note that ARM architectures are not
- // supported because objdump does not support ARM.
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-index 528ee5f21..72764d6c1 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-@@ -104,6 +104,8 @@ ExploitabilityFor(const string& filename) {
- }
-
- TEST(ExploitabilityTest, TestWindowsEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("ascii_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -136,9 +138,12 @@ TEST(ExploitabilityTest, TestWindowsEngine) {
- ExploitabilityFor("read_av_clobber_write.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_LOW,
- ExploitabilityFor("read_av_conditional.dmp"));
-+#endif
- }
-
- TEST(ExploitabilityTest, TestLinuxEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if defined(__i386) || defined(__x86_64)
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_null_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -171,7 +176,8 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_executable_heap.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_jmp_to_module_not_exe_region.dmp"));
--#ifndef _WIN32
-+#endif
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_write_to_nonwritable_module.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -182,10 +188,10 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_write_to_outside_module_via_math.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_write_to_under_4k.dmp"));
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (!defined(__i386) && !defined(__x86_64))
- }
-
--#ifndef _WIN32
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- TEST(ExploitabilityLinuxUtilsTest, DisassembleBytesTest) {
- ASSERT_FALSE(ExploitabilityLinuxTest::DisassembleBytes("", NULL, 5, NULL));
- uint8_t bytes[6] = {0xc7, 0x0, 0x5, 0x0, 0x0, 0x0};
-@@ -301,6 +307,7 @@ TEST(ExploitabilityLinuxUtilsTest, CalculateAddressTest) {
- context,
- &write_address));
- }
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
-+
-
- } // namespace
-diff --git a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-index aade82c99..195aa73f3 100644
---- a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-+++ b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-@@ -77,6 +77,8 @@
- #define ELF_ARCH EM_MIPS
- #elif defined(__aarch64__)
- #define ELF_ARCH EM_AARCH64
-+#elif defined(__powerpc64__)
-+ #define ELF_ARCH EM_PPC64
- #endif
-
- #if defined(__arm__)
-@@ -87,6 +89,8 @@ typedef user_regs user_regs_struct;
- #elif defined (__mips__)
- // This file-local typedef simplifies the source code.
- typedef gregset_t user_regs_struct;
-+#elif defined(__powerpc64__)
-+typedef struct pt_regs user_regs_struct;
- #endif
-
- using google_breakpad::MDTypeHelper;
-@@ -321,6 +325,9 @@ struct CrashedProcess {
- #endif
- #if defined(__aarch64__)
- user_fpsimd_struct fpregs;
-+#endif
-+#if defined(__powerpc64__)
-+ mcontext_t mcontext;
- #endif
- uintptr_t stack_addr;
- const uint8_t* stack;
-@@ -535,6 +542,38 @@ ParseThreadRegisters(CrashedProcess::Thread* thread,
- thread->mcontext.fpc_eir = rawregs->float_save.fir;
- #endif
- }
-+#elif defined(__powerpc64__)
-+static void
-+ParseThreadRegisters(CrashedProcess::Thread* thread,
-+ const MinidumpMemoryRange& range) {
-+ const MDRawContextPPC64* rawregs = range.GetData<MDRawContextPPC64>(0);
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ thread->mcontext.gp_regs[i] = rawregs->gpr[i];
-+
-+ thread->mcontext.gp_regs[PT_LNK] = rawregs->lr;
-+ thread->mcontext.gp_regs[PT_NIP] = rawregs->srr0;
-+ thread->mcontext.gp_regs[PT_MSR] = rawregs->srr1;
-+ thread->mcontext.gp_regs[PT_CCR] = rawregs->cr;
-+ thread->mcontext.gp_regs[PT_XER] = rawregs->xer;
-+ thread->mcontext.gp_regs[PT_CTR] = rawregs->ctr;
-+ thread->mcontext.v_regs->vrsave = rawregs->vrsave;
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ thread->mcontext.fp_regs[i] = rawregs->float_save.fpregs[i];
-+
-+ thread->mcontext.fp_regs[NFPREG-1] = rawregs->float_save.fpscr;
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++) {
-+ thread->mcontext.v_regs->vrregs[i][0] = rawregs->vector_save.save_vr[i].high >> 32;
-+ thread->mcontext.v_regs->vrregs[i][1] = rawregs->vector_save.save_vr[i].high;
-+ thread->mcontext.v_regs->vrregs[i][2] = rawregs->vector_save.save_vr[i].low >> 32;
-+ thread->mcontext.v_regs->vrregs[i][3] = rawregs->vector_save.save_vr[i].low;
-+ }
-+
-+ thread->mcontext.v_regs->vscr.vscr_word = rawregs->vector_save.save_vscr.low & 0xFFFFFFFF;
-+}
-+
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -623,6 +662,12 @@ ParseSystemInfo(const Options& options, CrashedProcess* crashinfo,
- # else
- # error "This mips ABI is currently not supported (n32)"
- # endif
-+#elif defined(__powerpc64__)
-+ if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_PPC64) {
-+ fprintf(stderr,
-+ "This version of minidump-2-core only supports PPC64.\n");
-+ exit(1);
-+ }
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-diff --git a/third_party/crashpad/crashpad/CONTRIBUTORS b/third_party/crashpad/crashpad/CONTRIBUTORS
-index 8724b7f32..8e29424ef 100644
---- a/third_party/crashpad/crashpad/CONTRIBUTORS
-+++ b/third_party/crashpad/crashpad/CONTRIBUTORS
-@@ -13,3 +13,4 @@ Mark Mentovai <mark@chromium.org>
- Robert Sesek <rsesek@chromium.org>
- Scott Graham <scottmg@chromium.org>
- Joshua Peraza <jperaza@chromium.org>
-+Shawn Anastasio <shawn@anastas.io>
-diff --git a/third_party/crashpad/crashpad/compat/linux/sys/user.h b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-index 6ed77a98e..1fd83469a 100644
---- a/third_party/crashpad/crashpad/compat/linux/sys/user.h
-+++ b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_COMPAT_LINUX_SYS_USER_H_
- #define CRASHPAD_COMPAT_LINUX_SYS_USER_H_
-
-+#include <cstddef>
- #include_next <sys/user.h>
-
- #include <features.h>
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context.h b/third_party/crashpad/crashpad/minidump/minidump_context.h
-index 3a3e603cb..3118d9e9f 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context.h
-@@ -592,6 +592,70 @@ struct MinidumpContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief ppc64-specific flags for MinidumpPPC64::context_flags
-+//! Based on minidump_cpu_ppc64.h from breakpad
-+enum MinidumpContextPPC64Flags : uint32_t {
-+ //! \brief Identifies the context as PPC64.
-+ kMinidumpContextPPC64 = 0x01000000,
-+
-+ //! \brief Indicates the validity of general purpose registers.
-+ //!
-+ //! Registers `r0`-`r31`, `nip`, `msr`, `lr`, etc. are valid.
-+ kMinidumpContextPPC64Base = kMinidumpContextPPC64 | 0x00000001,
-+
-+ //! \brief Indicates the validity of floating point registers.
-+ //!
-+ //! Registers `fp0`-`fp31`, `fpscr` are valid.
-+ kMinidumpContextPPC64Floating = kMinidumpContextPPC64 | 0x00000008,
-+
-+ //! \brief Indicates the validity of Altivec/VMX registers.
-+ //!
-+ //! Registers `v0`-`v31`, `vscr`, `vrsave`.
-+ kMinidumpContextPPC64Vector = kMinidumpContextPPC64 | 0x00000020,
-+
-+ //! \brief Indicates the validity of all registers
-+ kMinidumpContextPPC64All = kMinidumpContextPPC64Base |
-+ kMinidumpContextPPC64Floating |
-+ kMinidumpContextPPC64Vector
-+};
-+
-+//! \brief A PPC64 CPU context carried in a minidump file.
-+//! Based on minidump_cpu_ppc64.h from breakpad.
-+struct MinidumpContextPPC64 {
-+ uint64_t context_flags;
-+
-+ //! \brief General purpose registers.
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+
-+ //! \brief Floating point registers.
-+ double fpregs[32];
-+
-+ //! \brief FPU status register.
-+ double fpscr;
-+
-+ //! \brief Altivec/VMX vector registers.
-+ struct {
-+ //! \brief Vector registers are 128bits.
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad5[4];
-+
-+ //! \brief VRSAVE register.
-+ uint32_t save_vrsave;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad6[7];
-+ } vregs;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-index d7e53a493..d89eb9e01 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-@@ -101,6 +101,13 @@ MinidumpContextWriter::CreateFromSnapshot(const CPUContext* context_snapshot) {
- break;
- }
-
-+ case kCPUArchitecturePPC64: {
-+ context = std::make_unique<MinidumpContextPPC64Writer>();
-+ reinterpret_cast<MinidumpContextPPC64Writer*>(context.get())
-+ ->InitalizeFromSnapshot(context_snapshot->ppc64);
-+ break;
-+ }
-+
- default: {
- LOG(ERROR) << "unknown context architecture "
- << context_snapshot->architecture;
-@@ -453,4 +460,47 @@ size_t MinidumpContextMIPS64Writer::ContextSize() const {
- return sizeof(context_);
- }
-
-+MinidumpContextPPC64Writer::MinidumpContextPPC64Writer()
-+ : MinidumpContextWriter(), context_() {
-+ context_.context_flags = kMinidumpContextPPC64;
-+}
-+
-+MinidumpContextPPC64Writer::~MinidumpContextPPC64Writer() = default;
-+
-+void MinidumpContextPPC64Writer::InitalizeFromSnapshot(
-+ const CPUContextPPC64* context_snapshot) {
-+ DCHECK_EQ(state(), kStateMutable);
-+ DCHECK_EQ(context_.context_flags, kMinidumpContextPPC64);
-+
-+ context_.context_flags = kMinidumpContextPPC64All;
-+
-+ memcpy(context_.regs, context_snapshot->regs, sizeof(context_.regs));
-+ context_.nip = context_snapshot->nip;
-+ context_.msr = context_snapshot->msr;
-+ context_.ccr = context_snapshot->ccr;
-+ context_.xer = context_snapshot->xer;
-+ context_.lnk = context_snapshot->lnk;
-+ context_.ctr = context_snapshot->ctr;
-+
-+ memcpy(context_.fpregs, context_snapshot->fpregs, sizeof(context_.fpregs));
-+ context_.fpscr = context_snapshot->fpscr;
-+
-+ memcpy(context_.vregs.save_vr, context_snapshot->vregs.save_vr,
-+ sizeof(context_.vregs.save_vr));
-+ memcpy(&context_.vregs.save_vscr, &context_snapshot->vregs.save_vscr,
-+ sizeof(context_.vregs.save_vscr));
-+ context_.vregs.save_vrsave = context_snapshot->vregs.save_vrsave;
-+}
-+
-+bool MinidumpContextPPC64Writer::WriteObject(
-+ FileWriterInterface* file_writer) {
-+ DCHECK_EQ(state(), kStateWritable);
-+ return file_writer->Write(&context_, sizeof(context_));
-+}
-+
-+size_t MinidumpContextPPC64Writer::ContextSize() const {
-+ DCHECK_GE(state(), kStateFrozen);
-+ return sizeof(context_);
-+}
-+
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-index d4ab936ee..1d22fc59c 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-@@ -315,6 +315,43 @@ class MinidumpContextMIPS64Writer final : public MinidumpContextWriter {
- MinidumpContextMIPS64 context_;
- };
-
-+class MinidumpContextPPC64Writer final : public MinidumpContextWriter {
-+ public:
-+ MinidumpContextPPC64Writer();
-+ ~MinidumpContextPPC64Writer() override;
-+
-+ //! \brief Initalizes the MinidumpContextPPC64 based on \a context_snapshot.
-+ //!
-+ //! \param[in] context_snapshot The context snapshot to use as source data.
-+ //!
-+ //! \note Valid in #kStateMutable. No mutation of context() may be done before
-+ //! calling this method, and it is not normally necessary to alter
-+ //! context() after calling this method.
-+ void InitalizeFromSnapshot(const CPUContextPPC64* context_snapshot);
-+
-+ //! \brief Returns a pointer to the context structure that this object will
-+ //! write.
-+ //!
-+ //! \attention This returns a non-`const` pointer to this object’s private
-+ //! data so that a caller can populate the context structure directly.
-+ //! This is done because providing setter interfaces to each field in the
-+ //! context structure would be unwieldy and cumbersome. Care must be taken
-+ //! to populate the context structure correctly. The context structure
-+ //! must only be modified while this object is in the #kStateMutable
-+ //! state.
-+ MinidumpContextPPC64* context() { return &context_; }
-+
-+ protected:
-+ // MinidumpWritable:
-+ bool WriteObject(FileWriterInterface* file_writer) override;
-+
-+ // MinidumpContextWriter:
-+ size_t ContextSize() const override;
-+
-+ private:
-+ MinidumpContextPPC64 context_;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_WRITER_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-index 3216a906b..a9fcbe9d8 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-@@ -213,6 +213,21 @@ TEST(MinidumpContextWriter, MIPS64_FromSnapshot) {
- context, ExpectMinidumpContextMIPS64, kSeed);
- }
-
-+TEST(MinidumpContextWriter, PPC64_Zeros) {
-+ EmptyContextTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ ExpectMinidumpContextPPC64);
-+}
-+
-+TEST(MinidumpContextWriter, PPC64_FromSnapshot) {
-+ constexpr uint32_t kSeed = 64;
-+ CPUContextPPC64 context_ppc64;
-+ CPUContext context;
-+ context.ppc64 = &context_ppc64;
-+ InitializeCPUContextPPC64(&context, kSeed);
-+ FromSnapshotTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ context, ExpectMinidumpContextPPC64, kSeed);
-+}
-+
- } // namespace
- } // namespace test
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-index 0974e3ddf..b71ec5880 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-@@ -135,6 +135,8 @@ std::string MinidumpMiscInfoDebugBuildString() {
- static constexpr char kCPU[] = "mips";
- #elif defined(ARCH_CPU_MIPS64EL)
- static constexpr char kCPU[] = "mips64";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kCPU[] = "ppc64";
- #else
- #error define kCPU for this CPU
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/capture_memory.cc b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-index 7a1b2763c..beda8da9e 100644
---- a/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-+++ b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-@@ -112,6 +112,11 @@ void CaptureMemory::PointedToByContext(const CPUContext& context,
- for (size_t i = 0; i < std::size(context.mipsel->regs); ++i) {
- MaybeCaptureMemoryAround(delegate, context.mipsel->regs[i]);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->nip);
-+ for (size_t i = 0; i < std::size(context.ppc64->regs); ++i) {
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->regs[i]);
-+ }
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-index 811a72095..f4f83981d 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-@@ -43,7 +43,10 @@ enum CPUArchitecture {
- kCPUArchitectureMIPSEL,
-
- //! \brief 64-bit MIPSEL.
-- kCPUArchitectureMIPS64EL
-+ kCPUArchitectureMIPS64EL,
-+
-+ //! \brief 64-bit PPC64.
-+ kCPUArchitecturePPC64
- };
-
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.cc b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-index c75b5555e..aeade577a 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-@@ -169,6 +169,8 @@ uint64_t CPUContext::InstructionPointer() const {
- return arm->pc;
- case kCPUArchitectureARM64:
- return arm64->pc;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->nip;
- default:
- NOTREACHED();
- return ~0ull;
-@@ -185,6 +187,8 @@ uint64_t CPUContext::StackPointer() const {
- return arm->sp;
- case kCPUArchitectureARM64:
- return arm64->sp;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->regs[1];
- default:
- NOTREACHED();
- return ~0ull;
-@@ -196,6 +200,7 @@ bool CPUContext::Is64Bit() const {
- case kCPUArchitectureX86_64:
- case kCPUArchitectureARM64:
- case kCPUArchitectureMIPS64EL:
-+ case kCPUArchitecturePPC64:
- return true;
- case kCPUArchitectureX86:
- case kCPUArchitectureARM:
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.h b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-index fb23c4679..eebede63c 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-@@ -352,6 +352,24 @@ struct CPUContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief A context structure carrying PPC64 CPU state.
-+struct CPUContextPPC64 {
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+ double fpregs[32];
-+ double fpscr;
-+ struct {
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+ uint32_t save_vrsave;
-+ } vregs;
-+};
-+
- //! \brief A context structure capable of carrying the context of any supported
- //! CPU architecture.
- struct CPUContext {
-@@ -382,6 +400,7 @@ struct CPUContext {
- CPUContextARM64* arm64;
- CPUContextMIPS* mipsel;
- CPUContextMIPS64* mips64;
-+ CPUContextPPC64* ppc64;
- };
- };
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-index 9f46a4897..aa677c4eb 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
- #define CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
-
-+#include <cstring>
- #include "build/build_config.h"
- #include "snapshot/cpu_context.h"
- #include "snapshot/linux/signal_context.h"
-@@ -174,6 +175,78 @@ void InitializeCPUContextMIPS(
-
- #endif // ARCH_CPU_MIPS_FAMILY || DOXYGEN
-
-+#if defined(ARCH_CPU_PPC64_FAMILY) || DOXYGEN
-+
-+//! \brief Initalizes a CPUContextPPC64 structure from native context
-+//! structures on Linux.
-+//!
-+//! \param[in] thread_context The native thread context.
-+//! \param[in] float_context The native float context.
-+//! \param[in] vector_context The native vector context.
-+//! \param[out] context The CPUContextPPC64 structure to initalize.
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const ThreadContext::t64_t& thread_context,
-+ const FloatContext::f64_t& float_context,
-+ const VectorContext::v64_t& vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.gpr, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.fpregs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const SignalThreadContext64 &thread_context,
-+ const SignalFloatContext64 &float_context,
-+ const SignalVectorContext64 &vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.regs, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.regs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+
-+#endif
-+
- } // namespace internal
- } // namespace crashpad
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-index d32bd1937..2dd538c2b 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-@@ -192,6 +192,8 @@ void TestAgainstTarget(PtraceConnection* connection) {
- device == 0 && inode == 0 && mapping_name == "[vdso]";
- #if defined(ARCH_CPU_X86)
- static constexpr char kPrefix[] = "linux-gate.so.";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kPrefix[] = "linux-vdso64.so.";
- #else
- static constexpr char kPrefix[] = "linux-vdso.so.";
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-index cd40b3b12..6bcf23b6f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-@@ -323,6 +323,69 @@ bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
- reader, context_address, context_.mips64);
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+template <typename Traits>
-+static bool ReadContext(ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address,
-+ typename Traits::CPUContext* dest_context) {
-+ const ProcessMemory* memory = reader->Memory();
-+
-+ LinuxVMAddress gp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, gp_regs);
-+
-+ typename Traits::SignalThreadContext thread_context;
-+ if (!memory->Read(gp_regs_address, sizeof(thread_context), &thread_context)) {
-+ LOG(ERROR) << "Couldn't read gp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress fp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, fp_regs);
-+
-+ typename Traits::SignalFloatContext fp_context;
-+ if (!memory->Read(fp_regs_address, sizeof(fp_context), &fp_context)) {
-+ LOG(ERROR) << "Couldn't read fp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress v_regs_ptr_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, vmx_reserve) + 8;
-+
-+ typename Traits::SignalVectorContext v_context;
-+ if (!memory->Read(v_regs_ptr_address, sizeof(v_context), &v_context)) {
-+ LOG(ERROR) << "Couldn't read v_regs!";
-+ return false;
-+ }
-+
-+ InitializeCPUContextPPC64<ContextTraits64>(thread_context, fp_context,
-+ v_context, dest_context);
-+
-+ return true;
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+
-+ return internal::ReadContext<ContextTraits64>(
-+ reader, context_address, context_.ppc64);
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits32>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ // PPC64 is 64-bit
-+ return false;
-+}
-+
- #endif // ARCH_CPU_X86_FAMILY
-
- bool ExceptionSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-index ea0cd2106..e42df520f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-@@ -84,6 +84,8 @@ class ExceptionSnapshotLinux final : public ExceptionSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #endif
- } context_union_;
- CPUContext context_;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-index c17170b43..b6a714cc6 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-@@ -296,7 +296,28 @@ void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
- 0);
- #undef CPU_ARCH_NAME
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+using NativeCPUContext = ucontext_t;
-+
-+void InitializeContext(NativeCPUContext* context) {
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ context->uc_mcontext.gp_regs[reg] = reg;
-+ }
-+
-+ memset(&context->uc_mcontext.fp_regs, 44,
-+ sizeof(context->uc_mcontext.fp_regs));
-+}
-
-+void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
-+ EXPECT_EQ(actual.architecture, kCPUArchitecturePPC64);
-+
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ EXPECT_EQ(actual.ppc64->regs[reg], expected.uc_mcontext.gp_regs[reg]);
-+ }
-+
-+ EXPECT_EQ(memcmp(actual.ppc64->fpregs, expected.uc_mcontext.fp_regs,
-+ sizeof(actual.ppc64->fpregs)), 0);
-+}
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-index ee246e8bc..9555dce04 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-@@ -108,6 +108,8 @@ void ProcessReaderLinux::Thread::InitializeStack(ProcessReaderLinux* reader) {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- stack_pointer = reader->Is64Bit() ? thread_info.thread_context.t64.regs[29]
- : thread_info.thread_context.t32.regs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ stack_pointer = thread_info.thread_context.t64.gpr[1];
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 110024680..a1f2da259 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -422,6 +422,89 @@ static_assert(offsetof(UContext<ContextTraits64>, mcontext.fpregs) ==
- "context offset mismatch");
- #endif
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+struct SignalThreadContext64 {
-+ uint64_t regs[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_r3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
-+ uint64_t dscr;
-+ uint64_t fpr0[3];
-+};
-+
-+struct SignalFloatContext64 {
-+ double regs[32];
-+ double fpscr;
-+};
-+
-+struct SignalVectorContext64 {
-+ int32_t vrregs[32][4];
-+ struct {
-+ int32_t __pad[3];
-+ int32_t vscr_word;
-+ } vscr;
-+ int32_t vrsave;
-+ int32_t __pad[3];
-+} __attribute__((__aligned__(16)));
-+
-+
-+#pragma pack(pop)
-+struct MContext64 {
-+ uint64_t reserved[4];
-+ int32_t signal;
-+ int32_t __pad0;
-+ uint64_t handler;
-+ uint64_t oldmask;
-+ uint64_t pt_regs_ptr;
-+ SignalThreadContext64 gp_regs;
-+ SignalFloatContext64 fp_regs;
-+ SignalVectorContext64 *v_regs;
-+ int64_t vmx_reserve[69];
-+};
-+
-+struct ContextTraits64 : public Traits64 {
-+ using MContext = MContext64;
-+ using SignalThreadContext = SignalThreadContext64;
-+ using SignalFloatContext = SignalFloatContext64;
-+ using SignalVectorContext = SignalVectorContext64;
-+ using CPUContext = CPUContextPPC64;
-+};
-+
-+struct ContextTraits32 : public Traits32 {};
-+
-+struct UContext {
-+ uint64_t flags;
-+ uint64_t link;
-+ SignalStack<ContextTraits64> stack;
-+ Sigset<ContextTraits64> sigmask;
-+ MContext64 mcontext;
-+};
-+#pragma pack(push, 1)
-+
-+static_assert(sizeof(UContext) == sizeof(ucontext_t),
-+ "ucontext_t size mismatch");
-+static_assert(sizeof(MContext64) == sizeof(mcontext_t),
-+ "mcontext_t size mismatch");
-+static_assert(sizeof(SignalThreadContext64) == sizeof(gregset_t),
-+ "gregset_t size mismatch");
-+static_assert(sizeof(SignalFloatContext64) == sizeof(fpregset_t),
-+ "fpregset_t size mismatch");
-+static_assert(sizeof(SignalVectorContext64) == sizeof(vrregset_t),
-+ "vrregset_t size mismatch");
-+static_assert(offsetof(UContext, mcontext) ==
-+ offsetof(ucontext_t, uc_mcontext), "mcontext offset mismatch");
-+static_assert(offsetof(MContext64, gp_regs) ==
-+ offsetof(mcontext_t, gp_regs), "gp_regs offset mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-index a99da3e4b..03b973083 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-@@ -204,6 +204,8 @@ CPUArchitecture SystemSnapshotLinux::GetCPUArchitecture() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return process_reader_->Is64Bit() ? kCPUArchitectureMIPS64EL
- : kCPUArchitectureMIPSEL;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return kCPUArchitecturePPC64;
- #else
- #error port to your architecture
- #endif
-@@ -219,6 +221,9 @@ uint32_t SystemSnapshotLinux::CPURevision() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return 0;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return 0;
- #else
- #error port to your architecture
- #endif
-@@ -239,6 +244,9 @@ std::string SystemSnapshotLinux::CPUVendor() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return std::string();
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return std::string();
- #else
- #error port to your architecture
- #endif
-@@ -372,6 +380,9 @@ bool SystemSnapshotLinux::NXEnabled() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return false;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return false;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-index b2450c206..7ba78b2ae 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-@@ -110,6 +110,8 @@ bool WriteTestModule(const base::FilePath& module_path,
- module.ehdr.e_machine = EM_AARCH64;
- #elif defined(ARCH_CPU_MIPSEL) || defined(ARCH_CPU_MIPS64EL)
- module.ehdr.e_machine = EM_MIPS;
-+#elif defined(ARCH_CPU_PPC64)
-+ module.ehdr.e_machine = EM_PPC64;
- #endif
-
- module.ehdr.e_version = EV_CURRENT;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-index e3e2bebdd..8ef43752e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-@@ -186,6 +186,14 @@ bool ThreadSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
- thread.thread_info.float_context.f32,
- context_.mipsel);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+ InitializeCPUContextPPC64<ContextTraits64>(
-+ thread.thread_info.thread_context.t64,
-+ thread.thread_info.float_context.f64,
-+ thread.thread_info.vector_context.v64,
-+ context_.ppc64);
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-index 44cc6f6d9..d4136461e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-@@ -68,6 +68,8 @@ class ThreadSnapshotLinux final : public ThreadSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
---- a/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-+++ b/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-@@ -236,6 +236,12 @@
- #elif defined(ARCH_CPU_BIG_ENDIAN)
- static constexpr char arch[] = "aarch64_be";
- #endif
-+#elif defined(__powerpc64__)
-+#if defined(ARCH_CPU_LITTLE_ENDIAN)
-+ static constexpr char arch[] = "ppc64le";
-+#elif defined(ARCH_CPU_BIG_ENDIAN)
-+ static constexpr char arch[] = "ppc64";
-+#endif
- #else
- #error Port
- #endif
-diff --git a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-index d3d5ebdfb..3fd730cb5 100644
---- a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-+++ b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-@@ -56,6 +56,11 @@ bool AuxiliaryVector::Read(PtraceConnection* connection) {
- if (type == AT_IGNORE) {
- continue;
- }
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ if (type == AT_IGNOREPPC) {
-+ continue;
-+ }
-+#endif
- if (!MapInsertOrReplace(&values_, type, value, nullptr)) {
- LOG(ERROR) << "duplicate auxv entry";
- return false;
-diff --git a/third_party/crashpad/crashpad/util/linux/ptracer.cc b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-index 557e0d363..08ae434b8 100644
---- a/third_party/crashpad/crashpad/util/linux/ptracer.cc
-+++ b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-@@ -398,6 +398,64 @@ bool GetThreadArea64(pid_t tid,
- return true;
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+// PPC64 has had HAVE_ARCH_TRACEHOOK set since 2.6.27 (even before x86 had it).
-+// That means we can simply use PTRACE_GETREGESET.
-+
-+template <typename Destination>
-+bool GetRegisterSet(pid_t tid, int set, Destination* dest, bool can_log) {
-+ iovec iov;
-+ iov.iov_base = reinterpret_cast<void*>(dest);
-+ iov.iov_len = sizeof(*dest);
-+ if (ptrace(PTRACE_GETREGSET, tid, reinterpret_cast<void*>(set), &iov) != 0) {
-+ PLOG_IF(ERROR, can_log) << "ptrace";
-+ return false;
-+ }
-+ if (iov.iov_len != sizeof(*dest)) {
-+ LOG_IF(ERROR, can_log) << "Unexpected registers size";
-+ return false;
-+ }
-+ return true;
-+}
-+
-+bool GetVectorRegisters64(pid_t tid,
-+ VectorContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PPC_VMX, &context->v64, can_log);
-+}
-+
-+bool GetFloatingPointRegisters64(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PRFPREG, &context->f64, can_log);
-+}
-+
-+bool GetThreadArea64(pid_t tid,
-+ const ThreadContext& context,
-+ LinuxVMAddress* address,
-+ bool can_log) {
-+ // PPC64 doesn't have PTRACE_GET_THREAD_AREA since the thread pointer
-+ // is stored in GPR 13.
-+ ThreadContext::t64_t tc;
-+ if (!GetRegisterSet(tid, NT_PRSTATUS, &tc, can_log)) {
-+ LOG_IF(ERROR, can_log) << "Unable to get thread pointer!";
-+ return false;
-+ }
-+
-+ *address = tc.gpr[13];
-+
-+ return true;
-+}
-+
-+// Stubs for 32-bit functions not applicable on PPC64
-+bool GetFloatingPointRegisters32(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) { return false; }
-+bool GetThreadArea32(pid_t tid,
-+ const ThreadContext &context,
-+ LinuxVMAddress *address,
-+ bool can_log) { return false; }
-+
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -494,6 +552,9 @@ bool Ptracer::GetThreadInfo(pid_t tid, ThreadInfo* info) {
- if (is_64_bit_) {
- return GetGeneralPurposeRegisters64(tid, &info->thread_context, can_log_) &&
- GetFloatingPointRegisters64(tid, &info->float_context, can_log_) &&
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ GetVectorRegisters64(tid, &info->vector_context, can_log_) &&
-+#endif
- GetThreadArea64(tid,
- info->thread_context,
- &info->thread_specific_data_address,
-diff --git a/third_party/crashpad/crashpad/util/linux/thread_info.h b/third_party/crashpad/crashpad/util/linux/thread_info.h
-index 5b55c24a7..dea0d1f39 100644
---- a/third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ b/third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -28,6 +28,10 @@
- #include <android/api-level.h>
- #endif
-
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+#include <sys/ucontext.h>
-+#endif
-+
- namespace crashpad {
-
- //! \brief The set of general purpose registers for an architecture family.
-@@ -79,6 +83,8 @@ union ThreadContext {
- uint32_t cp0_status;
- uint32_t cp0_cause;
- uint32_t padding1_;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // PPC64 is 64-bit
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -132,6 +138,21 @@ union ThreadContext {
- uint64_t cp0_badvaddr;
- uint64_t cp0_status;
- uint64_t cp0_cause;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects struct pt_regs in asm/ptrace.h.
-+ uint64_t gpr[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_gpr3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -143,6 +164,8 @@ union ThreadContext {
- using NativeThreadContext = user_regs;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate NativeThreadsContext type available for MIPS
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ using NativeThreadContext = struct pt_regs;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY || ARCH_CPU_ARM64
-@@ -218,6 +241,9 @@ union FloatContext {
- } fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Crashpad's PPC support is 64-bit only, so this
-+ // 32bit-only struct is declared as empty.
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -252,6 +278,10 @@ union FloatContext {
- double fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects fpregset_t in sys/ucontext.h
-+ double fpregs[32];
-+ double fpscr;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -280,6 +310,8 @@ union FloatContext {
- static_assert(sizeof(f64) == sizeof(user_fpsimd_struct), "Size mismatch");
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate floating point context native type for available MIPS.
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ static_assert(sizeof(f64) == sizeof(fpregset_t), "Size mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86
-@@ -287,6 +319,26 @@ union FloatContext {
- static_assert(std::is_standard_layout<FloatContext>::value,
- "Not standard layout");
-
-+//! \brief The vector registers used for an architecture family
-+union VectorContext {
-+ struct v32_t {} v32;
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ __attribute__((__aligned__(16))) // Vector context must be doubleword aligned.
-+#endif
-+ struct v64_t {
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects vrregset_t in sys/ucontext.h
-+ uint32_t vrregs[32][4];
-+ struct {
-+ uint32_t __pad[3];
-+ uint32_t vscr_word;
-+ } vscr;
-+ uint32_t vrsave;
-+ uint32_t __pad[3];
-+#endif
-+ } v64;
-+};
-+
- //! \brief A collection of `ptrace`-able information about a thread.
- struct ThreadInfo {
- ThreadInfo();
-@@ -298,6 +350,9 @@ struct ThreadInfo {
- //! \brief The floating point registers for the thread.
- FloatContext float_context;
-
-+ //! \brief (Optional) The vector registers used for the thread.
-+ VectorContext vector_context;
-+
- //! \brief The thread-local storage address for the thread.
- LinuxVMAddress thread_specific_data_address;
- };
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context.h b/third_party/crashpad/crashpad/util/misc/capture_context.h
-index d21a24f19..acc325349 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context.h
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context.h
-@@ -69,6 +69,7 @@ using NativeCPUContext = ucontext_t;
- //! macOS/Linux/Fuchsia | x86_64 | `%%rdi`
- //! Linux | ARM/ARM64 | `r0`/`x0`
- //! Linux | MIPS/MIPS64 | `$a0`
-+//! Linux | PPC64 | `r3`
- //!
- //! Additionally, the value `LR` on ARM/ARM64 will be the return address of
- //! this function.
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-index 52215ee5d..b3e4a3ec7 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-@@ -32,7 +32,7 @@
- .balign 4, 0x0
- .type CAPTURECONTEXT_SYMBOL, %function
- .type CAPTURECONTEXT_SYMBOL2, %function
--#elif defined(__mips__)
-+#elif defined(__mips__) || defined(__powerpc64__)
- .balign 4, 0x0
- #endif
-
-@@ -423,4 +423,214 @@ CAPTURECONTEXT_SYMBOL2:
- jr $ra
-
- .set at
-+#elif defined(__powerpc64__)
-+ // Store r0-r31
-+ std 0, 0xe8(3) // context->uc_mcontext.gp_regs[0]
-+ std 1, 0xf0(3) // context->uc_mcontext.gp_regs[1]
-+ std 2, 0xf8(3) // context->uc_mcontext.gp_regs[2]
-+ // note that r3's original value was lost
-+ std 3, 0x100(3) // context->uc_mcontext.gp_regs[3]
-+ std 4, 0x108(3) // context->uc_mcontext.gp_regs[4]
-+ std 5, 0x110(3) // context->uc_mcontext.gp_regs[5]
-+ std 6, 0x118(3) // context->uc_mcontext.gp_regs[6]
-+ std 7, 0x120(3) // context->uc_mcontext.gp_regs[7]
-+ std 8, 0x128(3) // context->uc_mcontext.gp_regs[8]
-+ std 9, 0x130(3) // context->uc_mcontext.gp_regs[9]
-+ std 10, 0x138(3) // context->uc_mcontext.gp_regs[10]
-+ std 11, 0x140(3) // context->uc_mcontext.gp_regs[11]
-+ std 12, 0x148(3) // context->uc_mcontext.gp_regs[12]
-+ std 13, 0x150(3) // context->uc_mcontext.gp_regs[13]
-+ std 14, 0x158(3) // context->uc_mcontext.gp_regs[14]
-+ std 15, 0x160(3) // context->uc_mcontext.gp_regs[15]
-+ std 16, 0x168(3) // context->uc_mcontext.gp_regs[16]
-+ std 17, 0x170(3) // context->uc_mcontext.gp_regs[17]
-+ std 18, 0x178(3) // context->uc_mcontext.gp_regs[18]
-+ std 19, 0x180(3) // context->uc_mcontext.gp_regs[19]
-+ std 20, 0x188(3) // context->uc_mcontext.gp_regs[20]
-+ std 21, 0x190(3) // context->uc_mcontext.gp_regs[21]
-+ std 22, 0x198(3) // context->uc_mcontext.gp_regs[22]
-+ std 23, 0x1a0(3) // context->uc_mcontext.gp_regs[23]
-+ std 24, 0x1a8(3) // context->uc_mcontext.gp_regs[24]
-+ std 25, 0x1b0(3) // context->uc_mcontext.gp_regs[25]
-+ std 26, 0x1b8(3) // context->uc_mcontext.gp_regs[26]
-+ std 27, 0x1c0(3) // context->uc_mcontext.gp_regs[27]
-+ std 28, 0x1c8(3) // context->uc_mcontext.gp_regs[28]
-+ std 29, 0x1d0(3) // context->uc_mcontext.gp_regs[29]
-+ std 30, 0x1d8(3) // context->uc_mcontext.gp_regs[30]
-+ std 31, 0x1e0(3) // context->uc_mcontext.gp_regs[31]
-+
-+ // For NIP, we can use the value in the link register
-+ mflr 0
-+ std 0, 0x1e8(3) // context->uc_mcontext.gp_regs[PT_NIP]
-+
-+ // CTR
-+ mfctr 0
-+ std 0, 0x200(3) // context->uc_mcontext.gp_regs[PT_CTR]
-+
-+ // For LNK, we'll use the caller's LR save area (2 stack frames up).
-+ // r4 can be used as a scratch register since it has already been saved.
-+ ld 4, 0(1)
-+ ld 4, 16(4)
-+ std 4, 0x208(3) // context->uc_mcontext.gp_regs[PT_LNK]
-+
-+ // XER
-+ mfxer 0
-+ std 0, 0x210(3) // context->uc_mcontext.gp_regs[PT_XER]
-+
-+ // CCR
-+ mfcr 0
-+ std 0, 0x218(3) // context->uc_mcontext.gp_regs[PT_CCR]
-+
-+ // MSR, orig_r3, MQ, TRAP, DAR, DSISR, RESULT, DSCR,
-+ // not used or not relevant, zero them out.
-+ li 4, 0
-+ std 4, 0x1f0(3) // context->uc_mcontext.gp_regs[PT_MSR]
-+ std 4, 0x1f8(3) // context->uc_mcontext.gp_regs[PT_ORIG_R3]
-+ std 4, 0x220(3) // context->uc_mcontext.gp_regs[PT_MQ]
-+ std 4, 0x228(3) // context->uc_mcontext.gp_regs[PT_TRAP]
-+ std 4, 0x230(3) // context->uc_mcontext.gp_regs[PT_DAR]
-+ std 4, 0x238(3) // context->uc_mcontext.gp_regs[PT_DSISR]
-+ std 4, 0x240(3) // context->uc_mcontext.gp_regs[PT_RESULT]
-+ std 4, 0x248(3) // context->uc_mcontext.gp_regs[PT_DSCR]
-+
-+ // Update context->uc_mcontext.regs to point to gp_regs
-+ addi 0, 3, 0xe8
-+ std 0, 0xe0(3)
-+
-+ // Save floating point registers 0-31
-+ stfd 0, 0x268(3) // context->uc_mcontext.fp_regs[0]
-+ stfd 1, 0x270(3) // context->uc_mcontext.fp_regs[1]
-+ stfd 2, 0x278(3) // context->uc_mcontext.fp_regs[2]
-+ stfd 3, 0x280(3) // context->uc_mcontext.fp_regs[3]
-+ stfd 4, 0x288(3) // context->uc_mcontext.fp_regs[4]
-+ stfd 5, 0x290(3) // context->uc_mcontext.fp_regs[5]
-+ stfd 6, 0x298(3) // context->uc_mcontext.fp_regs[6]
-+ stfd 7, 0x2a0(3) // context->uc_mcontext.fp_regs[7]
-+ stfd 8, 0x2a8(3) // context->uc_mcontext.fp_regs[8]
-+ stfd 9, 0x2b0(3) // context->uc_mcontext.fp_regs[9]
-+ stfd 10, 0x2b8(3) // context->uc_mcontext.fp_regs[10]
-+ stfd 11, 0x2c0(3) // context->uc_mcontext.fp_regs[11]
-+ stfd 12, 0x2c8(3) // context->uc_mcontext.fp_regs[12]
-+ stfd 13, 0x2d0(3) // context->uc_mcontext.fp_regs[13]
-+ stfd 14, 0x2d8(3) // context->uc_mcontext.fp_regs[14]
-+ stfd 15, 0x2e0(3) // context->uc_mcontext.fp_regs[15]
-+ stfd 16, 0x2e8(3) // context->uc_mcontext.fp_regs[16]
-+ stfd 17, 0x2f0(3) // context->uc_mcontext.fp_regs[17]
-+ stfd 18, 0x2f8(3) // context->uc_mcontext.fp_regs[18]
-+ stfd 19, 0x300(3) // context->uc_mcontext.fp_regs[19]
-+ stfd 20, 0x308(3) // context->uc_mcontext.fp_regs[20]
-+ stfd 21, 0x310(3) // context->uc_mcontext.fp_regs[21]
-+ stfd 22, 0x318(3) // context->uc_mcontext.fp_regs[22]
-+ stfd 23, 0x320(3) // context->uc_mcontext.fp_regs[23]
-+ stfd 24, 0x328(3) // context->uc_mcontext.fp_regs[24]
-+ stfd 25, 0x330(3) // context->uc_mcontext.fp_regs[25]
-+ stfd 26, 0x338(3) // context->uc_mcontext.fp_regs[26]
-+ stfd 27, 0x340(3) // context->uc_mcontext.fp_regs[27]
-+ stfd 28, 0x348(3) // context->uc_mcontext.fp_regs[28]
-+ stfd 29, 0x350(3) // context->uc_mcontext.fp_regs[29]
-+ stfd 30, 0x358(3) // context->uc_mcontext.fp_regs[30]
-+ stfd 31, 0x360(3) // context->uc_mcontext.fp_regs[31]
-+
-+ // FPSCR
-+ mffs 0
-+ stfd 0, 0x368(3) // context->uc_mcontext.fp_regs[32]
-+
-+ // Save VMX Vector registers
-+ // Update r4 to contain the base address of vmx_reserve
-+ addi 4, 3, 0x378
-+ // Ensure that it is quadword aligned
-+ andi. 5, 4, 0xF
-+ beq 1f // No alignment is necessary
-+ // Address is doubleword aligned and not quadword aligned, add 8
-+ addi 4, 4, 8
-+
-+1:
-+ // Store VMX registers 0-31
-+ // r4 will contain the base address
-+ // r5 will contain the index
-+ li 5, 0
-+ stvx 0, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 0]
-+ addi 5, 5, 16
-+ stvx 1, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 1]
-+ addi 5, 5, 16
-+ stvx 2, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 2]
-+ addi 5, 5, 16
-+ stvx 3, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 3]
-+ addi 5, 5, 16
-+ stvx 4, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 4]
-+ addi 5, 5, 16
-+ stvx 5, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 5]
-+ addi 5, 5, 16
-+ stvx 6, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 6]
-+ addi 5, 5, 16
-+ stvx 7, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 7]
-+ addi 5, 5, 16
-+ stvx 8, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 8]
-+ addi 5, 5, 16
-+ stvx 9, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 9]
-+ addi 5, 5, 16
-+ stvx 10, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 10]
-+ addi 5, 5, 16
-+ stvx 11, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 11]
-+ addi 5, 5, 16
-+ stvx 12, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 12]
-+ addi 5, 5, 16
-+ stvx 13, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 13]
-+ addi 5, 5, 16
-+ stvx 14, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 14]
-+ addi 5, 5, 16
-+ stvx 15, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 15]
-+ addi 5, 5, 16
-+ stvx 16, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 16]
-+ addi 5, 5, 16
-+ stvx 17, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 17]
-+ addi 5, 5, 16
-+ stvx 18, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 18]
-+ addi 5, 5, 16
-+ stvx 19, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 19]
-+ addi 5, 5, 16
-+ stvx 20, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 20]
-+ addi 5, 5, 16
-+ stvx 21, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 21]
-+ addi 5, 5, 16
-+ stvx 22, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 22]
-+ addi 5, 5, 16
-+ stvx 23, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 23]
-+ addi 5, 5, 16
-+ stvx 24, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 24]
-+ addi 5, 5, 16
-+ stvx 25, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 25]
-+ addi 5, 5, 16
-+ stvx 26, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 26]
-+ addi 5, 5, 16
-+ stvx 27, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 27]
-+ addi 5, 5, 16
-+ stvx 28, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 28]
-+ addi 5, 5, 16
-+ stvx 29, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 29]
-+ addi 5, 5, 16
-+ stvx 30, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 30]
-+ addi 5, 5, 16
-+ stvx 31, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 31]
-+ addi 5, 5, 16
-+
-+ // VSCR
-+ mfvscr 0
-+ stvx 0, 4, 5
-+ addi 5, 5, 16
-+
-+ // VRSAVE
-+ mfvrsave 0
-+ stwx 0, 4, 5
-+
-+ // Update context->uc_mcontext.v_regs to point to vmx_reserve + alignment.
-+ std 4, 0x370(3)
-+
-+ // Zero out all unused fields
-+ li 4, 0
-+ std 4, 0xc8(3) // context->uc_mcontext.signal
-+ std 4, 0xd0(3) // context->uc_mcontext.handler
-+ std 4, 0xd8(3) // context->uc_mcontext.oldmask
-+
-+ blr
- #endif // __i386__
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-index cf23c2def..5f264bc92 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-@@ -57,7 +57,7 @@ void TestCaptureContext() {
- uintptr_t pc = ProgramCounterFromContext(context_1);
-
- #if !defined(ADDRESS_SANITIZER) && !defined(ARCH_CPU_MIPS_FAMILY) && \
-- !defined(MEMORY_SANITIZER)
-+ !defined(MEMORY_SANITIZER) && !defined(ARCH_CPU_PPC64_FAMILY)
- // Sanitizers can cause enough code bloat that the “nearby” check would
- // likely fail.
- const uintptr_t kReferencePC =
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-index 30a2ab21d..60509f21d 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-@@ -35,6 +35,8 @@ void SanityCheckContext(const NativeCPUContext& context) {
- EXPECT_EQ(context.uc_mcontext.regs[0], FromPointerCast<uintptr_t>(&context));
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- EXPECT_EQ(context.uc_mcontext.gregs[4], FromPointerCast<uintptr_t>(&context));
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ EXPECT_EQ(context.uc_mcontext.gp_regs[3], FromPointerCast<uintptr_t>(&context));
- #endif
- }
-
-@@ -49,6 +51,8 @@ uintptr_t ProgramCounterFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.pc;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.pc;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[PT_NIP];
- #endif
- }
-
-@@ -63,6 +67,8 @@ uintptr_t StackPointerFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.sp;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.gregs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[1];
- #endif
- }
-
-diff --git a/third_party/dav1d/config/linux/ppc64/config.h b/third_party/dav1d/config/linux/ppc64/config.h
-new file mode 100644
-index 000000000..9fbbf75cc
---- /dev/null
-+++ b/third_party/dav1d/config/linux/ppc64/config.h
-@@ -0,0 +1,39 @@
-+/*
-+ * Autogenerated by the Meson build system.
-+ * Do not edit, your changes will be lost.
-+ */
-+
-+#pragma once
-+
-+#define ARCH_AARCH64 0
-+
-+#define ARCH_ARM 0
-+
-+#define ARCH_PPC64LE 1
-+
-+#define ARCH_X86 0
-+
-+#define ARCH_X86_32 0
-+
-+#define ARCH_X86_64 0
-+
-+#define CONFIG_16BPC 1
-+
-+#define CONFIG_8BPC 1
-+
-+// #define CONFIG_LOG 1 -- Logging is controlled by Chromium
-+
-+#define ENDIANNESS_BIG 0
-+
-+#define HAVE_ASM 1
-+
-+#define HAVE_CLOCK_GETTIME 1
-+
-+#define HAVE_DLSYM 1
-+
-+#define HAVE_GETAUXVAL 1
-+
-+#define HAVE_POSIX_MEMALIGN 1
-+
-+#define HAVE_UNISTD_H 1
-+
-diff --git a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-index 0b4bd72f0..a0caa5e71 100644
---- a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-+++ b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-@@ -51,4 +51,19 @@
- #define u16l_to_i32(v) ((i32x4) vec_mergel((u16x8) v, vec_splat_u16(0)))
- #define i16l_to_i32(v) ((i32x4) vec_unpackl((i16x8)v))
-
-+#if defined(__clang__)
-+#undef vec_splats
-+#define vec_splats(N) \
-+ _Generic((N), \
-+ unsigned char: ((u8x16)(N)), \
-+ signed char: ((i8x16)(N)), \
-+ unsigned short: ((u16x8)(N)), \
-+ signed short: ((i16x8)(N)), \
-+ unsigned int: ((u32x4)(N)), \
-+ signed int: ((i32x4)(N)), \
-+ unsigned long long: ((u64x2)(N)), \
-+ signed long long: ((i64x2)(N)) \
-+ )
-+#endif
-+
- #endif /* DAV1D_SRC_PPC_TYPES_H */
-diff --git a/third_party/eigen3/BUILD.gn b/third_party/eigen3/BUILD.gn
-index 0d4e184..f2ce484 100644
---- a/third_party/eigen3/BUILD.gn
-+++ b/third_party/eigen3/BUILD.gn
-@@ -22,4 +22,8 @@ config("eigen_includes") {
- # for this component on Windows on Arm due to compilation errors.
- defines += [ "EIGEN_DONT_VECTORIZE" ]
- }
-+
-+ if (target_cpu == "ppc64") {
-+ defines += [ "EIGEN_DONT_VECTORIZE" ]
-+ }
- }
-
-diff --git a/third_party/libaom/BUILD.gn b/third_party/libaom/BUILD.gn
-index 9b065bd..df3af02 100644
---- a/third_party/libaom/BUILD.gn
-+++ b/third_party/libaom/BUILD.gn
-@@ -40,6 +40,8 @@
- cpu_arch_full = "generic"
- } else if (current_cpu == "loong64") {
- cpu_arch_full = "generic"
-+} else if (current_cpu == "ppc64") {
-+ cpu_arch_full = "generic"
- } else {
- cpu_arch_full = current_cpu
- }
-diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h
-index e4ac22644..1c57015db 100644
---- a/third_party/lss/linux_syscall_support.h
-+++ b/third_party/lss/linux_syscall_support.h
-@@ -3947,7 +3947,7 @@ struct kernel_statfs {
- LSS_REG(2, buf);
- LSS_BODY(void*, mmap2, "0"(__r2));
- }
--#else
-+#elif !defined(__powerpc64__) /* ppc64 doesn't have mmap2 */
- #define __NR__mmap2 __NR_mmap2
- LSS_INLINE _syscall6(void*, _mmap2, void*, s,
- size_t, l, int, p,
-@@ -4058,7 +4058,7 @@ struct kernel_statfs {
- #if defined(__i386__) || \
- defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \
- (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \
-- defined(__PPC__) || \
-+ (defined(__PPC__) && !defined(__powerpc64__)) || \
- (defined(__s390__) && !defined(__s390x__))
- /* On these architectures, implement mmap() with mmap2(). */
- LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d,
-@@ -4872,11 +4872,11 @@ struct kernel_statx {
- LSS_SC_BODY(4, int, 8, d, type, protocol, sv);
- }
- #endif
-- #if defined(__NR_recvmsg)
-+ #if defined(__NR_recvmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, recvmsg, int, s, struct kernel_msghdr*, msg,
- int, flags)
- #endif
-- #if defined(__NR_sendmsg)
-+ #if defined(__NR_sendmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, sendmsg, int, s, const struct kernel_msghdr*,
- msg, int, flags)
- #endif
-@@ -4885,13 +4885,13 @@ struct kernel_statx {
- int, flags, const struct kernel_sockaddr*, to,
- unsigned int, tolen)
- #endif
-- #if defined(__NR_shutdown)
-+ #if defined(__NR_shutdown) && !defined(__PPC__)
- LSS_INLINE _syscall2(int, shutdown, int, s, int, how)
- #endif
-- #if defined(__NR_socket)
-+ #if defined(__NR_socket) && !defined(__PPC__)
- LSS_INLINE _syscall3(int, socket, int, domain, int, type, int, protocol)
- #endif
-- #if defined(__NR_socketpair)
-+ #if defined(__NR_socketpair) && !defined(__PPC__)
- LSS_INLINE _syscall4(int, socketpair, int, d, int, type, int, protocol,
- int*, sv)
- #endif
-diff --git a/third_party/pdfium/third_party/libpng16/pngpriv.h b/third_party/pdfium/third_party/libpng16/pngpriv.h
-index 583c26f..e03d697 100644
---- a/third_party/pdfium/third_party/libpng16/pngpriv.h
-+++ b/third_party/pdfium/third_party/libpng16/pngpriv.h
-@@ -196,11 +196,7 @@
- #endif
-
- #ifndef PNG_POWERPC_VSX_OPT
--# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
--# define PNG_POWERPC_VSX_OPT 2
--# else
--# define PNG_POWERPC_VSX_OPT 0
--# endif
-+# define PNG_POWERPC_VSX_OPT 0
- #endif
-
- #ifndef PNG_INTEL_SSE_OPT
-diff --git a/third_party/pffft/src/pffft.c b/third_party/pffft/src/pffft.c
-index bdac4d784..51e0f2cac 100644
---- a/third_party/pffft/src/pffft.c
-+++ b/third_party/pffft/src/pffft.c
-@@ -100,6 +100,7 @@
- Altivec support macros
- */
- #if !defined(PFFFT_SIMD_DISABLE) && (defined(__ppc__) || defined(__ppc64__))
-+#include <altivec.h>
- typedef vector float v4sf;
- # define SIMD_SZ 4
- # define VZERO() ((vector float) vec_splat_u8(0))
-diff --git a/third_party/sqlite/src/amalgamation/sqlite3.c b/third_party/sqlite/src/amalgamation/sqlite3.c
-index 6b4a7899d..b8c7fe414 100644
---- a/third_party/sqlite/src/amalgamation/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation/sqlite3.c
-@@ -14474,7 +14474,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/amalgamation_dev/sqlite3.c b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-index d30c9b7de..cf75a69d9 100644
---- a/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-@@ -14487,7 +14487,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/ext/rtree/rtree.c b/third_party/sqlite/src/ext/rtree/rtree.c
-index f5b57a5e2..80a2d0ad8 100644
---- a/third_party/sqlite/src/ext/rtree/rtree.c
-+++ b/third_party/sqlite/src/ext/rtree/rtree.c
-@@ -450,7 +450,7 @@ struct RtreeMatchArg {
- #if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__arm__)
-+ defined(__arm__) || defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- #elif defined(sparc) || defined(__ppc__)
- # define SQLITE_BYTEORDER 4321
-diff --git a/third_party/sqlite/src/src/sqliteInt.h b/third_party/sqlite/src/src/sqliteInt.h
-index 245070d4f..b25164e95 100644
---- a/third_party/sqlite/src/src/sqliteInt.h
-+++ b/third_party/sqlite/src/src/sqliteInt.h
-@@ -877,7 +877,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/webrtc/rtc_base/system/arch.h b/third_party/webrtc/rtc_base/system/arch.h
-index be2367b85..be4ee4233 100644
---- a/third_party/webrtc/rtc_base/system/arch.h
-+++ b/third_party/webrtc/rtc_base/system/arch.h
-@@ -79,6 +79,18 @@
- #elif defined(__EMSCRIPTEN__)
- #define WEBRTC_ARCH_32_BITS
- #define WEBRTC_ARCH_LITTLE_ENDIAN
-+#elif defined(__PPC__)
-+#define WEBRTC_ARCH_PPC_FAMILY
-+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-+#define WEBRTC_ARCH_LITTLE_ENDIAN
-+#else
-+#define WEBRTC_ARCH_BIG_ENDIAN
-+#endif
-+#if defined(__LP64__)
-+#define WEBRTC_ARCH_64_BITS
-+#else
-+#define WEBRTC_ARCH_32_BITS
-+#endif
- #else
- #error Please add support for your architecture in rtc_base/system/arch.h
- #endif
-diff --git a/v8/BUILD.gn b/v8/BUILD.gn
-index f39529a3a..e84fc449e 100644
---- a/v8/BUILD.gn
-+++ b/v8/BUILD.gn
-@@ -850,6 +850,12 @@ config("toolchain") {
- }
- if (host_byteorder == "little") {
- defines += [ "V8_TARGET_ARCH_PPC_LE" ]
-+ cflags += [
-+ # Enable usage of AltiVec, VSX, and other POWER8 and higher features
-+ "-mcpu=power8",
-+ "-maltivec",
-+ "-mvsx",
-+ ]
- } else if (host_byteorder == "big") {
- defines += [ "V8_TARGET_ARCH_PPC_BE" ]
- if (current_os == "aix") {
---- a/ui/gl/features.gni
-+++ b/ui/gl/features.gni
-@@ -33,5 +33,5 @@
- is_chromeos_ash || is_fuchsia) &&
- (target_cpu == "x86" || target_cpu == "x64" || target_cpu == "arm" ||
- target_cpu == "arm64" || target_cpu == "mipsel" ||
-- target_cpu == "mips64el" || target_cpu == "riscv64")
-+ target_cpu == "mips64el" || target_cpu == "riscv64" || target_cpu == "ppc64")
- }
-diff --git a/v8/test/BUILD.gn b/v8/test/BUILD.gn
-index fb872ad39..45fc585dd 100644
---- a/v8/test/BUILD.gn
-+++ b/v8/test/BUILD.gn
-@@ -42,7 +42,7 @@ group("gn_all") {
- "benchmarks/cpp:gn_all",
- "cctest:cctest",
- "unittests:generate-bytecode-expectations",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
- }
- }
-@@ -84,7 +84,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- "webkit:v8_webkit",
- ]
-
-@@ -109,7 +109,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
-
- if (v8_enable_webassembly) {
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch b/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
deleted file mode 100644
index df453f491d8c..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-+++ b/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-@@ -574,6 +574,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCAsmInfoCOFF.cpp",
- "llvm/lib/MC/MCAsmInfoDarwin.cpp",
- "llvm/lib/MC/MCAsmInfoELF.cpp",
-+ "llvm/lib/MC/MCAsmInfoXCOFF.cpp",
- "llvm/lib/MC/MCAsmMacro.cpp",
- "llvm/lib/MC/MCAsmStreamer.cpp",
- "llvm/lib/MC/MCAssembler.cpp",
-@@ -629,6 +630,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCWinCOFFStreamer.cpp",
- "llvm/lib/MC/MCWinEH.cpp",
- "llvm/lib/MC/MCXCOFFStreamer.cpp",
-+ "llvm/lib/MC/MCXCOFFObjectTargetWriter.cpp",
- "llvm/lib/MC/MachObjectWriter.cpp",
- "llvm/lib/MC/StringTableBuilder.cpp",
- "llvm/lib/MC/SubtargetFeature.cpp",
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 7dea8bbe50d3..784b8a8c5d29 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -1,9 +1,9 @@
# Template file for 'chromium'
pkgname=chromium
# See https://chromiumdash.appspot.com/releases?platform=Linux for the latest version
-version=108.0.5359.124
+version=109.0.5414.74
revision=1
-archs="i686* x86_64* aarch64* armv7l* ppc64le*"
+archs="i686* x86_64* aarch64* armv7l*"
hostmakedepends="
$(vopt_if clang "clang lld llvm12")
$(vopt_if js_optimize openjdk)
@@ -28,7 +28,7 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://www.chromium.org/"
distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz"
-checksum=d48dfac2a61b14a5d7d2f460b09b70ef3ab88e27b82e3173938cb54eaa612a75
+checksum=eded233c26ab631be325ad49cb306c338513b6a6528197d42653e66187548e5d
lib32disabled=yes
@@ -39,10 +39,9 @@ desc_option_debug="Build with debug symbols"
desc_option_js_optimize="Optimize the JS used for Chromium's UI"
desc_option_pipewire="Enable support for screen sharing for WebRTC via PipeWire"
-
-case "$XBPS_TARGET_MACHINE" in
- ppc64*-musl) makedepends+=" libucontext-devel" ;;
-esac
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+ makedepends+=" musl-legacy-compat"
+fi
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" libX11-devel libxcb-devel pciutils-devel libXext-devel libglvnd-devel
@@ -135,20 +134,6 @@ do_configure() {
CFLAGS=$CFLAGS_FOR_BUILD CXXFLAGS=$CXXFLAGS_FOR_BUILD LDFLAGS=$LDFLAGS_FOR_BUILD \
tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles
- # we need to generate ppc64 stuff for libvpx as it's not shipped
- # this has to be done before unbundling, but after gn is built
- # comment out if we switch back to system libvpx again later
- case "$XBPS_TARGET_MACHINE" in
- ppc64*)
- pushd third_party/libvpx
- mkdir -p source/config/linux/ppc64
- # need PATH to find gn
- PATH="${wrksrc}/out/Release:$PATH" ./generate_gni.sh || \
- msg_error "failed to generate libvpx gni"
- popd
- ;;
- esac
-
# Use system-provided libraries.
# TODO: use_system_hunspell (upstream changes needed).
# TODO: use_system_libsrtp.
@@ -220,9 +205,6 @@ do_configure() {
'icu_use_data_file=true'
- 'use_allocator="none"'
- 'use_allocator_shim=false'
-
'enable_widevine=true'
'enable_hangout_services_extension=true'
@@ -286,11 +268,6 @@ do_configure() {
)
fi
- # this does not work on ppc64 yet
- case "$XBPS_TARGET_MACHINE" in
- ppc64*) conf+=( "enable_jxl_decoder=false" );;
- esac
-
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
conf+=( 'is_musl=true' )
fi
@@ -300,7 +277,6 @@ do_configure() {
i686*) conf+=( 'target_cpu="x86"' ) ;;
arm*) conf+=( 'target_cpu="arm"' ) ;;
aarch64*) conf+=( 'target_cpu="arm64"' ) ;;
- ppc64*) conf+=( 'target_cpu="ppc64"' ) ;;
esac
if [ "$CROSS_BUILD" ]; then
@@ -309,7 +285,6 @@ do_configure() {
i686*) conf+=( 'host_cpu="x86"' ) ;;
arm*) conf+=( 'host_cpu="arm"' ) ;;
aarch64*) conf+=( 'host_cpu="arm64"' ) ;;
- ppc64*) conf+=( 'host_cpu="ppc64"' ) ;;
esac
fi
_setup_toolchain
@@ -318,13 +293,13 @@ do_configure() {
do_build() {
_setup_toolchain
- CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver chrome_crashpad_handler
+ CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver.unstripped chrome_crashpad_handler
}
do_install() {
vinstall out/Release/chrome 755 usr/lib/${pkgname} ${pkgname}
vinstall out/Release/chrome_crashpad_handler 755 usr/lib/${pkgname} chrome_crashpad_handler
- vinstall out/Release/chromedriver 755 usr/lib/${pkgname} chromedriver
+ vinstall out/Release/chromedriver.unstripped 755 usr/lib/${pkgname} chromedriver
vinstall out/Release/libEGL.so 755 usr/lib/${pkgname} libEGL.so
vinstall out/Release/libGLESv2.so 755 usr/lib/${pkgname} libGLESv2.so
vinstall out/Release/libvk_swiftshader.so 755 usr/lib/${pkgname} libvk_swiftshader.so
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] chromium: update to 109.0.5414.74.
2023-01-11 1:12 [PR PATCH] chromium: update to 109.0.5414.74 Duncaen
` (4 preceding siblings ...)
2023-01-11 17:20 ` Duncaen
@ 2023-01-11 17:41 ` Duncaen
2023-01-12 20:38 ` Duncaen
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Duncaen @ 2023-01-11 17:41 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]
There is an updated pull request by Duncaen against master on the void-packages repository
https://github.com/Duncaen/void-packages chromium-109
https://github.com/void-linux/void-packages/pull/41570
chromium: update to 109.0.5414.74.
[ci skip]
* [x] x86_64-glibc
* [x] x86_64-musl
* [ ] aarch64-musl
* [ ] i686
A patch file from https://github.com/void-linux/void-packages/pull/41570.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-chromium-109-41570.patch --]
[-- Type: text/x-diff, Size: 183363 bytes --]
From 30ba9a51db48e6b6dba010a27aeeaa232533877c Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Wed, 11 Jan 2023 01:28:40 +0100
Subject: [PATCH] chromium: update to 109.0.5414.74.
---
.../musl-patches/xxx-ppc64le-support.patch | 187 -
.../patches/build-add-use_cxx17.patch | 38 +-
.../patches/fix-build-with-old-clang.patch | 20 +
.../patches/fix-constexpr-narrowing.patch | 21 +
.../patches/fix-musl-no-mallinfo.patch | 11 +
.../patches/fix-musl-pthread-stacksize.patch | 40 -
.../chromium/patches/fix-narrowing-cast.patch | 53 -
.../patches/fix-nasm-musl-config.patch | 12 -
.../patches/musl-partition-atfork.patch | 11 +
...uild-error-on-linux-with-system-zlib.patch | 41 -
.../patches/remove-strip_binary.patch | 32 -
.../patches/xxx-ppc64le-4k-pages.patch | 60 -
.../chromium/patches/xxx-ppc64le-libvpx.patch | 33 -
.../xxx-ppc64le-sandbox-linux-stat.patch | 31 -
.../patches/xxx-ppc64le-support.patch | 3590 -----------------
.../patches/xxx-ppc64le-swiftshader.patch | 18 -
srcpkgs/chromium/template | 45 +-
17 files changed, 88 insertions(+), 4155 deletions(-)
delete mode 100644 srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
create mode 100644 srcpkgs/chromium/patches/fix-build-with-old-clang.patch
create mode 100644 srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
create mode 100644 srcpkgs/chromium/patches/fix-musl-no-mallinfo.patch
delete mode 100644 srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
delete mode 100644 srcpkgs/chromium/patches/fix-narrowing-cast.patch
delete mode 100644 srcpkgs/chromium/patches/fix-nasm-musl-config.patch
create mode 100644 srcpkgs/chromium/patches/musl-partition-atfork.patch
delete mode 100644 srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
delete mode 100644 srcpkgs/chromium/patches/remove-strip_binary.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-support.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
diff --git a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 555f69c072c8..000000000000
--- a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,187 +0,0 @@
-diff --git sandbox/linux/bpf_dsl/seccomp_macros.h sandbox/linux/bpf_dsl/seccomp_macros.h
-index a6aec544e..2a4a7f1bc 100644
---- sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,7 +16,7 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
--#elif defined(__powerpc64__)
-+#elif defined(__powerpc64__) && defined(__GLIBC__)
- // Manually define greg_t on ppc64
- typedef unsigned long long greg_t;
- #endif
-@@ -361,11 +361,11 @@ typedef struct pt_regs regs_struct;
- #define SECCOMP_ARCH AUDIT_ARCH_PPC64
- #endif
-
--#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+#define SECCOMP_REG(_ctx, _reg) (((struct pt_regs *)(_ctx)->uc_mcontext.regs)->gpr[_reg])
-
- #define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
--#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_IP(_ctx) ((struct pt_regs *)(_ctx)->uc_mcontext.regs)->nip
- #define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
- #define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-diff --git sandbox/linux/seccomp-bpf/syscall.cc sandbox/linux/seccomp-bpf/syscall.cc
-index d53a7ff56..c290f0e92 100644
---- sandbox/linux/seccomp-bpf/syscall.cc
-+++ sandbox/linux/seccomp-bpf/syscall.cc
-@@ -499,9 +499,9 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // Same as MIPS, need to invert ret and set error register (cr0.SO)
- if (ret_val <= -1 && ret_val >= -4095) {
- ret_val = -ret_val;
-- ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr |= (1 << 28);
- } else {
-- ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr &= ~(1 << 28);
- }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
---- third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-+++ third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-@@ -22,6 +22,7 @@
- // The following platforms have an implementation of a hardware counter.
- #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
- defined(__powerpc__) || defined(__ppc__) || defined(__riscv) || \
-+ ((defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__)) || defined(__riscv) || \
- defined(_M_IX86) || (defined(_M_X64) && !defined(_M_ARM64EC))
- #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1
- #else
---- third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-+++ third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-@@ -64,7 +64,7 @@
- #elif defined(__i386__) || defined(__x86_64__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_x86-inl.inc"
--#elif defined(__ppc__) || defined(__PPC__)
-+#elif (defined(__ppc__) || defined(__PPC__)) && defined(__GLIBC__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_powerpc-inl.inc"
- #elif defined(__aarch64__)
-diff --git third_party/breakpad/BUILD.gn third_party/breakpad/BUILD.gn
-index f9a60e37..25f3a0b7 100644
---- third_party/breakpad/BUILD.gn
-+++ third_party/breakpad/BUILD.gn
-@@ -637,6 +637,7 @@ if (is_linux || is_android) {
-
- if (current_cpu == "ppc64") {
- defines = [ "HAVE_GETCONTEXT" ]
-+ libs += [ "ucontext" ]
- } else {
- sources += [
- "breakpad/src/common/linux/breakpad_getcontext.S"
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index 03afec7a..0264ecf1 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -273,6 +273,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t ThreadInfo::GetInstructionPointer() const {
- return mcontext.gp_regs[PT_NIP];
- }
-@@ -290,9 +293,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->ctr = mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] = \
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 1090470f..e580233d 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -257,6 +257,9 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
- return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
- }
-@@ -280,9 +283,9 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&uc->uc_mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&uc->uc_mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] =
-diff --git third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index 5a7ab50c..ee8b858c 100644
---- third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -105,6 +105,11 @@
- #define PR_SET_PTRACER 0x59616d61
- #endif
-
-+/* musl hack, can't include asm/ptrace.h as that causes conflicts */
-+#if defined(__powerpc64__) && !defined(PT_NIP)
-+#define PT_NIP 32
-+#endif
-+
- namespace google_breakpad {
-
- namespace {
-diff --git third_party/crashpad/crashpad/snapshot/linux/signal_context.h third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 8e335a09..b2a0f155 100644
---- third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -469,7 +469,7 @@ struct MContext64 {
- SignalThreadContext64 gp_regs;
- SignalFloatContext64 fp_regs;
- SignalVectorContext64 *v_regs;
-- int64_t vmx_reserve[69];
-+ int64_t vmx_reserve[101];
- };
-
- struct ContextTraits64 : public Traits64 {
-diff --git third_party/crashpad/crashpad/util/linux/thread_info.h third_party/crashpad/crashpad/util/linux/thread_info.h
-index dea0d1f3..b203e5b2 100644
---- third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -30,6 +30,7 @@
-
- #if defined(ARCH_CPU_PPC64_FAMILY)
- #include <sys/ucontext.h>
-+#include <asm/ptrace.h>
- #endif
-
- namespace crashpad {
-diff --git third_party/lss/linux_syscall_support.h third_party/lss/linux_syscall_support.h
-index 9955ce44..4c1cc488 100644
---- third_party/lss/linux_syscall_support.h
-+++ third_party/lss/linux_syscall_support.h
-@@ -4216,9 +4216,13 @@ struct kernel_statfs {
- }
- #endif
- #if defined(__NR_fstatat64)
-+ // musl does #define fstatat64 fstatat
-+ #undef fstatat64
- LSS_INLINE _syscall4(int, fstatat64, int, d,
- const char *, p,
- struct kernel_stat64 *, b, int, f)
-+ // set it back like it was
-+ #define fstatat64 fstatat
- #endif
- #if defined(__NR_waitpid)
- // waitpid is polyfilled below when not available.
diff --git a/srcpkgs/chromium/patches/build-add-use_cxx17.patch b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
index 091b1c553727..b50825fb7e2c 100644
--- a/srcpkgs/chromium/patches/build-add-use_cxx17.patch
+++ b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
@@ -1,26 +1,22 @@
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
-@@ -167,6 +167,10 @@
- # Enable -H, which prints the include tree during compilation.
- # For use by tools/clang/scripts/analyze_includes.py
- show_includes = false
-+
-+ # Allow projects that wish to stay on C++17 to override Chromium's default.
-+ # TODO(crbug.com/1402249): evaluate removing this end of 2023
-+ use_cxx17 = false
+@@ -191,6 +191,10 @@
+ current_cpu == "x64"))))
}
- declare_args() {
-@@ -596,7 +600,11 @@
- } else if (is_linux) {
- # TODO(crbug.com/1284275): Switch to C++20 on all platforms.
- if (is_clang) {
-- cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ if (use_cxx17) {
-+ cflags_cc += [ "-std=${standard_prefix}++17" ]
-+ } else {
-+ cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ }
++declare_args() {
++ use_cxx17 = false
++}
++
+ if (is_android || (is_chromeos_ash && is_chromeos_device)) {
+ # Set the path to use orderfile for linking Chrome
+ # Note that this is for using only one orderfile for linking
+@@ -605,7 +609,7 @@
+ cflags_cc += [ "-fno-trigraphs" ]
+ }
+ } else if (is_clang) {
+- if (is_chromeos_device) {
++ if (is_chromeos_device || use_cxx17) {
+ # TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
+ cflags_cc += [ "-std=${standard_prefix}++17" ]
} else {
- # The gcc bots are currently using GCC 9, which is not new enough to
- # support "c++20"/"gnu++20".
diff --git a/srcpkgs/chromium/patches/fix-build-with-old-clang.patch b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
new file mode 100644
index 000000000000..f23218e71e4d
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
@@ -0,0 +1,20 @@
+--- a/build/config/compiler/BUILD.gn
++++ b/build/config/compiler/BUILD.gn
+@@ -805,17 +805,6 @@
+ cflags += [ "-fcomplete-member-pointers" ]
+ }
+
+- # Use DWARF simple template names, with the following exceptions:
+- #
+- # * Windows is not supported as it doesn't use DWARF.
+- # * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
+- # lldb doesn't have the needed changes yet.
+- # * Fuchsia isn't supported as zxdb doesn't support simple template names yet.
+- # TODO(crbug.com/1379070): Remove if the upstream default ever changes.
+- if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
+- cflags_cc += [ "-gsimple-template-names" ]
+- }
+-
+ # MLGO specific flags. These flags enable an ML-based inliner trained on
+ # Chrome on Android (arm32) with ThinLTO enabled, optimizing for size.
+ # The "release" ML model is embedded into clang as part of its build.
diff --git a/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch b/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
new file mode 100644
index 000000000000..570ca6e69a80
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
@@ -0,0 +1,21 @@
+--- a/third_party/blink/renderer/platform/media/web_media_player_impl.cc.orig
++++ b/third_party/blink/renderer/platform/media/web_media_player_impl.cc
+@@ -3881,15 +3881,15 @@
+ const T&... values) {
+ std::string strkey = std::string(key);
+
+- if constexpr (Flags & kEncrypted) {
++ if constexpr (Flags & kEncrypted != 0) {
+ if (is_encrypted_)
+ UmaFunction(strkey + ".EME", values...);
+ }
+
+- if constexpr (Flags & kTotal)
++ if constexpr (Flags & kTotal != 0)
+ UmaFunction(strkey + ".All", values...);
+
+- if constexpr (Flags & kPlaybackType) {
++ if constexpr (Flags & kPlaybackType != 0) {
+ auto demuxer_type = GetDemuxerType();
+ if (!demuxer_type.has_value())
+ return;
diff --git a/srcpkgs/chromium/patches/fix-musl-no-mallinfo.patch b/srcpkgs/chromium/patches/fix-musl-no-mallinfo.patch
new file mode 100644
index 000000000000..1718eccb2204
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-musl-no-mallinfo.patch
@@ -0,0 +1,11 @@
+--- a/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
++++ b/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
+@@ -717,7 +717,7 @@
+
+ #endif // !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS)
+ SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW {
+ base::SimplePartitionStatsDumper allocator_dumper;
+ Allocator()->DumpStats("malloc", true, &allocator_dumper);
diff --git a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch b/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
deleted file mode 100644
index cd5533190db9..000000000000
--- a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- a/base/threading/platform_thread_linux.cc
-+++ b/base/threading/platform_thread_linux.cc
-@@ -436,8 +436,13 @@
-
- size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
- #if !defined(THREAD_SANITIZER)
-+#if defined(__GLIBC__)
- return 0;
- #else
-+ // musl libcs default is too small, use 8mb like glibc
-+ return (1 << 23);
-+#endif
-+#else
- // ThreadSanitizer bloats the stack heavily. Evidence has been that the
- // default stack size isn't enough for some browser tests.
- return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux).
---- a/chrome/browser/shutdown_signal_handlers_posix.cc
-+++ b/chrome/browser/shutdown_signal_handlers_posix.cc
-@@ -188,11 +188,21 @@
- g_shutdown_pipe_read_fd = pipefd[0];
- g_shutdown_pipe_write_fd = pipefd[1];
- #if !defined(ADDRESS_SANITIZER)
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
- #else
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 * 8;
-+#endif
-+#else
- // ASan instrumentation bloats the stack frames, so we need to increase the
- // stack size to avoid hitting the guard page.
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
-+#else
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 * 8;
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+#endif
- #endif
- ShutdownDetector* detector = new ShutdownDetector(
- g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);
diff --git a/srcpkgs/chromium/patches/fix-narrowing-cast.patch b/srcpkgs/chromium/patches/fix-narrowing-cast.patch
deleted file mode 100644
index afd42a1489ae..000000000000
--- a/srcpkgs/chromium/patches/fix-narrowing-cast.patch
+++ /dev/null
@@ -1,53 +0,0 @@
---- a/base/files/file_util_linux.cc
-+++ b/base/files/file_util_linux.cc
-@@ -23,14 +23,14 @@
-
- // Not all possible |statfs_buf.f_type| values are in linux/magic.h.
- // Missing values are copied from the statfs man page.
-- switch (statfs_buf.f_type) {
-+ switch (static_cast<uintmax_t>(statfs_buf.f_type)) {
- case 0:
- *type = FILE_SYSTEM_0;
- break;
- case EXT2_SUPER_MAGIC: // Also ext3 and ext4
- case MSDOS_SUPER_MAGIC:
- case REISERFS_SUPER_MAGIC:
-- case static_cast<int>(BTRFS_SUPER_MAGIC):
-+ case BTRFS_SUPER_MAGIC:
- case 0x5346544E: // NTFS
- case 0x58465342: // XFS
- case 0x3153464A: // JFS
-@@ -40,14 +40,14 @@
- *type = FILE_SYSTEM_NFS;
- break;
- case SMB_SUPER_MAGIC:
-- case static_cast<int>(0xFF534D42): // CIFS
-+ case 0xFF534D42: // CIFS
- *type = FILE_SYSTEM_SMB;
- break;
- case CODA_SUPER_MAGIC:
- *type = FILE_SYSTEM_CODA;
- break;
-- case static_cast<int>(HUGETLBFS_MAGIC):
-- case static_cast<int>(RAMFS_MAGIC):
-+ case HUGETLBFS_MAGIC:
-+ case RAMFS_MAGIC:
- case TMPFS_MAGIC:
- *type = FILE_SYSTEM_MEMORY;
- break;
---- a/base/system/sys_info_posix.cc
-+++ b/base/system/sys_info_posix.cc
-@@ -100,10 +100,10 @@
- if (HANDLE_EINTR(statfs(path.value().c_str(), &stats)) != 0)
- return false;
-
-- switch (stats.f_type) {
-+ switch (static_cast<uintmax_t>(stats.f_type)) {
- case TMPFS_MAGIC:
-- case static_cast<int>(HUGETLBFS_MAGIC):
-- case static_cast<int>(RAMFS_MAGIC):
-+ case HUGETLBFS_MAGIC:
-+ case RAMFS_MAGIC:
- return true;
- }
- return false;
diff --git a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch b/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
deleted file mode 100644
index 7a0337f3bf3b..000000000000
--- a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/third_party/nasm/config/config-linux.h
-+++ b/third_party/nasm/config/config-linux.h
-@@ -139,7 +139,9 @@
- #define HAVE_ACCESS 1
-
- /* Define to 1 if you have the `canonicalize_file_name' function. */
-+#ifdef __GLIBC__
- #define HAVE_CANONICALIZE_FILE_NAME 1
-+#endif
-
- /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
- /* #undef HAVE_CPU_TO_LE16 */
diff --git a/srcpkgs/chromium/patches/musl-partition-atfork.patch b/srcpkgs/chromium/patches/musl-partition-atfork.patch
new file mode 100644
index 000000000000..2910aa2bbf9b
--- /dev/null
+++ b/srcpkgs/chromium/patches/musl-partition-atfork.patch
@@ -0,0 +1,11 @@
+--- a/base/allocator/partition_allocator/partition_root.cc
++++ b/base/allocator/partition_allocator/partition_root.cc
+@@ -239,7 +239,7 @@
+ if (!g_global_init_called.compare_exchange_strong(expected, true))
+ return;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS)
+ // When fork() is called, only the current thread continues to execute in the
+ // child process. If the lock is held, but *not* by this thread when fork() is
+ // called, we have a deadlock.
diff --git a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch b/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
deleted file mode 100644
index 13d504d3e792..000000000000
--- a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From dda01a706453ded8c01c41775707cb5ef4e316f8 Mon Sep 17 00:00:00 2001
-From: Andres Salomon <dilinger@queued.net>
-Date: Tue, 25 Oct 2022 21:11:46 +0000
-Subject: [PATCH] Re-fix TFLite build error on linux when using the system zlib
-
-In commit ae0f9adb7e14c0d19ca695ef6ad40b321a8cb64c, I fixed some build
-errors related to minizip patch inclusion in TFLite. However, after that
-when TFLite Support was rolled to HEAD, a small part of that patch got
-dropped. The result is the following build error with 107.0.5304.62:
-
-../../third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc:22:10: fatal error: 'contrib/minizip/ioapi.h' file not found
- ^~~~~~~~~~~~~~~~~~~~~~~~~
-1 error generated.
-
-This commit re-adds the lost fix.
-
-R=junzou@chromium.org
-
-Change-Id: Ie96c3571894b5100a1e2a2771da29699eff0beb3
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3972087
-Reviewed-by: Robert Ogden <robertogden@chromium.org>
-Commit-Queue: Robert Ogden <robertogden@chromium.org>
-Auto-Submit: Andres Salomon <dilinger@queued.net>
-Cr-Commit-Position: refs/heads/main@{#1063478}
----
- .../metadata/cc/utils/zip_readonly_mem_file.cc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-index 392b6b411fe..525ae4a2b45 100644
---- a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-+++ b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-@@ -19,7 +19,7 @@ limitations under the License.
- #include <cstdio>
-
- #include "absl/strings/string_view.h" // from @com_google_absl
--#include "contrib/minizip/ioapi.h"
-+#include "third_party/zlib/contrib/minizip/ioapi.h"
-
- namespace tflite {
- namespace metadata {
diff --git a/srcpkgs/chromium/patches/remove-strip_binary.patch b/srcpkgs/chromium/patches/remove-strip_binary.patch
deleted file mode 100644
index 8b13c6a056a8..000000000000
--- a/srcpkgs/chromium/patches/remove-strip_binary.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/chrome/test/chromedriver/BUILD.gn.orig
-+++ b/chrome/test/chromedriver/BUILD.gn
-@@ -308,11 +308,7 @@
- }
- }
-
--if (is_linux) {
-- chromedriver_output = "chromedriver.unstripped"
--} else {
-- chromedriver_output = "chromedriver"
--}
-+chromedriver_output = "chromedriver"
-
- executable("$chromedriver_output") {
- testonly = true
-@@ -336,16 +332,6 @@
- }
- }
-
--if (is_linux) {
-- strip_binary("chromedriver") {
-- testonly = true
-- binary_input = "$root_out_dir/$chromedriver_output"
-- symbol_output = "$root_out_dir/chromedriver.debug"
-- stripped_binary_output = "$root_out_dir/chromedriver"
-- deps = [ ":$chromedriver_output" ]
-- }
--}
--
- python_library("chromedriver_py_tests") {
- testonly = true
- deps = [
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch b/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
deleted file mode 100644
index 28c4ad35f14e..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-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;
-
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch b/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
deleted file mode 100644
index 0c03ad4a65eb..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-commit 981437bc846fcdb854062e89fd3d86f112e5f426
-Author: q66 <daniel@octaforge.org>
-Date: Sat Jun 25 12:35:37 2022 +0200
-
- Use generic target for now.
-
- This is because the source tree is missing vsx optimizations that
- then do not get included and result in failed linking such as:
-
- ld.lld: error: undefined symbol: vpx_mse16x16_vsx
-
-diff --git a/third_party/libvpx/generate_gni.sh b/third_party/libvpx/generate_gni.sh
-index 7429080..43ee29a 100755
---- a/third_party/libvpx/generate_gni.sh
-+++ b/third_party/libvpx/generate_gni.sh
-@@ -405,7 +405,7 @@
- gen_config_files linux/mips64el "--target=mips64-linux-gcc ${all_platforms}"
- gen_config_files linux/loongarch \
- "--target=loongarch64-linux-gcc ${all_platforms}"
--gen_config_files linux/ppc64 "--target=ppc64le-linux-gcc ${all_platforms}"
-+gen_config_files linux/ppc64 "--target=generic-gnu ${all_platforms}"
- gen_config_files linux/generic "--target=generic-gnu $HIGHBD ${all_platforms}"
- gen_config_files win/arm64 \
- "--target=arm64-win64-vs15 ${all_platforms} ${HIGHBD}"
-@@ -468,7 +468,7 @@
- gen_rtcd_header linux/mipsel mipsel
- gen_rtcd_header linux/mips64el mips64el
- gen_rtcd_header linux/loongarch loongarch
--gen_rtcd_header linux/ppc64 ppc
-+gen_rtcd_header linux/ppc64 generic
- gen_rtcd_header linux/generic generic
- gen_rtcd_header win/arm64 armv8
- gen_rtcd_header win/ia32 x86 "${require_sse2}"
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch b/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
deleted file mode 100644
index 4bfb5d494b06..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/sandbox/linux/system_headers/linux_stat.h
-+++ b/sandbox/linux/system_headers/linux_stat.h
-@@ -155,6 +155,28 @@ struct kernel_stat {
- unsigned int __unused4;
- unsigned int __unused5;
- };
-+#elif defined(__powerpc64__)
-+struct kernel_stat {
-+ unsigned long st_dev;
-+ unsigned long st_ino;
-+ unsigned long st_nlink;
-+ unsigned int st_mode;
-+ unsigned int st_uid;
-+ unsigned int st_gid;
-+ unsigned long st_rdev;
-+ long st_size;
-+ unsigned long st_blksize;
-+ unsigned long st_blocks;
-+ unsigned long st_atime_;
-+ unsigned long st_atime_nsec_;
-+ unsigned long st_mtime_;
-+ unsigned long st_mtime_nsec_;
-+ unsigned long st_ctime_;
-+ unsigned long st_ctime_nsec_;
-+ unsigned long __unused4;
-+ unsigned long __unused5;
-+ unsigned long __unused6;
-+};
- #endif
-
- // On 32-bit systems, we default to the 64-bit stat struct like libc
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 0bc505358916..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,3590 +0,0 @@
-commit 2c013a317b1114ef67cdbbc30824b28907b9ea94
-Author: Daniel Kolesa <daniel@octaforge.org>
-Date: Wed Mar 3 19:08:29 2021 +0100
-
- ppc64le support
-
-diff --git a/build/download_nacl_toolchains.py b/build/download_nacl_toolchains.py
-index 286a92a27..ec36a85d3 100755
---- a/build/download_nacl_toolchains.py
-+++ b/build/download_nacl_toolchains.py
-@@ -13,6 +13,10 @@ import sys
-
-
- def Main(args):
-+ # If `disable_nacl=1` is in GYP_DEFINES, exit
-+ if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''):
-+ return 0
-+
- script_dir = os.path.dirname(os.path.abspath(__file__))
- src_dir = os.path.dirname(script_dir)
- nacl_dir = os.path.join(src_dir, 'native_client')
---- a/chrome/installer/linux/BUILD.gn
-+++ b/chrome/installer/linux/BUILD.gn
-@@ -97,8 +97,6 @@
- "$root_out_dir/xdg-mime",
- "$root_out_dir/xdg-settings",
- "$root_out_dir/locales/en-US.pak",
-- "$root_out_dir/MEIPreload/manifest.json",
-- "$root_out_dir/MEIPreload/preloaded_data.pb",
- ]
-
- action_foreach("calculate_deb_dependencies") {
-@@ -377,7 +377,6 @@
- "//chrome",
- "//chrome:packed_resources",
- "//chrome/browser/enterprise/connectors/device_trust/key_management/installer/management_service:chrome_management_service",
-- "//chrome/browser/resources/media/mei_preload:component",
- "//components/crash/core/app:chrome_crashpad_handler",
- "//sandbox/linux:chrome_sandbox",
- ]
-diff --git a/sandbox/features.gni b/sandbox/features.gni
-index db30ae6d6..9dc09bf53 100644
---- a/sandbox/features.gni
-+++ b/sandbox/features.gni
-@@ -11,7 +11,8 @@ import("//build/config/nacl/config.gni")
- use_seccomp_bpf = (is_linux || is_chromeos || is_android) &&
- (current_cpu == "x86" || current_cpu == "x64" ||
- current_cpu == "arm" || current_cpu == "arm64" ||
-- current_cpu == "mipsel" || current_cpu == "mips64el")
-+ current_cpu == "mipsel" || current_cpu == "mips64el" ||
-+ current_cpu == "ppc64")
-
- use_seccomp_bpf = use_seccomp_bpf || is_nacl_nonsfi
-
-diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn
-index e9a94b461..cca1a5da5 100644
---- a/sandbox/linux/BUILD.gn
-+++ b/sandbox/linux/BUILD.gn
-@@ -427,6 +427,8 @@ component("sandbox_services") {
-
- source_set("sandbox_services_headers") {
- sources = [
-+ "system_headers/ppc64_linux_syscalls.h",
-+ "system_headers/ppc64_linux_ucontext.h",
- "system_headers/arm64_linux_syscalls.h",
- "system_headers/arm_linux_syscalls.h",
- "system_headers/arm_linux_ucontext.h",
-diff --git a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-index 313511f22..0ca3a326f 100644
---- a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-+++ b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-@@ -56,6 +56,13 @@
- #define MAX_PUBLIC_SYSCALL __NR_syscalls
- #define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-
-+#elif defined(__powerpc64__)
-+
-+#include <asm-generic/unistd.h>
-+#define MIN_SYSCALL 0u
-+#define MAX_PUBLIC_SYSCALL __NR_syscalls
-+#define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-+
- #else
- #error "Unsupported architecture"
- #endif
-diff --git a/sandbox/linux/bpf_dsl/seccomp_macros.h b/sandbox/linux/bpf_dsl/seccomp_macros.h
-index 1a407b952..a6aec544e 100644
---- a/sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ b/sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,6 +16,9 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
-+#elif defined(__powerpc64__)
-+// Manually define greg_t on ppc64
-+typedef unsigned long long greg_t;
- #endif
- #endif
-
-@@ -346,6 +349,51 @@ struct regs_struct {
- #define SECCOMP_PT_PARM4(_regs) (_regs).regs[3]
- #define SECCOMP_PT_PARM5(_regs) (_regs).regs[4]
- #define SECCOMP_PT_PARM6(_regs) (_regs).regs[5]
-+
-+#elif defined(__powerpc64__)
-+#include <asm/ptrace.h>
-+
-+typedef struct pt_regs regs_struct;
-+
-+#ifdef ARCH_CPU_LITTLE_ENDIAN
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64LE
-+#else
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64
-+#endif
-+
-+#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+
-+#define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
-+#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
-+#define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-+#define SECCOMP_PARM4(_ctx) SECCOMP_REG(_ctx, 6)
-+#define SECCOMP_PARM5(_ctx) SECCOMP_REG(_ctx, 7)
-+#define SECCOMP_PARM6(_ctx) SECCOMP_REG(_ctx, 8)
-+
-+#define SECCOMP_NR_IDX (offsetof(struct arch_seccomp_data, nr))
-+#define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch))
-+#define SECCOMP_IP_MSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 4)
-+#define SECCOMP_IP_LSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 0)
-+#define SECCOMP_ARG_MSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 4)
-+#define SECCOMP_ARG_LSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 0)
-+
-+#define SECCOMP_PT_RESULT(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_SYSCALL(_regs) (_regs).gpr[0]
-+#define SECCOMP_PT_IP(_regs) (_regs).nip
-+#define SECCOMP_PT_PARM1(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_PARM2(_regs) (_regs).gpr[4]
-+#define SECCOMP_PT_PARM3(_regs) (_regs).gpr[5]
-+#define SECCOMP_PT_PARM4(_regs) (_regs).gpr[6]
-+#define SECCOMP_PT_PARM5(_regs) (_regs).gpr[7]
-+#define SECCOMP_PT_PARM6(_regs) (_regs).gpr[8]
-+
- #else
- #error Unsupported target platform
-
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-index 6a1ec2389..f20c582dd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-@@ -88,7 +88,8 @@ bool IsBaselinePolicyWatched(int sysno) {
- SyscallSets::IsPrctl(sysno) ||
- SyscallSets::IsProcessGroupOrSession(sysno) ||
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- SyscallSets::IsSocketCall(sysno) ||
- #endif
- #if defined(__arm__)
-@@ -227,7 +228,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_mmap)
- return RestrictMmapFlags();
- #endif
-@@ -245,7 +246,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- return RestrictPrctl();
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_socketpair) {
- // Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen.
- static_assert(AF_UNIX == PF_UNIX,
-@@ -285,7 +286,8 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- if (SyscallSets::IsSocketCall(sysno))
- return RestrictSocketcallCommand();
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:11:10.481579470 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:12:43.524831376 -0400
-@@ -302,7 +302,7 @@
- TEST_BASELINE_SIGSYS(__NR_syslog)
- TEST_BASELINE_SIGSYS(__NR_timer_create)
-
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- TEST_BASELINE_SIGSYS(__NR_inotify_init)
- TEST_BASELINE_SIGSYS(__NR_vserver)
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-@@ -358,7 +358,16 @@
- if (args.nr == __NR_fstatat_default) {
- if (*reinterpret_cast<const char*>(args.args[1]) == '\0' &&
- args.args[3] == static_cast<uint64_t>(AT_EMPTY_PATH)) {
-- return syscall(__NR_fstat_default, static_cast<int>(args.args[0]),
-+ int fd = static_cast<int>(args.args[0]);
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO: Investigate the root cause and fix in glibc
-+ if (fd < 0)
-+ fd = -fd;
-+#endif
-+ return syscall(__NR_fstat_default, fd,
- reinterpret_cast<default_stat_struct*>(args.args[2]));
- }
- return -reinterpret_cast<intptr_t>(fs_denied_errno);
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
-index 2a97d3916..8e81aa6cf 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-14 14:41:08.000000000 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-15 13:17:57.808715733 -0400
-@@ -37,7 +37,8 @@
-
- #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
- !defined(__arm__) && !defined(__aarch64__) && \
-- !defined(PTRACE_GET_THREAD_AREA)
-+ !defined(PTRACE_GET_THREAD_AREA) && \
-+ !defined(__powerpc64__)
- // Also include asm/ptrace-abi.h since ptrace.h in older libc (for instance
- // the one in Ubuntu 16.04 LTS) is missing PTRACE_GET_THREAD_AREA.
- // asm/ptrace-abi.h doesn't exist on arm32 and PTRACE_GET_THREAD_AREA isn't
-@@ -45,6 +46,11 @@
- #include <asm/ptrace-abi.h>
- #endif
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- #if BUILDFLAG(IS_ANDROID)
-
- #if !defined(F_DUPFD_CLOEXEC)
-@@ -99,6 +105,14 @@
- return true;
- #else
- return false;
-+#endif
-+}
-+
-+inline bool IsArchitecturePPC64() {
-+#if defined(__powerpc64__)
-+ return true;
-+#else
-+ return false;
- #endif
- }
-
-@@ -239,6 +254,8 @@
- uint64_t kOLargeFileFlag = O_LARGEFILE;
- if (IsArchitectureX86_64() || IsArchitectureI386() || IsArchitectureMips())
- kOLargeFileFlag = 0100000;
-+ else if (IsArchitecturePPC64())
-+ kOLargeFileFlag = 0200000;
-
- const Arg<int> cmd(1);
- const Arg<long> long_arg(2);
-@@ -256,7 +273,16 @@
- F_SETLKW,
- F_GETLK,
- F_DUPFD,
-- F_DUPFD_CLOEXEC),
-+ F_DUPFD_CLOEXEC
-+#if defined(__powerpc64__)
-+// On PPC64, F_SETLK, F_GETLK, F_SETLKW are defined as the 64-bit variants
-+// but glibc will sometimes still use the 32-bit versions. Allow both.
-+ ,
-+ 5, /* F_GETLK (32) */
-+ 6, /* F_SETLK (32) */
-+ 7 /* F_SETLKW (32) */
-+#endif
-+ ),
- Allow())
- .Case(F_SETFL,
- If((long_arg & ~kAllowedMask) == 0, Allow()).Else(CrashSIGSYS()))
-@@ -266,7 +292,7 @@
- // clang-format on
- }
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- ResultExpr RestrictSocketcallCommand() {
- // Unfortunately, we are unable to restrict the first parameter to
- // socketpair(2). Whilst initially sounding bad, it's noteworthy that very
-@@ -419,7 +445,7 @@
- #endif
- return Switch(request)
- .CASES((
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- PTRACE_GETREGS, PTRACE_GETFPREGS, PTRACE_GET_THREAD_AREA,
- PTRACE_GETREGSET,
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-index ba4289f05..9a4d5ab2d 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-@@ -48,7 +48,7 @@ SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictMprotectFlags();
- // O_NONBLOCK | O_SYNC | O_LARGEFILE | O_CLOEXEC | O_NOATIME.
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictFcntlCommands();
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- // Restrict socketcall(2) to only allow socketpair(2), send(2), recv(2),
- // sendto(2), recvfrom(2), shutdown(2), sendmsg(2) and recvmsg(2).
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictSocketcallCommand();
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-index 642df7207..34f47eb73 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-@@ -29,7 +29,8 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- switch (sysno) {
- case __NR_gettimeofday:
- #if defined(__i386__) || defined(__x86_64__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_time:
- #endif
- return true;
-@@ -52,12 +53,14 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- case __NR_clock_nanosleep_time64: // Parameters filtered by RestrictClockID().
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ftime: // Obsolete.
- #endif
- case __NR_settimeofday: // Privileged.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stime:
- #endif
- default:
-@@ -135,7 +138,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_faccessat: // EPERM not a valid errno.
- case __NR_fchmodat:
- case __NR_fchownat: // Should be called chownat ?
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat: // fstatat(). EPERM not a valid errno.
- #elif defined(__i386__) || defined(__arm__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-@@ -154,7 +157,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_memfd_create:
- case __NR_mkdirat:
- case __NR_mknodat:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldlstat:
- case __NR_oldstat:
- #endif
-@@ -168,7 +171,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- #endif
- case __NR_statfs: // EPERM not a valid errno.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_statfs64:
- #endif
- case __NR_symlinkat:
-@@ -178,7 +182,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_truncate64:
- #endif
- case __NR_unlinkat:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_utime:
- #endif
- case __NR_utimensat: // New.
-@@ -203,7 +208,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- #endif
- return true;
- // TODO(jln): these should be denied gracefully as well (moved below).
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_fadvise64: // EPERM not a valid errno.
- #endif
- #if defined(__i386__)
-@@ -216,11 +222,12 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_flock: // EPERM not a valid errno.
- case __NR_fstatfs: // Give information about the whole filesystem.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_fstatfs64:
- #endif
- case __NR_fsync: // EPERM not a valid errno.
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldfstat:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-@@ -228,6 +235,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_sync_file_range: // EPERM not a valid errno.
- #elif defined(__arm__)
- case __NR_arm_sync_file_range: // EPERM not a valid errno.
-+#elif defined(__powerpc64__)
-+ case __NR_sync_file_range2: // EPERM not a valid errno.
- #endif
- default:
- return false;
-@@ -248,7 +257,8 @@ bool SyscallSets::IsDeniedFileSystemAccessViaFd(int sysno) {
- #endif
- case __NR_getdents64: // EPERM not a valid errno.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_readdir:
- #endif
- return true;
-@@ -289,7 +299,7 @@ bool SyscallSets::IsGetSimpleId(int sysno) {
- bool SyscallSets::IsProcessPrivilegeChange(int sysno) {
- switch (sysno) {
- case __NR_capset:
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_ioperm: // Intel privilege.
- case __NR_iopl: // Intel privilege.
- #endif
-@@ -340,8 +350,11 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- case __NR_rt_sigreturn:
- case __NR_rt_sigtimedwait:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
-+#ifndef __powerpc64__
- case __NR_rt_sigtimedwait_time64:
-+#endif
- case __NR_sigaction:
- case __NR_sigprocmask:
- case __NR_sigreturn:
-@@ -357,7 +370,8 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- #endif
- case __NR_signalfd4:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_sigpending:
- case __NR_sigsuspend:
- #endif
-@@ -381,7 +395,7 @@ bool SyscallSets::IsAllowedOperationOnFd(int sysno) {
- #endif
- case __NR_dup3:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_shutdown:
- #endif
- return true;
-@@ -414,7 +428,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- case __NR_exit_group:
- case __NR_wait4:
- case __NR_waitid:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_waitpid:
- #endif
- return true;
-@@ -431,7 +445,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- #endif
- case __NR_set_tid_address:
- case __NR_unshare:
--#if !defined(__mips__) && !defined(__aarch64__)
-+#if !defined(__mips__) && !defined(__aarch64__) || defined(__powerpc64__)
- case __NR_vfork:
- #endif
- default:
-@@ -484,7 +498,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- return true;
- default:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_socketpair: // We will want to inspect its argument.
- #endif
- return false;
-@@ -494,7 +508,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- switch (sysno) {
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_accept:
- case __NR_accept4:
- case __NR_bind:
-@@ -509,7 +523,8 @@ bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- bool SyscallSets::IsSocketCall(int sysno) {
- switch (sysno) {
-@@ -523,7 +538,8 @@ bool SyscallSets::IsSocketCall(int sysno) {
- }
- #endif
-
--#if defined(__x86_64__) || defined(__arm__) || defined(__mips__)
-+#if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- bool SyscallSets::IsNetworkSocketInformation(int sysno) {
- switch (sysno) {
- case __NR_getpeername:
-@@ -548,7 +564,7 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
- case __NR_mincore:
- case __NR_mlockall:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_mmap:
- #endif
- #if defined(__i386__) || defined(__arm__) || \
-@@ -578,7 +594,8 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- switch (sysno) {
- case __NR_lseek:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR__llseek:
- #endif
- #if !defined(__aarch64__)
-@@ -598,26 +615,28 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- case __NR_readv:
- case __NR_pread64:
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_recv:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_recvfrom: // Could specify source.
- case __NR_recvmsg: // Could specify source.
- #endif
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_select:
- #endif
--#if defined(__i386__) || defined(__arm__) || defined(__mips__)
-+#if defined(__i386__) || defined(__arm__) || defined(__mips__) || defined(__powerpc64__)
- case __NR__newselect:
- #endif
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_send:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_sendmsg: // Could specify destination.
- case __NR_sendto: // Could specify destination.
- #endif
-@@ -673,7 +692,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- return true;
- case __NR_getpriority:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_nice:
- #endif
- case __NR_setpriority:
-@@ -685,7 +705,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- bool SyscallSets::IsAdminOperation(int sysno) {
- switch (sysno) {
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_bdflush:
- #endif
- case __NR_kexec_load:
-@@ -701,7 +722,8 @@ bool SyscallSets::IsAdminOperation(int sysno) {
-
- bool SyscallSets::IsKernelModule(int sysno) {
- switch (sysno) {
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_create_module:
- case __NR_get_kernel_syms: // Should ENOSYS.
- case __NR_query_module:
-@@ -734,7 +756,8 @@ bool SyscallSets::IsFsControl(int sysno) {
- case __NR_swapoff:
- case __NR_swapon:
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_umount:
- #endif
- case __NR_umount2:
-@@ -750,7 +773,7 @@ bool SyscallSets::IsNuma(int sysno) {
- case __NR_getcpu:
- case __NR_mbind:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_migrate_pages:
- #endif
- case __NR_move_pages:
-@@ -785,14 +808,15 @@ bool SyscallSets::IsGlobalProcessEnvironment(int sysno) {
- switch (sysno) {
- case __NR_acct: // Privileged.
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
--#if defined(__i386__) || defined(__arm__)
-+#if defined(__i386__) || defined(__arm__) || defined(__powerpc64__)
- case __NR_ugetrlimit:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ulimit:
- #endif
- case __NR_getrusage:
-@@ -826,7 +850,7 @@ bool SyscallSets::IsGlobalSystemStatus(int sysno) {
- #endif
- case __NR_sysinfo:
- case __NR_uname:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_olduname:
- case __NR_oldolduname:
- #endif
-@@ -892,8 +916,16 @@ bool SyscallSets::IsSystemVSemaphores(int sysno) {
- }
- #endif
-
-+/* shitty hack around Void's 4.19 kernel headers missing those numbers */
-+#if defined(__powerpc64__) && !defined(__NR_shmget)
-+#define __NR_shmget 395
-+#define __NR_shmctl 396
-+#define __NR_shmat 397
-+#define __NR_shmdt 398
-+#endif
-+
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- bool SyscallSets::IsSystemVSharedMemory(int sysno) {
-@@ -925,7 +957,8 @@ bool SyscallSets::IsSystemVMessageQueue(int sysno) {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- bool SyscallSets::IsSystemVIpc(int sysno) {
- switch (sysno) {
-@@ -945,7 +978,8 @@ bool SyscallSets::IsAnySystemV(int sysno) {
- return IsSystemVMessageQueue(sysno) || IsSystemVSemaphores(sysno) ||
- IsSystemVSharedMemory(sysno);
- #elif defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- return IsSystemVIpc(sysno);
- #endif
- }
-@@ -1002,7 +1036,8 @@ bool SyscallSets::IsFaNotify(int sysno) {
- bool SyscallSets::IsTimer(int sysno) {
- switch (sysno) {
- case __NR_getitimer:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_alarm:
- #endif
- case __NR_setitimer:
-@@ -1084,18 +1119,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_syncfs:
- case __NR_vhangup:
- // The system calls below are not implemented.
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_afs_syscall:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_break:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_getpmsg:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_gtty:
- case __NR_idle:
- case __NR_lock:
-@@ -1103,20 +1142,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_prof:
- case __NR_profil:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_putpmsg:
- #endif
- #if defined(__x86_64__)
- case __NR_security:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stty:
- #endif
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- case __NR_tuxcall:
- #endif
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- case __NR_vserver:
- #endif
- return true;
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-index 923533ec9..411f72acd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-@@ -43,13 +43,14 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsDeniedGetOrModifySocket(int sysno);
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- static bool IsSocketCall(int sysno);
- #endif
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- static bool IsNetworkSocketInformation(int sysno);
- #endif
-
-@@ -76,7 +77,7 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsSystemVSemaphores(int sysno);
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- static bool IsSystemVSharedMemory(int sysno);
-@@ -88,7 +89,8 @@ class SANDBOX_EXPORT SyscallSets {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- static bool IsSystemVIpc(int sysno);
- #endif
-diff --git a/sandbox/linux/seccomp-bpf/syscall.cc b/sandbox/linux/seccomp-bpf/syscall.cc
-index e47e98bf5..d53a7ff56 100644
---- a/sandbox/linux/seccomp-bpf/syscall.cc
-+++ b/sandbox/linux/seccomp-bpf/syscall.cc
-@@ -18,7 +18,7 @@ namespace sandbox {
- namespace {
-
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined (ARCH_CPU_PPC64_FAMILY)
- // Number that's not currently used by any Linux kernel ABIs.
- const int kInvalidSyscallNumber = 0x351d3;
- #else
-@@ -310,12 +310,56 @@ asm(// We need to be able to tell the kernel exactly where we made a
- // Enter the kernel
- "svc 0\n"
- "2:ret\n"
-+ ".cfi_endproc\n"
-+ ".size SyscallAsm, .-SyscallAsm\n"
-+#elif defined(__powerpc64__)
-+ ".text\n"
-+ ".align 4\n"
-+ ".type SyscallAsm @function\n"
-+ "SyscallAsm:\n"
-+ ".cfi_startproc\n"
-+
-+ // Check if r3 is negative
-+ "cmpdi 3, 0\n"
-+ "bgt 2f\n"
-+
-+ // Load address of 3f into r3 and return
-+ "mflr 10\n"
-+ "bl 1f\n"
-+ "1: mflr 3\n"
-+ "mtlr 10\n"
-+ "addi 3, 3, 4*13\n"
-+ "blr\n"
-+
-+ // Load arguments from array into r3-8
-+ // save param 3 in r10
-+ "2:\n"
-+ "mr 0, 3\n"
-+ "ld 3, 0(4)\n"
-+ "ld 5, 16(4)\n"
-+ "ld 6, 24(4)\n"
-+ "ld 7, 32(4)\n"
-+ "ld 8, 40(4)\n"
-+ "ld 4, 8(4)\n"
-+ "li 9, 0\n"
-+
-+ // Enter kernel
-+ "sc\n"
-+
-+ // Magic return address
-+ "3:\n"
-+ // Like MIPS, ppc64 return values are always positive.
-+ // Check for error in cr0.SO and negate upon error
-+ "bc 4, 3, 4f\n"
-+ "neg 3, 3\n"
-+ "4: blr\n"
-+
- ".cfi_endproc\n"
- ".size SyscallAsm, .-SyscallAsm\n"
- #endif
- ); // asm
-
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- extern "C" {
- intptr_t SyscallAsm(intptr_t nr, const intptr_t args[6]);
- }
-@@ -429,6 +473,8 @@ intptr_t Syscall::Call(int nr,
- ret = inout;
- }
-
-+#elif defined(__powerpc64__)
-+ intptr_t ret = SyscallAsm(nr, args);
- #else
- #error "Unimplemented architecture"
- #endif
-@@ -445,8 +491,18 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // needs to be changed back.
- ret_val = -ret_val;
- SECCOMP_PARM4(ctx) = 1;
-- } else
-+ } else {
- SECCOMP_PARM4(ctx) = 0;
-+ }
-+#endif
-+#if defined(__powerpc64__)
-+ // Same as MIPS, need to invert ret and set error register (cr0.SO)
-+ if (ret_val <= -1 && ret_val >= -4095) {
-+ ret_val = -ret_val;
-+ ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ } else {
-+ ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
- }
-diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc
-index f5b86a73a..5e6c4a068 100644
---- a/sandbox/linux/seccomp-bpf/trap.cc
-+++ b/sandbox/linux/seccomp-bpf/trap.cc
-@@ -232,6 +232,20 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
- SetIsInSigHandler();
- }
-
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO(shawn@anastas.io): investigate this issue further
-+ auto nr = SECCOMP_SYSCALL(ctx);
-+ if (nr == __NR_openat || nr == __NR_mkdirat || nr == __NR_faccessat || nr == __NR_readlinkat ||
-+ nr == __NR_renameat || nr == __NR_renameat2 || nr == __NR_newfstatat || nr == __NR_unlinkat) {
-+ if (static_cast<int>(SECCOMP_PARM1(ctx)) > 0) {
-+ SECCOMP_PARM1(ctx) = -SECCOMP_PARM1(ctx);
-+ }
-+ }
-+#endif
-+
- // Copy the seccomp-specific data into a arch_seccomp_data structure. This
- // is what we are showing to TrapFnc callbacks that the system call
- // evaluator registered with the sandbox.
-diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc
-index d7b5d8c44..4adc6d0d4 100644
---- a/sandbox/linux/services/credentials.cc
-+++ b/sandbox/linux/services/credentials.cc
-@@ -81,7 +81,7 @@ bool ChrootToSafeEmptyDir() {
- pid_t pid = -1;
- alignas(16) char stack_buf[PTHREAD_STACK_MIN];
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // The stack grows downward.
- void* stack = stack_buf + sizeof(stack_buf);
- #else
-@@ -90,7 +90,9 @@
-
- int clone_flags = CLONE_FS | LINUX_SIGCHLD;
- void* tls = nullptr;
--#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
-+// RAJA this might be it...
-+#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY) || \
-+ defined(ARCH_CPU_PPC64_FAMILY)) && \
- !defined(MEMORY_SANITIZER)
- // Use CLONE_VM | CLONE_VFORK as an optimization to avoid copying page tables.
- // Since clone writes to the new child's TLS before returning, we must set a
-@@ -98,6 +100,11 @@
- // glibc performs syscalls by calling a function pointer in TLS, so we do not
- // attempt this optimization.
- // TODO(crbug.com/1247458) Broken in MSan builds after LLVM f1bb30a4956f.
-+ //
-+ // NOTE: Without CLONE_VM, fontconfig will attempt to reload configuration
-+ // in every thread. Since the rendered threads are sandboxed without
-+ // filesystem access (e.g. to /etc/fonts/fonts.conf) this will cause font
-+ // configuraiton loading failures and no fonts will be displayed!
- clone_flags |= CLONE_VM | CLONE_VFORK | CLONE_SETTLS;
-
- char tls_buf[PTHREAD_STACK_MIN] = {0};
-diff --git a/sandbox/linux/services/syscall_wrappers.cc b/sandbox/linux/services/syscall_wrappers.cc
-index fcfd2aa12..f6eb32fb7 100644
---- a/sandbox/linux/services/syscall_wrappers.cc
-+++ b/sandbox/linux/services/syscall_wrappers.cc
-@@ -58,7 +58,7 @@ long sys_clone(unsigned long flags,
- #if defined(ARCH_CPU_X86_64)
- return syscall(__NR_clone, flags, child_stack, ptid, ctid, tls);
- #elif defined(ARCH_CPU_X86) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // CONFIG_CLONE_BACKWARDS defined.
- return syscall(__NR_clone, flags, child_stack, ptid, tls, ctid);
- #endif
-diff --git a/sandbox/linux/syscall_broker/broker_process.cc b/sandbox/linux/syscall_broker/broker_process.cc
-index d72c9d238..77f1d95f5 100644
---- a/sandbox/linux/syscall_broker/broker_process.cc
-+++ b/sandbox/linux/syscall_broker/broker_process.cc
-@@ -169,7 +169,7 @@ bool BrokerProcess::IsSyscallBrokerable(int sysno, bool fast_check) const {
- #if defined(__NR_fstatat64)
- case __NR_fstatat64:
- #endif
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat:
- #endif
- return !fast_check || allowed_command_set_.test(COMMAND_STAT);
-diff --git a/sandbox/linux/system_headers/linux_seccomp.h b/sandbox/linux/system_headers/linux_seccomp.h
-index 1fa47ed09..39cc9ab53 100644
---- a/sandbox/linux/system_headers/linux_seccomp.h
-+++ b/sandbox/linux/system_headers/linux_seccomp.h
-@@ -41,6 +41,9 @@
- #ifndef EM_AARCH64
- #define EM_AARCH64 183
- #endif
-+#ifndef EM_PPC64
-+#define EM_PPC64 21
-+#endif
-
- #ifndef __AUDIT_ARCH_64BIT
- #define __AUDIT_ARCH_64BIT 0x80000000
-@@ -73,6 +76,12 @@
- #ifndef AUDIT_ARCH_AARCH64
- #define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
- #endif
-+#ifndef AUDIT_ARCH_PPC64
-+#define AUDIT_ARCH_PPC64 (EM_PPC64 | __AUDIT_ARCH_64BIT)
-+#endif
-+#ifndef AUDIT_ARCH_PPC64LE
-+#define AUDIT_ARCH_PPC64LE (EM_PPC64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
-+#endif
-
- // For prctl.h
- #ifndef PR_SET_SECCOMP
-diff --git a/sandbox/linux/system_headers/linux_signal.h b/sandbox/linux/system_headers/linux_signal.h
-index f5a736761..515b21a5f 100644
---- a/sandbox/linux/system_headers/linux_signal.h
-+++ b/sandbox/linux/system_headers/linux_signal.h
-@@ -13,7 +13,7 @@
- // (not undefined, but defined different values and in different memory
- // layouts). So, fill the gap here.
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
-
- #define LINUX_SIGHUP 1
- #define LINUX_SIGINT 2
-diff --git a/sandbox/linux/system_headers/linux_syscalls.h b/sandbox/linux/system_headers/linux_syscalls.h
-index 2b78a0cc3..0a70f5ea5 100644
---- a/sandbox/linux/system_headers/linux_syscalls.h
-+++ b/sandbox/linux/system_headers/linux_syscalls.h
-@@ -35,5 +35,9 @@
- #include "sandbox/linux/system_headers/arm64_linux_syscalls.h"
- #endif
-
-+#if defined(__powerpc64__)
-+#include "sandbox/linux/system_headers/ppc64_linux_syscalls.h"
-+#endif
-+
- #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SYSCALLS_H_
-
-diff --git a/sandbox/linux/system_headers/ppc64_linux_syscalls.h b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-new file mode 100644
-index 000000000..ccacffe22
---- /dev/null
-+++ b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-@@ -0,0 +1,12 @@
-+// Copyright 2014 The Chromium Authors. All rights reserved.
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+#define SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+
-+#include <asm/unistd.h>
-+
-+//TODO: is it necessary to redefine syscall numbers for PPC64?
-+
-+#endif // SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-diff --git a/sandbox/policy/linux/bpf_utility_policy_linux.cc b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_utility_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-@@ -34,7 +34,7 @@
- case __NR_fdatasync:
- case __NR_fsync:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
- #if defined(__i386__) || defined(__arm__)
-diff --git a/sandbox/policy/linux/bpf_renderer_policy_linux.cc b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-@@ -15,6 +15,11 @@
- #include "sandbox/linux/system_headers/linux_syscalls.h"
- #include "sandbox/policy/linux/sandbox_linux.h"
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- // TODO(vignatti): replace the local definitions below with #include
- // <linux/dma-buf.h> once kernel version 4.6 becomes widely used.
- #include <linux/types.h>
-@@ -77,7 +77,7 @@
- case __NR_ftruncate64:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- case __NR_setrlimit:
- // We allow setrlimit to dynamically adjust the address space limit as
-diff --git a/third_party/angle/src/compiler/translator/InfoSink.h b/third_party/angle/src/compiler/translator/InfoSink.h
-index 3a807e1e3..5258617a7 100644
---- a/third_party/angle/src/compiler/translator/InfoSink.h
-+++ b/third_party/angle/src/compiler/translator/InfoSink.h
-@@ -92,7 +92,16 @@ class TInfoSinkBase
- stream.precision(8);
- stream << f;
- }
-- sink.append(stream.str());
-+
-+ // Hack to work around a bug where negative floating point values
-+ // are rendered like '.0.5' instead of '-0.5'
-+ std::string res(stream.str());
-+
-+ if (signbit(f)) { // test if f is negative
-+ res[0] = '-';
-+ }
-+
-+ sink.append(res);
- return *this;
- }
- // Write boolean values as their names instead of integral value.
-diff --git a/third_party/angle/src/libANGLE/Constants.h b/third_party/angle/src/libANGLE/Constants.h
-index fcbc9246a..39ae66148 100644
---- a/third_party/angle/src/libANGLE/Constants.h
-+++ b/third_party/angle/src/libANGLE/Constants.h
-@@ -9,6 +9,7 @@
- #ifndef LIBANGLE_CONSTANTS_H_
- #define LIBANGLE_CONSTANTS_H_
-
-+#include <cstddef>
- #include "common/platform.h"
-
- #include <stdint.h>
-diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
-index 17cf9cda9..8ce96bd32 100644
---- a/third_party/boringssl/BUILD.gn
-+++ b/third_party/boringssl/BUILD.gn
-@@ -103,6 +103,13 @@ if (is_win && !is_msan && current_cpu != "arm64") {
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-+ } else if (current_cpu == "ppc64") {
-+ if (is_linux) {
-+ # TODO: ppc64 (be) check
-+ sources += crypto_sources_linux_ppc64le
-+ } else {
-+ public_configs = [ ":no_asm_config" ]
-+ }
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-diff --git a/third_party/breakpad/BUILD.gn b/third_party/breakpad/BUILD.gn
-index 4af3d7bbf..adbf54159 100644
---- a/third_party/breakpad/BUILD.gn
-+++ b/third_party/breakpad/BUILD.gn
-@@ -596,7 +596,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/minidump_file_writer.h",
- "breakpad/src/common/convert_UTF.cc",
- "breakpad/src/common/convert_UTF.h",
-- "breakpad/src/common/linux/breakpad_getcontext.S",
- "breakpad/src/common/linux/elf_core_dump.cc",
- "breakpad/src/common/linux/elf_core_dump.h",
- "breakpad/src/common/linux/elfutils.cc",
-@@ -634,6 +633,14 @@ if (is_linux || is_chromeos || is_android) {
-
- libs = [ "dl" ]
-
-+ if (current_cpu == "ppc64") {
-+ defines = [ "HAVE_GETCONTEXT" ]
-+ } else {
-+ sources += [
-+ "breakpad/src/common/linux/breakpad_getcontext.S"
-+ ]
-+ }
-+
- include_dirs = [
- ".",
- "breakpad/src",
-@@ -682,7 +689,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc",
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
- "breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
-- "breakpad/src/common/linux/breakpad_getcontext_unittest.cc",
- "breakpad/src/common/linux/elf_core_dump_unittest.cc",
- "breakpad/src/common/linux/file_id_unittest.cc",
- "breakpad/src/common/linux/linux_libc_support_unittest.cc",
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-index 07d9171a0..9aed4cb36 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-@@ -44,6 +44,8 @@ typedef MDRawContextARM RawContextCPU;
- typedef MDRawContextARM64_Old RawContextCPU;
- #elif defined(__mips__)
- typedef MDRawContextMIPS RawContextCPU;
-+#elif defined(__powerpc64__)
-+typedef MDRawContextPPC64 RawContextCPU;
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index aae1dc13b..03afec7a5 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -270,7 +270,42 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->float_save.fir = mcontext.fpc_eir;
- #endif
- }
--#endif // __mips__
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t ThreadInfo::GetInstructionPointer() const {
-+ return mcontext.gp_regs[PT_NIP];
-+}
-+
-+void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = mcontext.gp_regs[i];
-+
-+ out->lr = mcontext.gp_regs[PT_LNK];
-+ out->srr0 = mcontext.gp_regs[PT_NIP];
-+ out->srr1 = mcontext.gp_regs[PT_MSR];
-+ out->cr = mcontext.gp_regs[PT_CCR];
-+ out->xer = mcontext.gp_regs[PT_XER];
-+ out->ctr = mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] = \
-+ {(((uint64_t)vregs.vrregs[i][0]) << 32)
-+ | vregs.vrregs[i][1],
-+ (((uint64_t)vregs.vrregs[i][2]) << 32)
-+ | vregs.vrregs[i][3]};
-+
-+ out->vrsave = vregs.vrsave;
-+ out->vector_save.save_vscr = {0, vregs.vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+#endif // __powerpc64__
-
- void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- assert(gp_regs || size);
-@@ -279,6 +314,11 @@ void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- *gp_regs = mcontext.gregs;
- if (size)
- *size = sizeof(mcontext.gregs);
-+#elif defined(__powerpc64__)
-+ if (gp_regs)
-+ *gp_regs = mcontext.gp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.gp_regs);
- #else
- if (gp_regs)
- *gp_regs = ®s;
-@@ -294,6 +334,11 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- *fp_regs = &mcontext.fpregs;
- if (size)
- *size = sizeof(mcontext.fpregs);
-+#elif defined(__powerpc64__)
-+ if (fp_regs)
-+ *fp_regs = &mcontext.fp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.fp_regs);
- #else
- if (fp_regs)
- *fp_regs = &fpregs;
-@@ -302,4 +347,13 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- #endif
- }
-
-+#if defined(__powerpc64__)
-+void ThreadInfo::GetVectorRegisters(void** v_regs, size_t* size) {
-+ if (v_regs)
-+ *v_regs = &vregs;
-+ if (size)
-+ *size = sizeof(vregs);
-+}
-+#endif
-+
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-index fb216fa6d..593aac822 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-@@ -68,6 +68,10 @@ struct ThreadInfo {
- // Use the structures defined in <sys/user.h>
- struct user_regs_struct regs;
- struct user_fpsimd_struct fpregs;
-+#elif defined(__powerpc64__)
-+ // Use the structures defined in <sys/ucontext.h>.
-+ mcontext_t mcontext;
-+ vrregset_t vregs;
- #elif defined(__mips__)
- // Use the structure defined in <sys/ucontext.h>.
- mcontext_t mcontext;
-@@ -84,6 +88,11 @@ struct ThreadInfo {
-
- // Returns the pointer and size of float point register area.
- void GetFloatingPointRegisters(void** fp_regs, size_t* size);
-+
-+#if defined(__powerpc64__)
-+ // Returns the pointer and size of the vector register area. (PPC64 only)
-+ void GetVectorRegisters(void** v_regs, size_t* size);
-+#endif
- };
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 6eec1be24..741983a1a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -254,6 +254,48 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc) {
- out->float_save.fir = uc->uc_mcontext.fpc_eir; // Unused.
- #endif
- }
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
-+}
-+
-+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[PT_NIP];
-+}
-+
-+void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
-+ const vrregset_t* vregs) {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = uc->uc_mcontext.gp_regs[i];
-+
-+ out->lr = uc->uc_mcontext.gp_regs[PT_LNK];
-+ out->srr0 = uc->uc_mcontext.gp_regs[PT_NIP];
-+ out->srr1 = uc->uc_mcontext.gp_regs[PT_MSR];
-+ out->cr = uc->uc_mcontext.gp_regs[PT_CCR];
-+ out->xer = uc->uc_mcontext.gp_regs[PT_XER];
-+ out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] =
-+ {(((uint64_t)vregs->vrregs[i][0]) << 32)
-+ | vregs->vrregs[i][1],
-+ (((uint64_t)vregs->vrregs[i][2]) << 32)
-+ | vregs->vrregs[i][3]};
-+
-+ out->vrsave = vregs->vrsave;
-+ out->vector_save.save_vscr = {0, vregs->vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+
- #endif
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-index 7d4100881..c122ac92e 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-@@ -55,6 +55,9 @@ struct UContextReader {
- #elif defined(__aarch64__)
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- const struct fpsimd_context* fpregs);
-+#elif defined(__powerpc64__)
-+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
-+ const vrregset_t* vregs);
- #else
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc);
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index a6cb5f984..ae16b64d9 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -461,9 +461,16 @@ bool ExceptionHandler::HandleSignal(int /*sig*/, siginfo_t* info, void* uc) {
- memcpy(&g_crash_context_.float_state, fp_ptr,
- sizeof(g_crash_context_.float_state));
- }
-+#elif defined(__powerpc64__)
-+ // On PPC64, we must copy VR state
-+ ucontext_t* uc_ptr = (ucontext_t*)uc;
-+ if (uc_ptr->uc_mcontext.v_regs) {
-+ memcpy(&g_crash_context_.vector_state, uc_ptr->uc_mcontext.v_regs,
-+ sizeof(g_crash_context_.vector_state));
-+ }
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- // FP state is not part of user ABI on ARM Linux.
-- // In case of MIPS Linux FP state is already part of ucontext_t
-+ // In case of MIPS, Linux FP state is already part of ucontext_t
- // and 'float_state' is not a member of CrashContext.
- ucontext_t* uc_ptr = (ucontext_t*)uc;
- if (uc_ptr->uc_mcontext.fpregs) {
-@@ -708,11 +715,19 @@ bool ExceptionHandler::WriteMinidump() {
- }
- #endif
-
--#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__)
-+#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__) \
-+ && !defined(__powerpc64__)
- // FPU state is not part of ARM EABI ucontext_t.
- memcpy(&context.float_state, context.context.uc_mcontext.fpregs,
- sizeof(context.float_state));
- #endif
-+
-+#if defined(__powerpc64__)
-+ // Vector registers must be copied on PPC64
-+ memcpy(&context.vector_state, context.context.uc_mcontext.v_regs,
-+ sizeof(context.vector_state));
-+#endif
-+
- context.tid = sys_gettid();
-
- // Add an exception stream to the minidump for better reporting.
-@@ -733,6 +748,9 @@ bool ExceptionHandler::WriteMinidump() {
- #elif defined(__mips__)
- context.siginfo.si_addr =
- reinterpret_cast<void*>(context.context.uc_mcontext.pc);
-+#elif defined(__powerpc64__)
-+ context.siginfo.si_addr =
-+ reinterpret_cast<void*>(context.context.uc_mcontext.gp_regs[PT_NIP]);
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-index f80843ea7..260dd10f7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-@@ -192,7 +192,11 @@ class ExceptionHandler {
- siginfo_t siginfo;
- pid_t tid; // the crashing thread.
- ucontext_t context;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ // PPC64's FP state is a part of ucontext_t like MIPS but the vector
-+ // state is not, so a struct is needed.
-+ vstate_t vector_state;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- // #ifdef this out because FP state is not part of user ABI for Linux ARM.
- // In case of MIPS Linux FP state is already part of ucontext_t so
- // 'float_state' is not required.
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-index 35dcbfd4d..7934370fd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-@@ -307,7 +307,7 @@ TEST(ExceptionHandlerTest, ParallelChildCrashesDontHang) {
- }
-
- // Wait a while until the child should have crashed.
-- usleep(1000000);
-+ usleep(2000000);
- // Kill the child if it is still running.
- kill(child, SIGKILL);
-
-@@ -559,6 +559,8 @@ const unsigned char kIllegalInstruction[] = {
- #if defined(__mips__)
- // mfc2 zero,Impl - usually illegal in userspace.
- 0x48, 0x00, 0x00, 0x48
-+#elif defined(__powerpc64__)
-+ 0x01, 0x01, 0x01, 0x01 // Crashes on a tested POWER9 cpu
- #else
- // This crashes with SIGILL on x86/x86-64/arm.
- 0xff, 0xff, 0xff, 0xff
-@@ -754,10 +756,10 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
-
- // These are defined here so the parent can use them to check the
- // data from the minidump afterwards.
-- // Use 4k here because the OS will hand out a single page even
-+ // Use the page size here because the OS will hand out a single page even
- // if a smaller size is requested, and this test wants to
- // test the upper bound of the memory range.
-- const uint32_t kMemorySize = 4096; // bytes
-+ const uint32_t kMemorySize = getpagesize(); // bytes
- const int kOffset = kMemorySize - sizeof(kIllegalInstruction);
-
- const pid_t child = fork();
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-index fa3c1713a..6ce709e2f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-@@ -138,7 +138,9 @@ class MicrodumpWriter {
- const MicrodumpExtraInfo& microdump_extra_info,
- LinuxDumper* dumper)
- : ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -337,6 +339,8 @@ class MicrodumpWriter {
- # else
- # error "This mips ABI is currently not supported (n32)"
- #endif
-+#elif defined(__powerpc64__)
-+ const char kArch[] = "ppc64";
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -409,7 +413,9 @@ class MicrodumpWriter {
- void DumpCPUState() {
- RawContextCPU cpu;
- my_memset(&cpu, 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(&cpu, ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(&cpu, ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(&cpu, ucontext_);
-@@ -605,7 +611,9 @@ class MicrodumpWriter {
- void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); }
-
- const ucontext_t* const ucontext_;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_;
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-index 6339ac0cd..291af106b 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-@@ -279,10 +279,19 @@ TEST(MicrodumpWriterTest, BasicWithMappings) {
- CrashAndGetMicrodump(mappings, MicrodumpExtraInfo(), &buf);
- ASSERT_TRUE(ContainsMicrodump(buf));
-
-+ int page_size = getpagesize();
- #ifdef __LP64__
-- ASSERT_NE(std::string::npos,
-- buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-- "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ // This test is only available for the following page sizes
-+ ASSERT_TRUE((page_size == 4096) || (page_size == 65536));
-+ if (page_size == 4096) {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ } else {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000010000 000000000000002A 0000000000010000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ }
- #else
- ASSERT_NE(std::string::npos,
- buf.find("M 00001000 0000002A 00001000 "
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-index 415068983..b93e4afcf 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-@@ -112,6 +112,9 @@ bool LinuxCoreDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-@@ -197,7 +200,10 @@ bool LinuxCoreDumper::EnumerateThreads() {
- memset(&info, 0, sizeof(ThreadInfo));
- info.tgid = status->pr_pgrp;
- info.ppid = status->pr_ppid;
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ for (int i = 0; i < 31; i++)
-+ info.mcontext.gp_regs[i] = status->pr_reg[i];
-+#elif defined(__mips__)
- #if defined(__ANDROID__)
- for (int i = EF_R0; i <= EF_R31; i++)
- info.mcontext.gregs[i - EF_R0] = status->pr_reg[i];
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-index 7fd6532ad..199cbfffd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-@@ -765,7 +765,9 @@ bool LinuxDumper::GetStackInfo(const void** stack, size_t* stack_len,
- reinterpret_cast<uint8_t*>(int_stack_pointer & ~(page_size - 1));
-
- // The number of bytes of stack which we try to capture.
-- static const ptrdiff_t kStackToCapture = 32 * 1024;
-+ // This now depends on page_size to avoid missing data
-+ // on systems with larger page sizes.
-+ static const ptrdiff_t kStackToCapture = 8 * page_size;
-
- const MappingInfo* mapping = FindMapping(stack_pointer);
- if (!mapping)
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-index 7bee160f1..07bb2b81a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-@@ -63,7 +63,8 @@ namespace google_breakpad {
- (defined(__mips__) && _MIPS_SIM == _ABIO32)
- typedef Elf32_auxv_t elf_aux_entry;
- #elif defined(__x86_64) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM != _ABIO32)
-+ (defined(__mips__) && _MIPS_SIM != _ABIO32) || \
-+ defined(__powerpc64__)
- typedef Elf64_auxv_t elf_aux_entry;
- #endif
-
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-index 331f4bb34..3f722947f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-@@ -51,6 +51,8 @@
- #define TID_PTR_REGISTER "rcx"
- #elif defined(__mips__)
- #define TID_PTR_REGISTER "$1"
-+#elif defined(__powerpc64__)
-+#define TID_PTR_REGISTER "r8"
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-index e3ddb81a6..fa28575ef 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-@@ -149,19 +149,27 @@ bool LinuxPtraceDumper::CopyFromProcess(void* dest, pid_t child,
- return true;
- }
-
--bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid)
--{
-+bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid) {
- #ifdef PTRACE_GETREGSET
- struct iovec io;
- info->GetGeneralPurposeRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
- return false;
- }
-
- info->GetFloatingPointRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
- return false;
- }
-+
-+#if defined(__powerpc64__)
-+ // Grab the vector registers on PPC64 too
-+ info->GetVectorRegisters(&io.iov_base, &io.iov_len);
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PPC_VMX, (void*)&io) == -1) {
-+ return false;
-+ }
-+#endif // defined(__powerpc64__)
-+
- return true;
- #else
- return false;
-@@ -298,6 +306,9 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-index da71e15dc..12bfb317a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-@@ -462,6 +462,9 @@ TEST(LinuxPtraceDumperTest, VerifyStackReadWithMultipleThreads) {
- #elif defined(__mips__)
- pid_t* process_tid_location =
- reinterpret_cast<pid_t*>(one_thread.mcontext.gregs[1]);
-+#elif defined(__powerpc64__)
-+ pid_t* process_tid_location =
-+ reinterpret_cast<pid_t*>(one_thread.mcontext.gp_regs[8]);
- #else
- #error This test has not been ported to this platform.
- #endif
-@@ -559,6 +562,8 @@ TEST_F(LinuxPtraceDumperTest, SanitizeStackCopy) {
- uintptr_t heap_addr = thread_info.regs.rcx;
- #elif defined(__mips__)
- uintptr_t heap_addr = thread_info.mcontext.gregs[1];
-+#elif defined(__powerpc64__)
-+ uintptr_t heap_addr = thread_info.mcontext.gp_regs[8];
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-index 32634ef00..2a56948de 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-@@ -136,7 +136,9 @@ class MinidumpWriter {
- : fd_(minidump_fd),
- path_(minidump_path),
- ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -468,7 +470,9 @@ class MinidumpWriter {
- if (!cpu.Allocate())
- return false;
- my_memset(cpu.get(), 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(cpu.get(), ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(cpu.get(), ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(cpu.get(), ucontext_);
-@@ -897,7 +901,7 @@ class MinidumpWriter {
- dirent->location.rva = 0;
- }
-
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || defined(__powerpc64__)
- bool WriteCPUInformation(MDRawSystemInfo* sys_info) {
- char vendor_id[sizeof(sys_info->cpu.x86_cpu_info.vendor_id) + 1] = {0};
- static const char vendor_id_name[] = "vendor_id";
-@@ -917,7 +921,9 @@ class MinidumpWriter {
-
- // processor_architecture should always be set, do this first
- sys_info->processor_architecture =
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ MD_CPU_ARCHITECTURE_PPC64;
-+#elif defined(__mips__)
- # if _MIPS_SIM == _ABIO32
- MD_CPU_ARCHITECTURE_MIPS;
- # elif _MIPS_SIM == _ABI64
-@@ -1333,7 +1339,9 @@ class MinidumpWriter {
- const char* path_; // Path to the file where the minidum should be written.
-
- const ucontext_t* const ucontext_; // also from the signal handler
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_; // ditto
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-index e3b0b16da..ccd8aa0a4 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-@@ -48,6 +48,8 @@ class ExceptionHandler;
-
- #if defined(__aarch64__)
- typedef struct fpsimd_context fpstate_t;
-+#elif defined(__powerpc64__)
-+typedef vrregset_t vstate_t;
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- typedef std::remove_pointer<fpregset_t>::type fpstate_t;
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-index d192e5cbb..fc1bfa8d7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-@@ -715,6 +715,9 @@ TEST(MinidumpWriterTest, InvalidStackPointer) {
- #elif defined(__mips__)
- context.context.uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP] =
- invalid_stack_pointer;
-+#elif defined(__powerpc64__)
-+ context.context.uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP] =
-+ invalid_stack_pointer;
- #else
- # error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-index 99362945c..c54ba7145 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-@@ -65,8 +65,7 @@ bool MemoryMappedFile::Map(const char* path, size_t offset) {
- }
-
- #if defined(__x86_64__) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM == _ABI64)
--
-+ (defined(__mips__) && _MIPS_SIM == _ABI64) || defined(__powerpc64__)
- struct kernel_stat st;
- if (sys_fstat(fd, &st) == -1 || st.st_size < 0) {
- #else
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-index fad59f40c..616496d67 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-@@ -176,9 +176,10 @@ TEST_F(MemoryMappedFileTest, RemapAfterMap) {
- TEST_F(MemoryMappedFileTest, MapWithOffset) {
- // Put more data in the test file this time. Offsets can only be
- // done on page boundaries, so we need a two page file to test this.
-- const int page_size = 4096;
-- char data1[2 * page_size];
-- size_t data1_size = sizeof(data1);
-+ const int page_size = getpagesize();
-+ char *data1 = static_cast<char*>(malloc(2 * page_size));
-+ EXPECT_TRUE(data1 != NULL);
-+ size_t data1_size = (2 * page_size);
- for (size_t i = 0; i < data1_size; ++i) {
- data1[i] = i & 0x7f;
- }
-diff --git a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-index 5803b90d5..2a1cf14f0 100644
---- a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-@@ -57,8 +57,9 @@ TEST(PageAllocatorTest, LargeObject) {
-
- EXPECT_EQ(0U, allocator.pages_allocated());
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(10000));
-+ uint64_t expected_pages = 1 + ((10000 - 1) / getpagesize());
- ASSERT_FALSE(p == NULL);
-- EXPECT_EQ(3U, allocator.pages_allocated());
-+ EXPECT_EQ(expected_pages, allocator.pages_allocated());
- for (unsigned i = 1; i < 10; ++i) {
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(i));
- ASSERT_FALSE(p == NULL);
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-index 798056dfa..22bd81fff 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-@@ -202,12 +202,14 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) {
- // Check architecture and set architecture variable to corresponding flag
- // in objdump.
- switch (context->GetContextCPU()) {
-+#if defined(__i386) || defined(__x86_64)
- case MD_CONTEXT_X86:
- architecture = "i386";
- break;
- case MD_CONTEXT_AMD64:
- architecture = "i386:x86-64";
- break;
-+#endif
- default:
- // Unsupported architecture. Note that ARM architectures are not
- // supported because objdump does not support ARM.
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-index 528ee5f21..72764d6c1 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-@@ -104,6 +104,8 @@ ExploitabilityFor(const string& filename) {
- }
-
- TEST(ExploitabilityTest, TestWindowsEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("ascii_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -136,9 +138,12 @@ TEST(ExploitabilityTest, TestWindowsEngine) {
- ExploitabilityFor("read_av_clobber_write.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_LOW,
- ExploitabilityFor("read_av_conditional.dmp"));
-+#endif
- }
-
- TEST(ExploitabilityTest, TestLinuxEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if defined(__i386) || defined(__x86_64)
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_null_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -171,7 +176,8 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_executable_heap.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_jmp_to_module_not_exe_region.dmp"));
--#ifndef _WIN32
-+#endif
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_write_to_nonwritable_module.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -182,10 +188,10 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_write_to_outside_module_via_math.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_write_to_under_4k.dmp"));
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (!defined(__i386) && !defined(__x86_64))
- }
-
--#ifndef _WIN32
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- TEST(ExploitabilityLinuxUtilsTest, DisassembleBytesTest) {
- ASSERT_FALSE(ExploitabilityLinuxTest::DisassembleBytes("", NULL, 5, NULL));
- uint8_t bytes[6] = {0xc7, 0x0, 0x5, 0x0, 0x0, 0x0};
-@@ -301,6 +307,7 @@ TEST(ExploitabilityLinuxUtilsTest, CalculateAddressTest) {
- context,
- &write_address));
- }
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
-+
-
- } // namespace
-diff --git a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-index aade82c99..195aa73f3 100644
---- a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-+++ b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-@@ -77,6 +77,8 @@
- #define ELF_ARCH EM_MIPS
- #elif defined(__aarch64__)
- #define ELF_ARCH EM_AARCH64
-+#elif defined(__powerpc64__)
-+ #define ELF_ARCH EM_PPC64
- #endif
-
- #if defined(__arm__)
-@@ -87,6 +89,8 @@ typedef user_regs user_regs_struct;
- #elif defined (__mips__)
- // This file-local typedef simplifies the source code.
- typedef gregset_t user_regs_struct;
-+#elif defined(__powerpc64__)
-+typedef struct pt_regs user_regs_struct;
- #endif
-
- using google_breakpad::MDTypeHelper;
-@@ -321,6 +325,9 @@ struct CrashedProcess {
- #endif
- #if defined(__aarch64__)
- user_fpsimd_struct fpregs;
-+#endif
-+#if defined(__powerpc64__)
-+ mcontext_t mcontext;
- #endif
- uintptr_t stack_addr;
- const uint8_t* stack;
-@@ -535,6 +542,38 @@ ParseThreadRegisters(CrashedProcess::Thread* thread,
- thread->mcontext.fpc_eir = rawregs->float_save.fir;
- #endif
- }
-+#elif defined(__powerpc64__)
-+static void
-+ParseThreadRegisters(CrashedProcess::Thread* thread,
-+ const MinidumpMemoryRange& range) {
-+ const MDRawContextPPC64* rawregs = range.GetData<MDRawContextPPC64>(0);
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ thread->mcontext.gp_regs[i] = rawregs->gpr[i];
-+
-+ thread->mcontext.gp_regs[PT_LNK] = rawregs->lr;
-+ thread->mcontext.gp_regs[PT_NIP] = rawregs->srr0;
-+ thread->mcontext.gp_regs[PT_MSR] = rawregs->srr1;
-+ thread->mcontext.gp_regs[PT_CCR] = rawregs->cr;
-+ thread->mcontext.gp_regs[PT_XER] = rawregs->xer;
-+ thread->mcontext.gp_regs[PT_CTR] = rawregs->ctr;
-+ thread->mcontext.v_regs->vrsave = rawregs->vrsave;
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ thread->mcontext.fp_regs[i] = rawregs->float_save.fpregs[i];
-+
-+ thread->mcontext.fp_regs[NFPREG-1] = rawregs->float_save.fpscr;
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++) {
-+ thread->mcontext.v_regs->vrregs[i][0] = rawregs->vector_save.save_vr[i].high >> 32;
-+ thread->mcontext.v_regs->vrregs[i][1] = rawregs->vector_save.save_vr[i].high;
-+ thread->mcontext.v_regs->vrregs[i][2] = rawregs->vector_save.save_vr[i].low >> 32;
-+ thread->mcontext.v_regs->vrregs[i][3] = rawregs->vector_save.save_vr[i].low;
-+ }
-+
-+ thread->mcontext.v_regs->vscr.vscr_word = rawregs->vector_save.save_vscr.low & 0xFFFFFFFF;
-+}
-+
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -623,6 +662,12 @@ ParseSystemInfo(const Options& options, CrashedProcess* crashinfo,
- # else
- # error "This mips ABI is currently not supported (n32)"
- # endif
-+#elif defined(__powerpc64__)
-+ if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_PPC64) {
-+ fprintf(stderr,
-+ "This version of minidump-2-core only supports PPC64.\n");
-+ exit(1);
-+ }
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-diff --git a/third_party/crashpad/crashpad/CONTRIBUTORS b/third_party/crashpad/crashpad/CONTRIBUTORS
-index 8724b7f32..8e29424ef 100644
---- a/third_party/crashpad/crashpad/CONTRIBUTORS
-+++ b/third_party/crashpad/crashpad/CONTRIBUTORS
-@@ -13,3 +13,4 @@ Mark Mentovai <mark@chromium.org>
- Robert Sesek <rsesek@chromium.org>
- Scott Graham <scottmg@chromium.org>
- Joshua Peraza <jperaza@chromium.org>
-+Shawn Anastasio <shawn@anastas.io>
-diff --git a/third_party/crashpad/crashpad/compat/linux/sys/user.h b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-index 6ed77a98e..1fd83469a 100644
---- a/third_party/crashpad/crashpad/compat/linux/sys/user.h
-+++ b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_COMPAT_LINUX_SYS_USER_H_
- #define CRASHPAD_COMPAT_LINUX_SYS_USER_H_
-
-+#include <cstddef>
- #include_next <sys/user.h>
-
- #include <features.h>
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context.h b/third_party/crashpad/crashpad/minidump/minidump_context.h
-index 3a3e603cb..3118d9e9f 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context.h
-@@ -592,6 +592,70 @@ struct MinidumpContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief ppc64-specific flags for MinidumpPPC64::context_flags
-+//! Based on minidump_cpu_ppc64.h from breakpad
-+enum MinidumpContextPPC64Flags : uint32_t {
-+ //! \brief Identifies the context as PPC64.
-+ kMinidumpContextPPC64 = 0x01000000,
-+
-+ //! \brief Indicates the validity of general purpose registers.
-+ //!
-+ //! Registers `r0`-`r31`, `nip`, `msr`, `lr`, etc. are valid.
-+ kMinidumpContextPPC64Base = kMinidumpContextPPC64 | 0x00000001,
-+
-+ //! \brief Indicates the validity of floating point registers.
-+ //!
-+ //! Registers `fp0`-`fp31`, `fpscr` are valid.
-+ kMinidumpContextPPC64Floating = kMinidumpContextPPC64 | 0x00000008,
-+
-+ //! \brief Indicates the validity of Altivec/VMX registers.
-+ //!
-+ //! Registers `v0`-`v31`, `vscr`, `vrsave`.
-+ kMinidumpContextPPC64Vector = kMinidumpContextPPC64 | 0x00000020,
-+
-+ //! \brief Indicates the validity of all registers
-+ kMinidumpContextPPC64All = kMinidumpContextPPC64Base |
-+ kMinidumpContextPPC64Floating |
-+ kMinidumpContextPPC64Vector
-+};
-+
-+//! \brief A PPC64 CPU context carried in a minidump file.
-+//! Based on minidump_cpu_ppc64.h from breakpad.
-+struct MinidumpContextPPC64 {
-+ uint64_t context_flags;
-+
-+ //! \brief General purpose registers.
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+
-+ //! \brief Floating point registers.
-+ double fpregs[32];
-+
-+ //! \brief FPU status register.
-+ double fpscr;
-+
-+ //! \brief Altivec/VMX vector registers.
-+ struct {
-+ //! \brief Vector registers are 128bits.
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad5[4];
-+
-+ //! \brief VRSAVE register.
-+ uint32_t save_vrsave;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad6[7];
-+ } vregs;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-index d7e53a493..d89eb9e01 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-@@ -101,6 +101,13 @@ MinidumpContextWriter::CreateFromSnapshot(const CPUContext* context_snapshot) {
- break;
- }
-
-+ case kCPUArchitecturePPC64: {
-+ context = std::make_unique<MinidumpContextPPC64Writer>();
-+ reinterpret_cast<MinidumpContextPPC64Writer*>(context.get())
-+ ->InitalizeFromSnapshot(context_snapshot->ppc64);
-+ break;
-+ }
-+
- default: {
- LOG(ERROR) << "unknown context architecture "
- << context_snapshot->architecture;
-@@ -453,4 +460,47 @@ size_t MinidumpContextMIPS64Writer::ContextSize() const {
- return sizeof(context_);
- }
-
-+MinidumpContextPPC64Writer::MinidumpContextPPC64Writer()
-+ : MinidumpContextWriter(), context_() {
-+ context_.context_flags = kMinidumpContextPPC64;
-+}
-+
-+MinidumpContextPPC64Writer::~MinidumpContextPPC64Writer() = default;
-+
-+void MinidumpContextPPC64Writer::InitalizeFromSnapshot(
-+ const CPUContextPPC64* context_snapshot) {
-+ DCHECK_EQ(state(), kStateMutable);
-+ DCHECK_EQ(context_.context_flags, kMinidumpContextPPC64);
-+
-+ context_.context_flags = kMinidumpContextPPC64All;
-+
-+ memcpy(context_.regs, context_snapshot->regs, sizeof(context_.regs));
-+ context_.nip = context_snapshot->nip;
-+ context_.msr = context_snapshot->msr;
-+ context_.ccr = context_snapshot->ccr;
-+ context_.xer = context_snapshot->xer;
-+ context_.lnk = context_snapshot->lnk;
-+ context_.ctr = context_snapshot->ctr;
-+
-+ memcpy(context_.fpregs, context_snapshot->fpregs, sizeof(context_.fpregs));
-+ context_.fpscr = context_snapshot->fpscr;
-+
-+ memcpy(context_.vregs.save_vr, context_snapshot->vregs.save_vr,
-+ sizeof(context_.vregs.save_vr));
-+ memcpy(&context_.vregs.save_vscr, &context_snapshot->vregs.save_vscr,
-+ sizeof(context_.vregs.save_vscr));
-+ context_.vregs.save_vrsave = context_snapshot->vregs.save_vrsave;
-+}
-+
-+bool MinidumpContextPPC64Writer::WriteObject(
-+ FileWriterInterface* file_writer) {
-+ DCHECK_EQ(state(), kStateWritable);
-+ return file_writer->Write(&context_, sizeof(context_));
-+}
-+
-+size_t MinidumpContextPPC64Writer::ContextSize() const {
-+ DCHECK_GE(state(), kStateFrozen);
-+ return sizeof(context_);
-+}
-+
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-index d4ab936ee..1d22fc59c 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-@@ -315,6 +315,43 @@ class MinidumpContextMIPS64Writer final : public MinidumpContextWriter {
- MinidumpContextMIPS64 context_;
- };
-
-+class MinidumpContextPPC64Writer final : public MinidumpContextWriter {
-+ public:
-+ MinidumpContextPPC64Writer();
-+ ~MinidumpContextPPC64Writer() override;
-+
-+ //! \brief Initalizes the MinidumpContextPPC64 based on \a context_snapshot.
-+ //!
-+ //! \param[in] context_snapshot The context snapshot to use as source data.
-+ //!
-+ //! \note Valid in #kStateMutable. No mutation of context() may be done before
-+ //! calling this method, and it is not normally necessary to alter
-+ //! context() after calling this method.
-+ void InitalizeFromSnapshot(const CPUContextPPC64* context_snapshot);
-+
-+ //! \brief Returns a pointer to the context structure that this object will
-+ //! write.
-+ //!
-+ //! \attention This returns a non-`const` pointer to this object’s private
-+ //! data so that a caller can populate the context structure directly.
-+ //! This is done because providing setter interfaces to each field in the
-+ //! context structure would be unwieldy and cumbersome. Care must be taken
-+ //! to populate the context structure correctly. The context structure
-+ //! must only be modified while this object is in the #kStateMutable
-+ //! state.
-+ MinidumpContextPPC64* context() { return &context_; }
-+
-+ protected:
-+ // MinidumpWritable:
-+ bool WriteObject(FileWriterInterface* file_writer) override;
-+
-+ // MinidumpContextWriter:
-+ size_t ContextSize() const override;
-+
-+ private:
-+ MinidumpContextPPC64 context_;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_WRITER_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-index 3216a906b..a9fcbe9d8 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-@@ -213,6 +213,21 @@ TEST(MinidumpContextWriter, MIPS64_FromSnapshot) {
- context, ExpectMinidumpContextMIPS64, kSeed);
- }
-
-+TEST(MinidumpContextWriter, PPC64_Zeros) {
-+ EmptyContextTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ ExpectMinidumpContextPPC64);
-+}
-+
-+TEST(MinidumpContextWriter, PPC64_FromSnapshot) {
-+ constexpr uint32_t kSeed = 64;
-+ CPUContextPPC64 context_ppc64;
-+ CPUContext context;
-+ context.ppc64 = &context_ppc64;
-+ InitializeCPUContextPPC64(&context, kSeed);
-+ FromSnapshotTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ context, ExpectMinidumpContextPPC64, kSeed);
-+}
-+
- } // namespace
- } // namespace test
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-index 0974e3ddf..b71ec5880 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-@@ -135,6 +135,8 @@ std::string MinidumpMiscInfoDebugBuildString() {
- static constexpr char kCPU[] = "mips";
- #elif defined(ARCH_CPU_MIPS64EL)
- static constexpr char kCPU[] = "mips64";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kCPU[] = "ppc64";
- #else
- #error define kCPU for this CPU
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/capture_memory.cc b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-index 7a1b2763c..beda8da9e 100644
---- a/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-+++ b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-@@ -112,6 +112,11 @@ void CaptureMemory::PointedToByContext(const CPUContext& context,
- for (size_t i = 0; i < std::size(context.mipsel->regs); ++i) {
- MaybeCaptureMemoryAround(delegate, context.mipsel->regs[i]);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->nip);
-+ for (size_t i = 0; i < std::size(context.ppc64->regs); ++i) {
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->regs[i]);
-+ }
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-index 811a72095..f4f83981d 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-@@ -43,7 +43,10 @@ enum CPUArchitecture {
- kCPUArchitectureMIPSEL,
-
- //! \brief 64-bit MIPSEL.
-- kCPUArchitectureMIPS64EL
-+ kCPUArchitectureMIPS64EL,
-+
-+ //! \brief 64-bit PPC64.
-+ kCPUArchitecturePPC64
- };
-
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.cc b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-index c75b5555e..aeade577a 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-@@ -169,6 +169,8 @@ uint64_t CPUContext::InstructionPointer() const {
- return arm->pc;
- case kCPUArchitectureARM64:
- return arm64->pc;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->nip;
- default:
- NOTREACHED();
- return ~0ull;
-@@ -185,6 +187,8 @@ uint64_t CPUContext::StackPointer() const {
- return arm->sp;
- case kCPUArchitectureARM64:
- return arm64->sp;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->regs[1];
- default:
- NOTREACHED();
- return ~0ull;
-@@ -196,6 +200,7 @@ bool CPUContext::Is64Bit() const {
- case kCPUArchitectureX86_64:
- case kCPUArchitectureARM64:
- case kCPUArchitectureMIPS64EL:
-+ case kCPUArchitecturePPC64:
- return true;
- case kCPUArchitectureX86:
- case kCPUArchitectureARM:
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.h b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-index fb23c4679..eebede63c 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-@@ -352,6 +352,24 @@ struct CPUContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief A context structure carrying PPC64 CPU state.
-+struct CPUContextPPC64 {
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+ double fpregs[32];
-+ double fpscr;
-+ struct {
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+ uint32_t save_vrsave;
-+ } vregs;
-+};
-+
- //! \brief A context structure capable of carrying the context of any supported
- //! CPU architecture.
- struct CPUContext {
-@@ -382,6 +400,7 @@ struct CPUContext {
- CPUContextARM64* arm64;
- CPUContextMIPS* mipsel;
- CPUContextMIPS64* mips64;
-+ CPUContextPPC64* ppc64;
- };
- };
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-index 9f46a4897..aa677c4eb 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
- #define CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
-
-+#include <cstring>
- #include "build/build_config.h"
- #include "snapshot/cpu_context.h"
- #include "snapshot/linux/signal_context.h"
-@@ -174,6 +175,78 @@ void InitializeCPUContextMIPS(
-
- #endif // ARCH_CPU_MIPS_FAMILY || DOXYGEN
-
-+#if defined(ARCH_CPU_PPC64_FAMILY) || DOXYGEN
-+
-+//! \brief Initalizes a CPUContextPPC64 structure from native context
-+//! structures on Linux.
-+//!
-+//! \param[in] thread_context The native thread context.
-+//! \param[in] float_context The native float context.
-+//! \param[in] vector_context The native vector context.
-+//! \param[out] context The CPUContextPPC64 structure to initalize.
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const ThreadContext::t64_t& thread_context,
-+ const FloatContext::f64_t& float_context,
-+ const VectorContext::v64_t& vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.gpr, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.fpregs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const SignalThreadContext64 &thread_context,
-+ const SignalFloatContext64 &float_context,
-+ const SignalVectorContext64 &vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.regs, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.regs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+
-+#endif
-+
- } // namespace internal
- } // namespace crashpad
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-index d32bd1937..2dd538c2b 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-@@ -192,6 +192,8 @@ void TestAgainstTarget(PtraceConnection* connection) {
- device == 0 && inode == 0 && mapping_name == "[vdso]";
- #if defined(ARCH_CPU_X86)
- static constexpr char kPrefix[] = "linux-gate.so.";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kPrefix[] = "linux-vdso64.so.";
- #else
- static constexpr char kPrefix[] = "linux-vdso.so.";
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-index cd40b3b12..6bcf23b6f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-@@ -323,6 +323,69 @@ bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
- reader, context_address, context_.mips64);
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+template <typename Traits>
-+static bool ReadContext(ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address,
-+ typename Traits::CPUContext* dest_context) {
-+ const ProcessMemory* memory = reader->Memory();
-+
-+ LinuxVMAddress gp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, gp_regs);
-+
-+ typename Traits::SignalThreadContext thread_context;
-+ if (!memory->Read(gp_regs_address, sizeof(thread_context), &thread_context)) {
-+ LOG(ERROR) << "Couldn't read gp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress fp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, fp_regs);
-+
-+ typename Traits::SignalFloatContext fp_context;
-+ if (!memory->Read(fp_regs_address, sizeof(fp_context), &fp_context)) {
-+ LOG(ERROR) << "Couldn't read fp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress v_regs_ptr_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, vmx_reserve) + 8;
-+
-+ typename Traits::SignalVectorContext v_context;
-+ if (!memory->Read(v_regs_ptr_address, sizeof(v_context), &v_context)) {
-+ LOG(ERROR) << "Couldn't read v_regs!";
-+ return false;
-+ }
-+
-+ InitializeCPUContextPPC64<ContextTraits64>(thread_context, fp_context,
-+ v_context, dest_context);
-+
-+ return true;
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+
-+ return internal::ReadContext<ContextTraits64>(
-+ reader, context_address, context_.ppc64);
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits32>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ // PPC64 is 64-bit
-+ return false;
-+}
-+
- #endif // ARCH_CPU_X86_FAMILY
-
- bool ExceptionSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-index ea0cd2106..e42df520f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-@@ -84,6 +84,8 @@ class ExceptionSnapshotLinux final : public ExceptionSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #endif
- } context_union_;
- CPUContext context_;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-index c17170b43..b6a714cc6 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-@@ -296,7 +296,28 @@ void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
- 0);
- #undef CPU_ARCH_NAME
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+using NativeCPUContext = ucontext_t;
-+
-+void InitializeContext(NativeCPUContext* context) {
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ context->uc_mcontext.gp_regs[reg] = reg;
-+ }
-+
-+ memset(&context->uc_mcontext.fp_regs, 44,
-+ sizeof(context->uc_mcontext.fp_regs));
-+}
-
-+void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
-+ EXPECT_EQ(actual.architecture, kCPUArchitecturePPC64);
-+
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ EXPECT_EQ(actual.ppc64->regs[reg], expected.uc_mcontext.gp_regs[reg]);
-+ }
-+
-+ EXPECT_EQ(memcmp(actual.ppc64->fpregs, expected.uc_mcontext.fp_regs,
-+ sizeof(actual.ppc64->fpregs)), 0);
-+}
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-index ee246e8bc..9555dce04 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-@@ -108,6 +108,8 @@ void ProcessReaderLinux::Thread::InitializeStack(ProcessReaderLinux* reader) {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- stack_pointer = reader->Is64Bit() ? thread_info.thread_context.t64.regs[29]
- : thread_info.thread_context.t32.regs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ stack_pointer = thread_info.thread_context.t64.gpr[1];
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 110024680..a1f2da259 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -422,6 +422,89 @@ static_assert(offsetof(UContext<ContextTraits64>, mcontext.fpregs) ==
- "context offset mismatch");
- #endif
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+struct SignalThreadContext64 {
-+ uint64_t regs[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_r3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
-+ uint64_t dscr;
-+ uint64_t fpr0[3];
-+};
-+
-+struct SignalFloatContext64 {
-+ double regs[32];
-+ double fpscr;
-+};
-+
-+struct SignalVectorContext64 {
-+ int32_t vrregs[32][4];
-+ struct {
-+ int32_t __pad[3];
-+ int32_t vscr_word;
-+ } vscr;
-+ int32_t vrsave;
-+ int32_t __pad[3];
-+} __attribute__((__aligned__(16)));
-+
-+
-+#pragma pack(pop)
-+struct MContext64 {
-+ uint64_t reserved[4];
-+ int32_t signal;
-+ int32_t __pad0;
-+ uint64_t handler;
-+ uint64_t oldmask;
-+ uint64_t pt_regs_ptr;
-+ SignalThreadContext64 gp_regs;
-+ SignalFloatContext64 fp_regs;
-+ SignalVectorContext64 *v_regs;
-+ int64_t vmx_reserve[69];
-+};
-+
-+struct ContextTraits64 : public Traits64 {
-+ using MContext = MContext64;
-+ using SignalThreadContext = SignalThreadContext64;
-+ using SignalFloatContext = SignalFloatContext64;
-+ using SignalVectorContext = SignalVectorContext64;
-+ using CPUContext = CPUContextPPC64;
-+};
-+
-+struct ContextTraits32 : public Traits32 {};
-+
-+struct UContext {
-+ uint64_t flags;
-+ uint64_t link;
-+ SignalStack<ContextTraits64> stack;
-+ Sigset<ContextTraits64> sigmask;
-+ MContext64 mcontext;
-+};
-+#pragma pack(push, 1)
-+
-+static_assert(sizeof(UContext) == sizeof(ucontext_t),
-+ "ucontext_t size mismatch");
-+static_assert(sizeof(MContext64) == sizeof(mcontext_t),
-+ "mcontext_t size mismatch");
-+static_assert(sizeof(SignalThreadContext64) == sizeof(gregset_t),
-+ "gregset_t size mismatch");
-+static_assert(sizeof(SignalFloatContext64) == sizeof(fpregset_t),
-+ "fpregset_t size mismatch");
-+static_assert(sizeof(SignalVectorContext64) == sizeof(vrregset_t),
-+ "vrregset_t size mismatch");
-+static_assert(offsetof(UContext, mcontext) ==
-+ offsetof(ucontext_t, uc_mcontext), "mcontext offset mismatch");
-+static_assert(offsetof(MContext64, gp_regs) ==
-+ offsetof(mcontext_t, gp_regs), "gp_regs offset mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-index a99da3e4b..03b973083 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-@@ -204,6 +204,8 @@ CPUArchitecture SystemSnapshotLinux::GetCPUArchitecture() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return process_reader_->Is64Bit() ? kCPUArchitectureMIPS64EL
- : kCPUArchitectureMIPSEL;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return kCPUArchitecturePPC64;
- #else
- #error port to your architecture
- #endif
-@@ -219,6 +221,9 @@ uint32_t SystemSnapshotLinux::CPURevision() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return 0;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return 0;
- #else
- #error port to your architecture
- #endif
-@@ -239,6 +244,9 @@ std::string SystemSnapshotLinux::CPUVendor() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return std::string();
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return std::string();
- #else
- #error port to your architecture
- #endif
-@@ -372,6 +380,9 @@ bool SystemSnapshotLinux::NXEnabled() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return false;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return false;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-index b2450c206..7ba78b2ae 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-@@ -110,6 +110,8 @@ bool WriteTestModule(const base::FilePath& module_path,
- module.ehdr.e_machine = EM_AARCH64;
- #elif defined(ARCH_CPU_MIPSEL) || defined(ARCH_CPU_MIPS64EL)
- module.ehdr.e_machine = EM_MIPS;
-+#elif defined(ARCH_CPU_PPC64)
-+ module.ehdr.e_machine = EM_PPC64;
- #endif
-
- module.ehdr.e_version = EV_CURRENT;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-index e3e2bebdd..8ef43752e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-@@ -186,6 +186,14 @@ bool ThreadSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
- thread.thread_info.float_context.f32,
- context_.mipsel);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+ InitializeCPUContextPPC64<ContextTraits64>(
-+ thread.thread_info.thread_context.t64,
-+ thread.thread_info.float_context.f64,
-+ thread.thread_info.vector_context.v64,
-+ context_.ppc64);
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-index 44cc6f6d9..d4136461e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-@@ -68,6 +68,8 @@ class ThreadSnapshotLinux final : public ThreadSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
---- a/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-+++ b/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-@@ -236,6 +236,12 @@
- #elif defined(ARCH_CPU_BIG_ENDIAN)
- static constexpr char arch[] = "aarch64_be";
- #endif
-+#elif defined(__powerpc64__)
-+#if defined(ARCH_CPU_LITTLE_ENDIAN)
-+ static constexpr char arch[] = "ppc64le";
-+#elif defined(ARCH_CPU_BIG_ENDIAN)
-+ static constexpr char arch[] = "ppc64";
-+#endif
- #else
- #error Port
- #endif
-diff --git a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-index d3d5ebdfb..3fd730cb5 100644
---- a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-+++ b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-@@ -56,6 +56,11 @@ bool AuxiliaryVector::Read(PtraceConnection* connection) {
- if (type == AT_IGNORE) {
- continue;
- }
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ if (type == AT_IGNOREPPC) {
-+ continue;
-+ }
-+#endif
- if (!MapInsertOrReplace(&values_, type, value, nullptr)) {
- LOG(ERROR) << "duplicate auxv entry";
- return false;
-diff --git a/third_party/crashpad/crashpad/util/linux/ptracer.cc b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-index 557e0d363..08ae434b8 100644
---- a/third_party/crashpad/crashpad/util/linux/ptracer.cc
-+++ b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-@@ -398,6 +398,64 @@ bool GetThreadArea64(pid_t tid,
- return true;
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+// PPC64 has had HAVE_ARCH_TRACEHOOK set since 2.6.27 (even before x86 had it).
-+// That means we can simply use PTRACE_GETREGESET.
-+
-+template <typename Destination>
-+bool GetRegisterSet(pid_t tid, int set, Destination* dest, bool can_log) {
-+ iovec iov;
-+ iov.iov_base = reinterpret_cast<void*>(dest);
-+ iov.iov_len = sizeof(*dest);
-+ if (ptrace(PTRACE_GETREGSET, tid, reinterpret_cast<void*>(set), &iov) != 0) {
-+ PLOG_IF(ERROR, can_log) << "ptrace";
-+ return false;
-+ }
-+ if (iov.iov_len != sizeof(*dest)) {
-+ LOG_IF(ERROR, can_log) << "Unexpected registers size";
-+ return false;
-+ }
-+ return true;
-+}
-+
-+bool GetVectorRegisters64(pid_t tid,
-+ VectorContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PPC_VMX, &context->v64, can_log);
-+}
-+
-+bool GetFloatingPointRegisters64(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PRFPREG, &context->f64, can_log);
-+}
-+
-+bool GetThreadArea64(pid_t tid,
-+ const ThreadContext& context,
-+ LinuxVMAddress* address,
-+ bool can_log) {
-+ // PPC64 doesn't have PTRACE_GET_THREAD_AREA since the thread pointer
-+ // is stored in GPR 13.
-+ ThreadContext::t64_t tc;
-+ if (!GetRegisterSet(tid, NT_PRSTATUS, &tc, can_log)) {
-+ LOG_IF(ERROR, can_log) << "Unable to get thread pointer!";
-+ return false;
-+ }
-+
-+ *address = tc.gpr[13];
-+
-+ return true;
-+}
-+
-+// Stubs for 32-bit functions not applicable on PPC64
-+bool GetFloatingPointRegisters32(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) { return false; }
-+bool GetThreadArea32(pid_t tid,
-+ const ThreadContext &context,
-+ LinuxVMAddress *address,
-+ bool can_log) { return false; }
-+
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -494,6 +552,9 @@ bool Ptracer::GetThreadInfo(pid_t tid, ThreadInfo* info) {
- if (is_64_bit_) {
- return GetGeneralPurposeRegisters64(tid, &info->thread_context, can_log_) &&
- GetFloatingPointRegisters64(tid, &info->float_context, can_log_) &&
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ GetVectorRegisters64(tid, &info->vector_context, can_log_) &&
-+#endif
- GetThreadArea64(tid,
- info->thread_context,
- &info->thread_specific_data_address,
-diff --git a/third_party/crashpad/crashpad/util/linux/thread_info.h b/third_party/crashpad/crashpad/util/linux/thread_info.h
-index 5b55c24a7..dea0d1f39 100644
---- a/third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ b/third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -28,6 +28,10 @@
- #include <android/api-level.h>
- #endif
-
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+#include <sys/ucontext.h>
-+#endif
-+
- namespace crashpad {
-
- //! \brief The set of general purpose registers for an architecture family.
-@@ -79,6 +83,8 @@ union ThreadContext {
- uint32_t cp0_status;
- uint32_t cp0_cause;
- uint32_t padding1_;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // PPC64 is 64-bit
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -132,6 +138,21 @@ union ThreadContext {
- uint64_t cp0_badvaddr;
- uint64_t cp0_status;
- uint64_t cp0_cause;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects struct pt_regs in asm/ptrace.h.
-+ uint64_t gpr[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_gpr3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -143,6 +164,8 @@ union ThreadContext {
- using NativeThreadContext = user_regs;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate NativeThreadsContext type available for MIPS
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ using NativeThreadContext = struct pt_regs;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY || ARCH_CPU_ARM64
-@@ -218,6 +241,9 @@ union FloatContext {
- } fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Crashpad's PPC support is 64-bit only, so this
-+ // 32bit-only struct is declared as empty.
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -252,6 +278,10 @@ union FloatContext {
- double fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects fpregset_t in sys/ucontext.h
-+ double fpregs[32];
-+ double fpscr;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -280,6 +310,8 @@ union FloatContext {
- static_assert(sizeof(f64) == sizeof(user_fpsimd_struct), "Size mismatch");
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate floating point context native type for available MIPS.
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ static_assert(sizeof(f64) == sizeof(fpregset_t), "Size mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86
-@@ -287,6 +319,26 @@ union FloatContext {
- static_assert(std::is_standard_layout<FloatContext>::value,
- "Not standard layout");
-
-+//! \brief The vector registers used for an architecture family
-+union VectorContext {
-+ struct v32_t {} v32;
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ __attribute__((__aligned__(16))) // Vector context must be doubleword aligned.
-+#endif
-+ struct v64_t {
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects vrregset_t in sys/ucontext.h
-+ uint32_t vrregs[32][4];
-+ struct {
-+ uint32_t __pad[3];
-+ uint32_t vscr_word;
-+ } vscr;
-+ uint32_t vrsave;
-+ uint32_t __pad[3];
-+#endif
-+ } v64;
-+};
-+
- //! \brief A collection of `ptrace`-able information about a thread.
- struct ThreadInfo {
- ThreadInfo();
-@@ -298,6 +350,9 @@ struct ThreadInfo {
- //! \brief The floating point registers for the thread.
- FloatContext float_context;
-
-+ //! \brief (Optional) The vector registers used for the thread.
-+ VectorContext vector_context;
-+
- //! \brief The thread-local storage address for the thread.
- LinuxVMAddress thread_specific_data_address;
- };
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context.h b/third_party/crashpad/crashpad/util/misc/capture_context.h
-index d21a24f19..acc325349 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context.h
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context.h
-@@ -69,6 +69,7 @@ using NativeCPUContext = ucontext_t;
- //! macOS/Linux/Fuchsia | x86_64 | `%%rdi`
- //! Linux | ARM/ARM64 | `r0`/`x0`
- //! Linux | MIPS/MIPS64 | `$a0`
-+//! Linux | PPC64 | `r3`
- //!
- //! Additionally, the value `LR` on ARM/ARM64 will be the return address of
- //! this function.
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-index 52215ee5d..b3e4a3ec7 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-@@ -32,7 +32,7 @@
- .balign 4, 0x0
- .type CAPTURECONTEXT_SYMBOL, %function
- .type CAPTURECONTEXT_SYMBOL2, %function
--#elif defined(__mips__)
-+#elif defined(__mips__) || defined(__powerpc64__)
- .balign 4, 0x0
- #endif
-
-@@ -423,4 +423,214 @@ CAPTURECONTEXT_SYMBOL2:
- jr $ra
-
- .set at
-+#elif defined(__powerpc64__)
-+ // Store r0-r31
-+ std 0, 0xe8(3) // context->uc_mcontext.gp_regs[0]
-+ std 1, 0xf0(3) // context->uc_mcontext.gp_regs[1]
-+ std 2, 0xf8(3) // context->uc_mcontext.gp_regs[2]
-+ // note that r3's original value was lost
-+ std 3, 0x100(3) // context->uc_mcontext.gp_regs[3]
-+ std 4, 0x108(3) // context->uc_mcontext.gp_regs[4]
-+ std 5, 0x110(3) // context->uc_mcontext.gp_regs[5]
-+ std 6, 0x118(3) // context->uc_mcontext.gp_regs[6]
-+ std 7, 0x120(3) // context->uc_mcontext.gp_regs[7]
-+ std 8, 0x128(3) // context->uc_mcontext.gp_regs[8]
-+ std 9, 0x130(3) // context->uc_mcontext.gp_regs[9]
-+ std 10, 0x138(3) // context->uc_mcontext.gp_regs[10]
-+ std 11, 0x140(3) // context->uc_mcontext.gp_regs[11]
-+ std 12, 0x148(3) // context->uc_mcontext.gp_regs[12]
-+ std 13, 0x150(3) // context->uc_mcontext.gp_regs[13]
-+ std 14, 0x158(3) // context->uc_mcontext.gp_regs[14]
-+ std 15, 0x160(3) // context->uc_mcontext.gp_regs[15]
-+ std 16, 0x168(3) // context->uc_mcontext.gp_regs[16]
-+ std 17, 0x170(3) // context->uc_mcontext.gp_regs[17]
-+ std 18, 0x178(3) // context->uc_mcontext.gp_regs[18]
-+ std 19, 0x180(3) // context->uc_mcontext.gp_regs[19]
-+ std 20, 0x188(3) // context->uc_mcontext.gp_regs[20]
-+ std 21, 0x190(3) // context->uc_mcontext.gp_regs[21]
-+ std 22, 0x198(3) // context->uc_mcontext.gp_regs[22]
-+ std 23, 0x1a0(3) // context->uc_mcontext.gp_regs[23]
-+ std 24, 0x1a8(3) // context->uc_mcontext.gp_regs[24]
-+ std 25, 0x1b0(3) // context->uc_mcontext.gp_regs[25]
-+ std 26, 0x1b8(3) // context->uc_mcontext.gp_regs[26]
-+ std 27, 0x1c0(3) // context->uc_mcontext.gp_regs[27]
-+ std 28, 0x1c8(3) // context->uc_mcontext.gp_regs[28]
-+ std 29, 0x1d0(3) // context->uc_mcontext.gp_regs[29]
-+ std 30, 0x1d8(3) // context->uc_mcontext.gp_regs[30]
-+ std 31, 0x1e0(3) // context->uc_mcontext.gp_regs[31]
-+
-+ // For NIP, we can use the value in the link register
-+ mflr 0
-+ std 0, 0x1e8(3) // context->uc_mcontext.gp_regs[PT_NIP]
-+
-+ // CTR
-+ mfctr 0
-+ std 0, 0x200(3) // context->uc_mcontext.gp_regs[PT_CTR]
-+
-+ // For LNK, we'll use the caller's LR save area (2 stack frames up).
-+ // r4 can be used as a scratch register since it has already been saved.
-+ ld 4, 0(1)
-+ ld 4, 16(4)
-+ std 4, 0x208(3) // context->uc_mcontext.gp_regs[PT_LNK]
-+
-+ // XER
-+ mfxer 0
-+ std 0, 0x210(3) // context->uc_mcontext.gp_regs[PT_XER]
-+
-+ // CCR
-+ mfcr 0
-+ std 0, 0x218(3) // context->uc_mcontext.gp_regs[PT_CCR]
-+
-+ // MSR, orig_r3, MQ, TRAP, DAR, DSISR, RESULT, DSCR,
-+ // not used or not relevant, zero them out.
-+ li 4, 0
-+ std 4, 0x1f0(3) // context->uc_mcontext.gp_regs[PT_MSR]
-+ std 4, 0x1f8(3) // context->uc_mcontext.gp_regs[PT_ORIG_R3]
-+ std 4, 0x220(3) // context->uc_mcontext.gp_regs[PT_MQ]
-+ std 4, 0x228(3) // context->uc_mcontext.gp_regs[PT_TRAP]
-+ std 4, 0x230(3) // context->uc_mcontext.gp_regs[PT_DAR]
-+ std 4, 0x238(3) // context->uc_mcontext.gp_regs[PT_DSISR]
-+ std 4, 0x240(3) // context->uc_mcontext.gp_regs[PT_RESULT]
-+ std 4, 0x248(3) // context->uc_mcontext.gp_regs[PT_DSCR]
-+
-+ // Update context->uc_mcontext.regs to point to gp_regs
-+ addi 0, 3, 0xe8
-+ std 0, 0xe0(3)
-+
-+ // Save floating point registers 0-31
-+ stfd 0, 0x268(3) // context->uc_mcontext.fp_regs[0]
-+ stfd 1, 0x270(3) // context->uc_mcontext.fp_regs[1]
-+ stfd 2, 0x278(3) // context->uc_mcontext.fp_regs[2]
-+ stfd 3, 0x280(3) // context->uc_mcontext.fp_regs[3]
-+ stfd 4, 0x288(3) // context->uc_mcontext.fp_regs[4]
-+ stfd 5, 0x290(3) // context->uc_mcontext.fp_regs[5]
-+ stfd 6, 0x298(3) // context->uc_mcontext.fp_regs[6]
-+ stfd 7, 0x2a0(3) // context->uc_mcontext.fp_regs[7]
-+ stfd 8, 0x2a8(3) // context->uc_mcontext.fp_regs[8]
-+ stfd 9, 0x2b0(3) // context->uc_mcontext.fp_regs[9]
-+ stfd 10, 0x2b8(3) // context->uc_mcontext.fp_regs[10]
-+ stfd 11, 0x2c0(3) // context->uc_mcontext.fp_regs[11]
-+ stfd 12, 0x2c8(3) // context->uc_mcontext.fp_regs[12]
-+ stfd 13, 0x2d0(3) // context->uc_mcontext.fp_regs[13]
-+ stfd 14, 0x2d8(3) // context->uc_mcontext.fp_regs[14]
-+ stfd 15, 0x2e0(3) // context->uc_mcontext.fp_regs[15]
-+ stfd 16, 0x2e8(3) // context->uc_mcontext.fp_regs[16]
-+ stfd 17, 0x2f0(3) // context->uc_mcontext.fp_regs[17]
-+ stfd 18, 0x2f8(3) // context->uc_mcontext.fp_regs[18]
-+ stfd 19, 0x300(3) // context->uc_mcontext.fp_regs[19]
-+ stfd 20, 0x308(3) // context->uc_mcontext.fp_regs[20]
-+ stfd 21, 0x310(3) // context->uc_mcontext.fp_regs[21]
-+ stfd 22, 0x318(3) // context->uc_mcontext.fp_regs[22]
-+ stfd 23, 0x320(3) // context->uc_mcontext.fp_regs[23]
-+ stfd 24, 0x328(3) // context->uc_mcontext.fp_regs[24]
-+ stfd 25, 0x330(3) // context->uc_mcontext.fp_regs[25]
-+ stfd 26, 0x338(3) // context->uc_mcontext.fp_regs[26]
-+ stfd 27, 0x340(3) // context->uc_mcontext.fp_regs[27]
-+ stfd 28, 0x348(3) // context->uc_mcontext.fp_regs[28]
-+ stfd 29, 0x350(3) // context->uc_mcontext.fp_regs[29]
-+ stfd 30, 0x358(3) // context->uc_mcontext.fp_regs[30]
-+ stfd 31, 0x360(3) // context->uc_mcontext.fp_regs[31]
-+
-+ // FPSCR
-+ mffs 0
-+ stfd 0, 0x368(3) // context->uc_mcontext.fp_regs[32]
-+
-+ // Save VMX Vector registers
-+ // Update r4 to contain the base address of vmx_reserve
-+ addi 4, 3, 0x378
-+ // Ensure that it is quadword aligned
-+ andi. 5, 4, 0xF
-+ beq 1f // No alignment is necessary
-+ // Address is doubleword aligned and not quadword aligned, add 8
-+ addi 4, 4, 8
-+
-+1:
-+ // Store VMX registers 0-31
-+ // r4 will contain the base address
-+ // r5 will contain the index
-+ li 5, 0
-+ stvx 0, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 0]
-+ addi 5, 5, 16
-+ stvx 1, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 1]
-+ addi 5, 5, 16
-+ stvx 2, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 2]
-+ addi 5, 5, 16
-+ stvx 3, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 3]
-+ addi 5, 5, 16
-+ stvx 4, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 4]
-+ addi 5, 5, 16
-+ stvx 5, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 5]
-+ addi 5, 5, 16
-+ stvx 6, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 6]
-+ addi 5, 5, 16
-+ stvx 7, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 7]
-+ addi 5, 5, 16
-+ stvx 8, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 8]
-+ addi 5, 5, 16
-+ stvx 9, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 9]
-+ addi 5, 5, 16
-+ stvx 10, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 10]
-+ addi 5, 5, 16
-+ stvx 11, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 11]
-+ addi 5, 5, 16
-+ stvx 12, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 12]
-+ addi 5, 5, 16
-+ stvx 13, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 13]
-+ addi 5, 5, 16
-+ stvx 14, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 14]
-+ addi 5, 5, 16
-+ stvx 15, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 15]
-+ addi 5, 5, 16
-+ stvx 16, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 16]
-+ addi 5, 5, 16
-+ stvx 17, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 17]
-+ addi 5, 5, 16
-+ stvx 18, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 18]
-+ addi 5, 5, 16
-+ stvx 19, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 19]
-+ addi 5, 5, 16
-+ stvx 20, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 20]
-+ addi 5, 5, 16
-+ stvx 21, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 21]
-+ addi 5, 5, 16
-+ stvx 22, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 22]
-+ addi 5, 5, 16
-+ stvx 23, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 23]
-+ addi 5, 5, 16
-+ stvx 24, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 24]
-+ addi 5, 5, 16
-+ stvx 25, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 25]
-+ addi 5, 5, 16
-+ stvx 26, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 26]
-+ addi 5, 5, 16
-+ stvx 27, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 27]
-+ addi 5, 5, 16
-+ stvx 28, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 28]
-+ addi 5, 5, 16
-+ stvx 29, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 29]
-+ addi 5, 5, 16
-+ stvx 30, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 30]
-+ addi 5, 5, 16
-+ stvx 31, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 31]
-+ addi 5, 5, 16
-+
-+ // VSCR
-+ mfvscr 0
-+ stvx 0, 4, 5
-+ addi 5, 5, 16
-+
-+ // VRSAVE
-+ mfvrsave 0
-+ stwx 0, 4, 5
-+
-+ // Update context->uc_mcontext.v_regs to point to vmx_reserve + alignment.
-+ std 4, 0x370(3)
-+
-+ // Zero out all unused fields
-+ li 4, 0
-+ std 4, 0xc8(3) // context->uc_mcontext.signal
-+ std 4, 0xd0(3) // context->uc_mcontext.handler
-+ std 4, 0xd8(3) // context->uc_mcontext.oldmask
-+
-+ blr
- #endif // __i386__
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-index cf23c2def..5f264bc92 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-@@ -57,7 +57,7 @@ void TestCaptureContext() {
- uintptr_t pc = ProgramCounterFromContext(context_1);
-
- #if !defined(ADDRESS_SANITIZER) && !defined(ARCH_CPU_MIPS_FAMILY) && \
-- !defined(MEMORY_SANITIZER)
-+ !defined(MEMORY_SANITIZER) && !defined(ARCH_CPU_PPC64_FAMILY)
- // Sanitizers can cause enough code bloat that the “nearby” check would
- // likely fail.
- const uintptr_t kReferencePC =
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-index 30a2ab21d..60509f21d 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-@@ -35,6 +35,8 @@ void SanityCheckContext(const NativeCPUContext& context) {
- EXPECT_EQ(context.uc_mcontext.regs[0], FromPointerCast<uintptr_t>(&context));
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- EXPECT_EQ(context.uc_mcontext.gregs[4], FromPointerCast<uintptr_t>(&context));
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ EXPECT_EQ(context.uc_mcontext.gp_regs[3], FromPointerCast<uintptr_t>(&context));
- #endif
- }
-
-@@ -49,6 +51,8 @@ uintptr_t ProgramCounterFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.pc;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.pc;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[PT_NIP];
- #endif
- }
-
-@@ -63,6 +67,8 @@ uintptr_t StackPointerFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.sp;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.gregs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[1];
- #endif
- }
-
-diff --git a/third_party/dav1d/config/linux/ppc64/config.h b/third_party/dav1d/config/linux/ppc64/config.h
-new file mode 100644
-index 000000000..9fbbf75cc
---- /dev/null
-+++ b/third_party/dav1d/config/linux/ppc64/config.h
-@@ -0,0 +1,39 @@
-+/*
-+ * Autogenerated by the Meson build system.
-+ * Do not edit, your changes will be lost.
-+ */
-+
-+#pragma once
-+
-+#define ARCH_AARCH64 0
-+
-+#define ARCH_ARM 0
-+
-+#define ARCH_PPC64LE 1
-+
-+#define ARCH_X86 0
-+
-+#define ARCH_X86_32 0
-+
-+#define ARCH_X86_64 0
-+
-+#define CONFIG_16BPC 1
-+
-+#define CONFIG_8BPC 1
-+
-+// #define CONFIG_LOG 1 -- Logging is controlled by Chromium
-+
-+#define ENDIANNESS_BIG 0
-+
-+#define HAVE_ASM 1
-+
-+#define HAVE_CLOCK_GETTIME 1
-+
-+#define HAVE_DLSYM 1
-+
-+#define HAVE_GETAUXVAL 1
-+
-+#define HAVE_POSIX_MEMALIGN 1
-+
-+#define HAVE_UNISTD_H 1
-+
-diff --git a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-index 0b4bd72f0..a0caa5e71 100644
---- a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-+++ b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-@@ -51,4 +51,19 @@
- #define u16l_to_i32(v) ((i32x4) vec_mergel((u16x8) v, vec_splat_u16(0)))
- #define i16l_to_i32(v) ((i32x4) vec_unpackl((i16x8)v))
-
-+#if defined(__clang__)
-+#undef vec_splats
-+#define vec_splats(N) \
-+ _Generic((N), \
-+ unsigned char: ((u8x16)(N)), \
-+ signed char: ((i8x16)(N)), \
-+ unsigned short: ((u16x8)(N)), \
-+ signed short: ((i16x8)(N)), \
-+ unsigned int: ((u32x4)(N)), \
-+ signed int: ((i32x4)(N)), \
-+ unsigned long long: ((u64x2)(N)), \
-+ signed long long: ((i64x2)(N)) \
-+ )
-+#endif
-+
- #endif /* DAV1D_SRC_PPC_TYPES_H */
-diff --git a/third_party/eigen3/BUILD.gn b/third_party/eigen3/BUILD.gn
-index 0d4e184..f2ce484 100644
---- a/third_party/eigen3/BUILD.gn
-+++ b/third_party/eigen3/BUILD.gn
-@@ -22,4 +22,8 @@ config("eigen_includes") {
- # for this component on Windows on Arm due to compilation errors.
- defines += [ "EIGEN_DONT_VECTORIZE" ]
- }
-+
-+ if (target_cpu == "ppc64") {
-+ defines += [ "EIGEN_DONT_VECTORIZE" ]
-+ }
- }
-
-diff --git a/third_party/libaom/BUILD.gn b/third_party/libaom/BUILD.gn
-index 9b065bd..df3af02 100644
---- a/third_party/libaom/BUILD.gn
-+++ b/third_party/libaom/BUILD.gn
-@@ -40,6 +40,8 @@
- cpu_arch_full = "generic"
- } else if (current_cpu == "loong64") {
- cpu_arch_full = "generic"
-+} else if (current_cpu == "ppc64") {
-+ cpu_arch_full = "generic"
- } else {
- cpu_arch_full = current_cpu
- }
-diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h
-index e4ac22644..1c57015db 100644
---- a/third_party/lss/linux_syscall_support.h
-+++ b/third_party/lss/linux_syscall_support.h
-@@ -3947,7 +3947,7 @@ struct kernel_statfs {
- LSS_REG(2, buf);
- LSS_BODY(void*, mmap2, "0"(__r2));
- }
--#else
-+#elif !defined(__powerpc64__) /* ppc64 doesn't have mmap2 */
- #define __NR__mmap2 __NR_mmap2
- LSS_INLINE _syscall6(void*, _mmap2, void*, s,
- size_t, l, int, p,
-@@ -4058,7 +4058,7 @@ struct kernel_statfs {
- #if defined(__i386__) || \
- defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \
- (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \
-- defined(__PPC__) || \
-+ (defined(__PPC__) && !defined(__powerpc64__)) || \
- (defined(__s390__) && !defined(__s390x__))
- /* On these architectures, implement mmap() with mmap2(). */
- LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d,
-@@ -4872,11 +4872,11 @@ struct kernel_statx {
- LSS_SC_BODY(4, int, 8, d, type, protocol, sv);
- }
- #endif
-- #if defined(__NR_recvmsg)
-+ #if defined(__NR_recvmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, recvmsg, int, s, struct kernel_msghdr*, msg,
- int, flags)
- #endif
-- #if defined(__NR_sendmsg)
-+ #if defined(__NR_sendmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, sendmsg, int, s, const struct kernel_msghdr*,
- msg, int, flags)
- #endif
-@@ -4885,13 +4885,13 @@ struct kernel_statx {
- int, flags, const struct kernel_sockaddr*, to,
- unsigned int, tolen)
- #endif
-- #if defined(__NR_shutdown)
-+ #if defined(__NR_shutdown) && !defined(__PPC__)
- LSS_INLINE _syscall2(int, shutdown, int, s, int, how)
- #endif
-- #if defined(__NR_socket)
-+ #if defined(__NR_socket) && !defined(__PPC__)
- LSS_INLINE _syscall3(int, socket, int, domain, int, type, int, protocol)
- #endif
-- #if defined(__NR_socketpair)
-+ #if defined(__NR_socketpair) && !defined(__PPC__)
- LSS_INLINE _syscall4(int, socketpair, int, d, int, type, int, protocol,
- int*, sv)
- #endif
-diff --git a/third_party/pdfium/third_party/libpng16/pngpriv.h b/third_party/pdfium/third_party/libpng16/pngpriv.h
-index 583c26f..e03d697 100644
---- a/third_party/pdfium/third_party/libpng16/pngpriv.h
-+++ b/third_party/pdfium/third_party/libpng16/pngpriv.h
-@@ -196,11 +196,7 @@
- #endif
-
- #ifndef PNG_POWERPC_VSX_OPT
--# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
--# define PNG_POWERPC_VSX_OPT 2
--# else
--# define PNG_POWERPC_VSX_OPT 0
--# endif
-+# define PNG_POWERPC_VSX_OPT 0
- #endif
-
- #ifndef PNG_INTEL_SSE_OPT
-diff --git a/third_party/pffft/src/pffft.c b/third_party/pffft/src/pffft.c
-index bdac4d784..51e0f2cac 100644
---- a/third_party/pffft/src/pffft.c
-+++ b/third_party/pffft/src/pffft.c
-@@ -100,6 +100,7 @@
- Altivec support macros
- */
- #if !defined(PFFFT_SIMD_DISABLE) && (defined(__ppc__) || defined(__ppc64__))
-+#include <altivec.h>
- typedef vector float v4sf;
- # define SIMD_SZ 4
- # define VZERO() ((vector float) vec_splat_u8(0))
-diff --git a/third_party/sqlite/src/amalgamation/sqlite3.c b/third_party/sqlite/src/amalgamation/sqlite3.c
-index 6b4a7899d..b8c7fe414 100644
---- a/third_party/sqlite/src/amalgamation/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation/sqlite3.c
-@@ -14474,7 +14474,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/amalgamation_dev/sqlite3.c b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-index d30c9b7de..cf75a69d9 100644
---- a/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-@@ -14487,7 +14487,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/ext/rtree/rtree.c b/third_party/sqlite/src/ext/rtree/rtree.c
-index f5b57a5e2..80a2d0ad8 100644
---- a/third_party/sqlite/src/ext/rtree/rtree.c
-+++ b/third_party/sqlite/src/ext/rtree/rtree.c
-@@ -450,7 +450,7 @@ struct RtreeMatchArg {
- #if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__arm__)
-+ defined(__arm__) || defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- #elif defined(sparc) || defined(__ppc__)
- # define SQLITE_BYTEORDER 4321
-diff --git a/third_party/sqlite/src/src/sqliteInt.h b/third_party/sqlite/src/src/sqliteInt.h
-index 245070d4f..b25164e95 100644
---- a/third_party/sqlite/src/src/sqliteInt.h
-+++ b/third_party/sqlite/src/src/sqliteInt.h
-@@ -877,7 +877,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/webrtc/rtc_base/system/arch.h b/third_party/webrtc/rtc_base/system/arch.h
-index be2367b85..be4ee4233 100644
---- a/third_party/webrtc/rtc_base/system/arch.h
-+++ b/third_party/webrtc/rtc_base/system/arch.h
-@@ -79,6 +79,18 @@
- #elif defined(__EMSCRIPTEN__)
- #define WEBRTC_ARCH_32_BITS
- #define WEBRTC_ARCH_LITTLE_ENDIAN
-+#elif defined(__PPC__)
-+#define WEBRTC_ARCH_PPC_FAMILY
-+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-+#define WEBRTC_ARCH_LITTLE_ENDIAN
-+#else
-+#define WEBRTC_ARCH_BIG_ENDIAN
-+#endif
-+#if defined(__LP64__)
-+#define WEBRTC_ARCH_64_BITS
-+#else
-+#define WEBRTC_ARCH_32_BITS
-+#endif
- #else
- #error Please add support for your architecture in rtc_base/system/arch.h
- #endif
-diff --git a/v8/BUILD.gn b/v8/BUILD.gn
-index f39529a3a..e84fc449e 100644
---- a/v8/BUILD.gn
-+++ b/v8/BUILD.gn
-@@ -850,6 +850,12 @@ config("toolchain") {
- }
- if (host_byteorder == "little") {
- defines += [ "V8_TARGET_ARCH_PPC_LE" ]
-+ cflags += [
-+ # Enable usage of AltiVec, VSX, and other POWER8 and higher features
-+ "-mcpu=power8",
-+ "-maltivec",
-+ "-mvsx",
-+ ]
- } else if (host_byteorder == "big") {
- defines += [ "V8_TARGET_ARCH_PPC_BE" ]
- if (current_os == "aix") {
---- a/ui/gl/features.gni
-+++ b/ui/gl/features.gni
-@@ -33,5 +33,5 @@
- is_chromeos_ash || is_fuchsia) &&
- (target_cpu == "x86" || target_cpu == "x64" || target_cpu == "arm" ||
- target_cpu == "arm64" || target_cpu == "mipsel" ||
-- target_cpu == "mips64el" || target_cpu == "riscv64")
-+ target_cpu == "mips64el" || target_cpu == "riscv64" || target_cpu == "ppc64")
- }
-diff --git a/v8/test/BUILD.gn b/v8/test/BUILD.gn
-index fb872ad39..45fc585dd 100644
---- a/v8/test/BUILD.gn
-+++ b/v8/test/BUILD.gn
-@@ -42,7 +42,7 @@ group("gn_all") {
- "benchmarks/cpp:gn_all",
- "cctest:cctest",
- "unittests:generate-bytecode-expectations",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
- }
- }
-@@ -84,7 +84,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- "webkit:v8_webkit",
- ]
-
-@@ -109,7 +109,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
-
- if (v8_enable_webassembly) {
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch b/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
deleted file mode 100644
index df453f491d8c..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-+++ b/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-@@ -574,6 +574,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCAsmInfoCOFF.cpp",
- "llvm/lib/MC/MCAsmInfoDarwin.cpp",
- "llvm/lib/MC/MCAsmInfoELF.cpp",
-+ "llvm/lib/MC/MCAsmInfoXCOFF.cpp",
- "llvm/lib/MC/MCAsmMacro.cpp",
- "llvm/lib/MC/MCAsmStreamer.cpp",
- "llvm/lib/MC/MCAssembler.cpp",
-@@ -629,6 +630,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCWinCOFFStreamer.cpp",
- "llvm/lib/MC/MCWinEH.cpp",
- "llvm/lib/MC/MCXCOFFStreamer.cpp",
-+ "llvm/lib/MC/MCXCOFFObjectTargetWriter.cpp",
- "llvm/lib/MC/MachObjectWriter.cpp",
- "llvm/lib/MC/StringTableBuilder.cpp",
- "llvm/lib/MC/SubtargetFeature.cpp",
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 7dea8bbe50d3..4a7faab9eebd 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -1,9 +1,9 @@
# Template file for 'chromium'
pkgname=chromium
# See https://chromiumdash.appspot.com/releases?platform=Linux for the latest version
-version=108.0.5359.124
+version=109.0.5414.74
revision=1
-archs="i686* x86_64* aarch64* armv7l* ppc64le*"
+archs="i686* x86_64* aarch64* armv7l*"
hostmakedepends="
$(vopt_if clang "clang lld llvm12")
$(vopt_if js_optimize openjdk)
@@ -28,7 +28,7 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://www.chromium.org/"
distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz"
-checksum=d48dfac2a61b14a5d7d2f460b09b70ef3ab88e27b82e3173938cb54eaa612a75
+checksum=eded233c26ab631be325ad49cb306c338513b6a6528197d42653e66187548e5d
lib32disabled=yes
@@ -39,10 +39,9 @@ desc_option_debug="Build with debug symbols"
desc_option_js_optimize="Optimize the JS used for Chromium's UI"
desc_option_pipewire="Enable support for screen sharing for WebRTC via PipeWire"
-
-case "$XBPS_TARGET_MACHINE" in
- ppc64*-musl) makedepends+=" libucontext-devel" ;;
-esac
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+ makedepends+=" musl-legacy-compat"
+fi
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" libX11-devel libxcb-devel pciutils-devel libXext-devel libglvnd-devel
@@ -65,10 +64,6 @@ if [ "$CROSS_BUILD" ]; then
esac
fi
-case "${XBPS_TARGET_MACHINE}" in
- i686*) broken="https://build.voidlinux.org/builders/i686_builder/builds/40258/steps/shell_3/logs/stdio" ;;
-esac
-
post_patch() {
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
for f in "${FILESDIR}"/musl-patches/*.patch; do
@@ -135,20 +130,6 @@ do_configure() {
CFLAGS=$CFLAGS_FOR_BUILD CXXFLAGS=$CXXFLAGS_FOR_BUILD LDFLAGS=$LDFLAGS_FOR_BUILD \
tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles
- # we need to generate ppc64 stuff for libvpx as it's not shipped
- # this has to be done before unbundling, but after gn is built
- # comment out if we switch back to system libvpx again later
- case "$XBPS_TARGET_MACHINE" in
- ppc64*)
- pushd third_party/libvpx
- mkdir -p source/config/linux/ppc64
- # need PATH to find gn
- PATH="${wrksrc}/out/Release:$PATH" ./generate_gni.sh || \
- msg_error "failed to generate libvpx gni"
- popd
- ;;
- esac
-
# Use system-provided libraries.
# TODO: use_system_hunspell (upstream changes needed).
# TODO: use_system_libsrtp.
@@ -220,9 +201,6 @@ do_configure() {
'icu_use_data_file=true'
- 'use_allocator="none"'
- 'use_allocator_shim=false'
-
'enable_widevine=true'
'enable_hangout_services_extension=true'
@@ -286,11 +264,6 @@ do_configure() {
)
fi
- # this does not work on ppc64 yet
- case "$XBPS_TARGET_MACHINE" in
- ppc64*) conf+=( "enable_jxl_decoder=false" );;
- esac
-
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
conf+=( 'is_musl=true' )
fi
@@ -300,7 +273,6 @@ do_configure() {
i686*) conf+=( 'target_cpu="x86"' ) ;;
arm*) conf+=( 'target_cpu="arm"' ) ;;
aarch64*) conf+=( 'target_cpu="arm64"' ) ;;
- ppc64*) conf+=( 'target_cpu="ppc64"' ) ;;
esac
if [ "$CROSS_BUILD" ]; then
@@ -309,7 +281,6 @@ do_configure() {
i686*) conf+=( 'host_cpu="x86"' ) ;;
arm*) conf+=( 'host_cpu="arm"' ) ;;
aarch64*) conf+=( 'host_cpu="arm64"' ) ;;
- ppc64*) conf+=( 'host_cpu="ppc64"' ) ;;
esac
fi
_setup_toolchain
@@ -318,13 +289,13 @@ do_configure() {
do_build() {
_setup_toolchain
- CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver chrome_crashpad_handler
+ CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver.unstripped chrome_crashpad_handler
}
do_install() {
vinstall out/Release/chrome 755 usr/lib/${pkgname} ${pkgname}
vinstall out/Release/chrome_crashpad_handler 755 usr/lib/${pkgname} chrome_crashpad_handler
- vinstall out/Release/chromedriver 755 usr/lib/${pkgname} chromedriver
+ vinstall out/Release/chromedriver.unstripped 755 usr/lib/${pkgname} chromedriver
vinstall out/Release/libEGL.so 755 usr/lib/${pkgname} libEGL.so
vinstall out/Release/libGLESv2.so 755 usr/lib/${pkgname} libGLESv2.so
vinstall out/Release/libvk_swiftshader.so 755 usr/lib/${pkgname} libvk_swiftshader.so
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] chromium: update to 109.0.5414.74.
2023-01-11 1:12 [PR PATCH] chromium: update to 109.0.5414.74 Duncaen
` (5 preceding siblings ...)
2023-01-11 17:41 ` Duncaen
@ 2023-01-12 20:38 ` Duncaen
2023-01-12 20:44 ` Duncaen
2023-01-12 20:45 ` [PR PATCH] [Merged]: " Duncaen
8 siblings, 0 replies; 10+ messages in thread
From: Duncaen @ 2023-01-12 20:38 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]
There is an updated pull request by Duncaen against master on the void-packages repository
https://github.com/Duncaen/void-packages chromium-109
https://github.com/void-linux/void-packages/pull/41570
chromium: update to 109.0.5414.74.
[ci skip]
* [x] x86_64-glibc
* [x] x86_64-musl
* [ ] aarch64-musl
* [ ] i686
A patch file from https://github.com/void-linux/void-packages/pull/41570.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-chromium-109-41570.patch --]
[-- Type: text/x-diff, Size: 183050 bytes --]
From 57b17563a8b40fac7f2f51a79d64a23de1928ae3 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Wed, 11 Jan 2023 01:28:40 +0100
Subject: [PATCH] chromium: update to 109.0.5414.74.
---
.../musl-patches/xxx-ppc64le-support.patch | 187 -
.../patches/build-add-use_cxx17.patch | 38 +-
.../patches/fix-build-with-old-clang.patch | 20 +
.../patches/fix-constexpr-narrowing.patch | 21 +
.../patches/fix-musl-no-mallinfo.patch | 11 +
.../patches/fix-musl-pthread-stacksize.patch | 40 -
.../chromium/patches/fix-narrowing-cast.patch | 39 +-
.../patches/fix-nasm-musl-config.patch | 12 -
.../patches/musl-partition-atfork.patch | 11 +
...uild-error-on-linux-with-system-zlib.patch | 41 -
.../patches/remove-strip_binary.patch | 32 -
.../patches/xxx-ppc64le-4k-pages.patch | 60 -
.../chromium/patches/xxx-ppc64le-libvpx.patch | 33 -
.../xxx-ppc64le-sandbox-linux-stat.patch | 31 -
.../patches/xxx-ppc64le-support.patch | 3590 -----------------
.../patches/xxx-ppc64le-swiftshader.patch | 18 -
srcpkgs/chromium/template | 45 +-
17 files changed, 89 insertions(+), 4140 deletions(-)
delete mode 100644 srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
create mode 100644 srcpkgs/chromium/patches/fix-build-with-old-clang.patch
create mode 100644 srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
create mode 100644 srcpkgs/chromium/patches/fix-musl-no-mallinfo.patch
delete mode 100644 srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
delete mode 100644 srcpkgs/chromium/patches/fix-nasm-musl-config.patch
create mode 100644 srcpkgs/chromium/patches/musl-partition-atfork.patch
delete mode 100644 srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
delete mode 100644 srcpkgs/chromium/patches/remove-strip_binary.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-support.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
diff --git a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 555f69c072c8..000000000000
--- a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,187 +0,0 @@
-diff --git sandbox/linux/bpf_dsl/seccomp_macros.h sandbox/linux/bpf_dsl/seccomp_macros.h
-index a6aec544e..2a4a7f1bc 100644
---- sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,7 +16,7 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
--#elif defined(__powerpc64__)
-+#elif defined(__powerpc64__) && defined(__GLIBC__)
- // Manually define greg_t on ppc64
- typedef unsigned long long greg_t;
- #endif
-@@ -361,11 +361,11 @@ typedef struct pt_regs regs_struct;
- #define SECCOMP_ARCH AUDIT_ARCH_PPC64
- #endif
-
--#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+#define SECCOMP_REG(_ctx, _reg) (((struct pt_regs *)(_ctx)->uc_mcontext.regs)->gpr[_reg])
-
- #define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
--#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_IP(_ctx) ((struct pt_regs *)(_ctx)->uc_mcontext.regs)->nip
- #define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
- #define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-diff --git sandbox/linux/seccomp-bpf/syscall.cc sandbox/linux/seccomp-bpf/syscall.cc
-index d53a7ff56..c290f0e92 100644
---- sandbox/linux/seccomp-bpf/syscall.cc
-+++ sandbox/linux/seccomp-bpf/syscall.cc
-@@ -499,9 +499,9 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // Same as MIPS, need to invert ret and set error register (cr0.SO)
- if (ret_val <= -1 && ret_val >= -4095) {
- ret_val = -ret_val;
-- ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr |= (1 << 28);
- } else {
-- ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr &= ~(1 << 28);
- }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
---- third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-+++ third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-@@ -22,6 +22,7 @@
- // The following platforms have an implementation of a hardware counter.
- #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
- defined(__powerpc__) || defined(__ppc__) || defined(__riscv) || \
-+ ((defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__)) || defined(__riscv) || \
- defined(_M_IX86) || (defined(_M_X64) && !defined(_M_ARM64EC))
- #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1
- #else
---- third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-+++ third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-@@ -64,7 +64,7 @@
- #elif defined(__i386__) || defined(__x86_64__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_x86-inl.inc"
--#elif defined(__ppc__) || defined(__PPC__)
-+#elif (defined(__ppc__) || defined(__PPC__)) && defined(__GLIBC__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_powerpc-inl.inc"
- #elif defined(__aarch64__)
-diff --git third_party/breakpad/BUILD.gn third_party/breakpad/BUILD.gn
-index f9a60e37..25f3a0b7 100644
---- third_party/breakpad/BUILD.gn
-+++ third_party/breakpad/BUILD.gn
-@@ -637,6 +637,7 @@ if (is_linux || is_android) {
-
- if (current_cpu == "ppc64") {
- defines = [ "HAVE_GETCONTEXT" ]
-+ libs += [ "ucontext" ]
- } else {
- sources += [
- "breakpad/src/common/linux/breakpad_getcontext.S"
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index 03afec7a..0264ecf1 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -273,6 +273,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t ThreadInfo::GetInstructionPointer() const {
- return mcontext.gp_regs[PT_NIP];
- }
-@@ -290,9 +293,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->ctr = mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] = \
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 1090470f..e580233d 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -257,6 +257,9 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
- return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
- }
-@@ -280,9 +283,9 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&uc->uc_mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&uc->uc_mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] =
-diff --git third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index 5a7ab50c..ee8b858c 100644
---- third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -105,6 +105,11 @@
- #define PR_SET_PTRACER 0x59616d61
- #endif
-
-+/* musl hack, can't include asm/ptrace.h as that causes conflicts */
-+#if defined(__powerpc64__) && !defined(PT_NIP)
-+#define PT_NIP 32
-+#endif
-+
- namespace google_breakpad {
-
- namespace {
-diff --git third_party/crashpad/crashpad/snapshot/linux/signal_context.h third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 8e335a09..b2a0f155 100644
---- third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -469,7 +469,7 @@ struct MContext64 {
- SignalThreadContext64 gp_regs;
- SignalFloatContext64 fp_regs;
- SignalVectorContext64 *v_regs;
-- int64_t vmx_reserve[69];
-+ int64_t vmx_reserve[101];
- };
-
- struct ContextTraits64 : public Traits64 {
-diff --git third_party/crashpad/crashpad/util/linux/thread_info.h third_party/crashpad/crashpad/util/linux/thread_info.h
-index dea0d1f3..b203e5b2 100644
---- third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -30,6 +30,7 @@
-
- #if defined(ARCH_CPU_PPC64_FAMILY)
- #include <sys/ucontext.h>
-+#include <asm/ptrace.h>
- #endif
-
- namespace crashpad {
-diff --git third_party/lss/linux_syscall_support.h third_party/lss/linux_syscall_support.h
-index 9955ce44..4c1cc488 100644
---- third_party/lss/linux_syscall_support.h
-+++ third_party/lss/linux_syscall_support.h
-@@ -4216,9 +4216,13 @@ struct kernel_statfs {
- }
- #endif
- #if defined(__NR_fstatat64)
-+ // musl does #define fstatat64 fstatat
-+ #undef fstatat64
- LSS_INLINE _syscall4(int, fstatat64, int, d,
- const char *, p,
- struct kernel_stat64 *, b, int, f)
-+ // set it back like it was
-+ #define fstatat64 fstatat
- #endif
- #if defined(__NR_waitpid)
- // waitpid is polyfilled below when not available.
diff --git a/srcpkgs/chromium/patches/build-add-use_cxx17.patch b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
index 091b1c553727..b50825fb7e2c 100644
--- a/srcpkgs/chromium/patches/build-add-use_cxx17.patch
+++ b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
@@ -1,26 +1,22 @@
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
-@@ -167,6 +167,10 @@
- # Enable -H, which prints the include tree during compilation.
- # For use by tools/clang/scripts/analyze_includes.py
- show_includes = false
-+
-+ # Allow projects that wish to stay on C++17 to override Chromium's default.
-+ # TODO(crbug.com/1402249): evaluate removing this end of 2023
-+ use_cxx17 = false
+@@ -191,6 +191,10 @@
+ current_cpu == "x64"))))
}
- declare_args() {
-@@ -596,7 +600,11 @@
- } else if (is_linux) {
- # TODO(crbug.com/1284275): Switch to C++20 on all platforms.
- if (is_clang) {
-- cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ if (use_cxx17) {
-+ cflags_cc += [ "-std=${standard_prefix}++17" ]
-+ } else {
-+ cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ }
++declare_args() {
++ use_cxx17 = false
++}
++
+ if (is_android || (is_chromeos_ash && is_chromeos_device)) {
+ # Set the path to use orderfile for linking Chrome
+ # Note that this is for using only one orderfile for linking
+@@ -605,7 +609,7 @@
+ cflags_cc += [ "-fno-trigraphs" ]
+ }
+ } else if (is_clang) {
+- if (is_chromeos_device) {
++ if (is_chromeos_device || use_cxx17) {
+ # TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
+ cflags_cc += [ "-std=${standard_prefix}++17" ]
} else {
- # The gcc bots are currently using GCC 9, which is not new enough to
- # support "c++20"/"gnu++20".
diff --git a/srcpkgs/chromium/patches/fix-build-with-old-clang.patch b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
new file mode 100644
index 000000000000..f23218e71e4d
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
@@ -0,0 +1,20 @@
+--- a/build/config/compiler/BUILD.gn
++++ b/build/config/compiler/BUILD.gn
+@@ -805,17 +805,6 @@
+ cflags += [ "-fcomplete-member-pointers" ]
+ }
+
+- # Use DWARF simple template names, with the following exceptions:
+- #
+- # * Windows is not supported as it doesn't use DWARF.
+- # * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
+- # lldb doesn't have the needed changes yet.
+- # * Fuchsia isn't supported as zxdb doesn't support simple template names yet.
+- # TODO(crbug.com/1379070): Remove if the upstream default ever changes.
+- if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
+- cflags_cc += [ "-gsimple-template-names" ]
+- }
+-
+ # MLGO specific flags. These flags enable an ML-based inliner trained on
+ # Chrome on Android (arm32) with ThinLTO enabled, optimizing for size.
+ # The "release" ML model is embedded into clang as part of its build.
diff --git a/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch b/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
new file mode 100644
index 000000000000..570ca6e69a80
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
@@ -0,0 +1,21 @@
+--- a/third_party/blink/renderer/platform/media/web_media_player_impl.cc.orig
++++ b/third_party/blink/renderer/platform/media/web_media_player_impl.cc
+@@ -3881,15 +3881,15 @@
+ const T&... values) {
+ std::string strkey = std::string(key);
+
+- if constexpr (Flags & kEncrypted) {
++ if constexpr (Flags & kEncrypted != 0) {
+ if (is_encrypted_)
+ UmaFunction(strkey + ".EME", values...);
+ }
+
+- if constexpr (Flags & kTotal)
++ if constexpr (Flags & kTotal != 0)
+ UmaFunction(strkey + ".All", values...);
+
+- if constexpr (Flags & kPlaybackType) {
++ if constexpr (Flags & kPlaybackType != 0) {
+ auto demuxer_type = GetDemuxerType();
+ if (!demuxer_type.has_value())
+ return;
diff --git a/srcpkgs/chromium/patches/fix-musl-no-mallinfo.patch b/srcpkgs/chromium/patches/fix-musl-no-mallinfo.patch
new file mode 100644
index 000000000000..1718eccb2204
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-musl-no-mallinfo.patch
@@ -0,0 +1,11 @@
+--- a/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
++++ b/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
+@@ -717,7 +717,7 @@
+
+ #endif // !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS)
+ SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW {
+ base::SimplePartitionStatsDumper allocator_dumper;
+ Allocator()->DumpStats("malloc", true, &allocator_dumper);
diff --git a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch b/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
deleted file mode 100644
index cd5533190db9..000000000000
--- a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- a/base/threading/platform_thread_linux.cc
-+++ b/base/threading/platform_thread_linux.cc
-@@ -436,8 +436,13 @@
-
- size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
- #if !defined(THREAD_SANITIZER)
-+#if defined(__GLIBC__)
- return 0;
- #else
-+ // musl libcs default is too small, use 8mb like glibc
-+ return (1 << 23);
-+#endif
-+#else
- // ThreadSanitizer bloats the stack heavily. Evidence has been that the
- // default stack size isn't enough for some browser tests.
- return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux).
---- a/chrome/browser/shutdown_signal_handlers_posix.cc
-+++ b/chrome/browser/shutdown_signal_handlers_posix.cc
-@@ -188,11 +188,21 @@
- g_shutdown_pipe_read_fd = pipefd[0];
- g_shutdown_pipe_write_fd = pipefd[1];
- #if !defined(ADDRESS_SANITIZER)
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
- #else
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 * 8;
-+#endif
-+#else
- // ASan instrumentation bloats the stack frames, so we need to increase the
- // stack size to avoid hitting the guard page.
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
-+#else
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 * 8;
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+#endif
- #endif
- ShutdownDetector* detector = new ShutdownDetector(
- g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);
diff --git a/srcpkgs/chromium/patches/fix-narrowing-cast.patch b/srcpkgs/chromium/patches/fix-narrowing-cast.patch
index afd42a1489ae..1a247e54fe7c 100644
--- a/srcpkgs/chromium/patches/fix-narrowing-cast.patch
+++ b/srcpkgs/chromium/patches/fix-narrowing-cast.patch
@@ -1,43 +1,6 @@
---- a/base/files/file_util_linux.cc
-+++ b/base/files/file_util_linux.cc
-@@ -23,14 +23,14 @@
-
- // Not all possible |statfs_buf.f_type| values are in linux/magic.h.
- // Missing values are copied from the statfs man page.
-- switch (statfs_buf.f_type) {
-+ switch (static_cast<uintmax_t>(statfs_buf.f_type)) {
- case 0:
- *type = FILE_SYSTEM_0;
- break;
- case EXT2_SUPER_MAGIC: // Also ext3 and ext4
- case MSDOS_SUPER_MAGIC:
- case REISERFS_SUPER_MAGIC:
-- case static_cast<int>(BTRFS_SUPER_MAGIC):
-+ case BTRFS_SUPER_MAGIC:
- case 0x5346544E: // NTFS
- case 0x58465342: // XFS
- case 0x3153464A: // JFS
-@@ -40,14 +40,14 @@
- *type = FILE_SYSTEM_NFS;
- break;
- case SMB_SUPER_MAGIC:
-- case static_cast<int>(0xFF534D42): // CIFS
-+ case 0xFF534D42: // CIFS
- *type = FILE_SYSTEM_SMB;
- break;
- case CODA_SUPER_MAGIC:
- *type = FILE_SYSTEM_CODA;
- break;
-- case static_cast<int>(HUGETLBFS_MAGIC):
-- case static_cast<int>(RAMFS_MAGIC):
-+ case HUGETLBFS_MAGIC:
-+ case RAMFS_MAGIC:
- case TMPFS_MAGIC:
- *type = FILE_SYSTEM_MEMORY;
- break;
--- a/base/system/sys_info_posix.cc
+++ b/base/system/sys_info_posix.cc
-@@ -100,10 +100,10 @@
+@@ -62,10 +62,10 @@
if (HANDLE_EINTR(statfs(path.value().c_str(), &stats)) != 0)
return false;
diff --git a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch b/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
deleted file mode 100644
index 7a0337f3bf3b..000000000000
--- a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/third_party/nasm/config/config-linux.h
-+++ b/third_party/nasm/config/config-linux.h
-@@ -139,7 +139,9 @@
- #define HAVE_ACCESS 1
-
- /* Define to 1 if you have the `canonicalize_file_name' function. */
-+#ifdef __GLIBC__
- #define HAVE_CANONICALIZE_FILE_NAME 1
-+#endif
-
- /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
- /* #undef HAVE_CPU_TO_LE16 */
diff --git a/srcpkgs/chromium/patches/musl-partition-atfork.patch b/srcpkgs/chromium/patches/musl-partition-atfork.patch
new file mode 100644
index 000000000000..2910aa2bbf9b
--- /dev/null
+++ b/srcpkgs/chromium/patches/musl-partition-atfork.patch
@@ -0,0 +1,11 @@
+--- a/base/allocator/partition_allocator/partition_root.cc
++++ b/base/allocator/partition_allocator/partition_root.cc
+@@ -239,7 +239,7 @@
+ if (!g_global_init_called.compare_exchange_strong(expected, true))
+ return;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS)
+ // When fork() is called, only the current thread continues to execute in the
+ // child process. If the lock is held, but *not* by this thread when fork() is
+ // called, we have a deadlock.
diff --git a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch b/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
deleted file mode 100644
index 13d504d3e792..000000000000
--- a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From dda01a706453ded8c01c41775707cb5ef4e316f8 Mon Sep 17 00:00:00 2001
-From: Andres Salomon <dilinger@queued.net>
-Date: Tue, 25 Oct 2022 21:11:46 +0000
-Subject: [PATCH] Re-fix TFLite build error on linux when using the system zlib
-
-In commit ae0f9adb7e14c0d19ca695ef6ad40b321a8cb64c, I fixed some build
-errors related to minizip patch inclusion in TFLite. However, after that
-when TFLite Support was rolled to HEAD, a small part of that patch got
-dropped. The result is the following build error with 107.0.5304.62:
-
-../../third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc:22:10: fatal error: 'contrib/minizip/ioapi.h' file not found
- ^~~~~~~~~~~~~~~~~~~~~~~~~
-1 error generated.
-
-This commit re-adds the lost fix.
-
-R=junzou@chromium.org
-
-Change-Id: Ie96c3571894b5100a1e2a2771da29699eff0beb3
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3972087
-Reviewed-by: Robert Ogden <robertogden@chromium.org>
-Commit-Queue: Robert Ogden <robertogden@chromium.org>
-Auto-Submit: Andres Salomon <dilinger@queued.net>
-Cr-Commit-Position: refs/heads/main@{#1063478}
----
- .../metadata/cc/utils/zip_readonly_mem_file.cc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-index 392b6b411fe..525ae4a2b45 100644
---- a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-+++ b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-@@ -19,7 +19,7 @@ limitations under the License.
- #include <cstdio>
-
- #include "absl/strings/string_view.h" // from @com_google_absl
--#include "contrib/minizip/ioapi.h"
-+#include "third_party/zlib/contrib/minizip/ioapi.h"
-
- namespace tflite {
- namespace metadata {
diff --git a/srcpkgs/chromium/patches/remove-strip_binary.patch b/srcpkgs/chromium/patches/remove-strip_binary.patch
deleted file mode 100644
index 8b13c6a056a8..000000000000
--- a/srcpkgs/chromium/patches/remove-strip_binary.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/chrome/test/chromedriver/BUILD.gn.orig
-+++ b/chrome/test/chromedriver/BUILD.gn
-@@ -308,11 +308,7 @@
- }
- }
-
--if (is_linux) {
-- chromedriver_output = "chromedriver.unstripped"
--} else {
-- chromedriver_output = "chromedriver"
--}
-+chromedriver_output = "chromedriver"
-
- executable("$chromedriver_output") {
- testonly = true
-@@ -336,16 +332,6 @@
- }
- }
-
--if (is_linux) {
-- strip_binary("chromedriver") {
-- testonly = true
-- binary_input = "$root_out_dir/$chromedriver_output"
-- symbol_output = "$root_out_dir/chromedriver.debug"
-- stripped_binary_output = "$root_out_dir/chromedriver"
-- deps = [ ":$chromedriver_output" ]
-- }
--}
--
- python_library("chromedriver_py_tests") {
- testonly = true
- deps = [
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch b/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
deleted file mode 100644
index 28c4ad35f14e..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-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;
-
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch b/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
deleted file mode 100644
index 0c03ad4a65eb..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-commit 981437bc846fcdb854062e89fd3d86f112e5f426
-Author: q66 <daniel@octaforge.org>
-Date: Sat Jun 25 12:35:37 2022 +0200
-
- Use generic target for now.
-
- This is because the source tree is missing vsx optimizations that
- then do not get included and result in failed linking such as:
-
- ld.lld: error: undefined symbol: vpx_mse16x16_vsx
-
-diff --git a/third_party/libvpx/generate_gni.sh b/third_party/libvpx/generate_gni.sh
-index 7429080..43ee29a 100755
---- a/third_party/libvpx/generate_gni.sh
-+++ b/third_party/libvpx/generate_gni.sh
-@@ -405,7 +405,7 @@
- gen_config_files linux/mips64el "--target=mips64-linux-gcc ${all_platforms}"
- gen_config_files linux/loongarch \
- "--target=loongarch64-linux-gcc ${all_platforms}"
--gen_config_files linux/ppc64 "--target=ppc64le-linux-gcc ${all_platforms}"
-+gen_config_files linux/ppc64 "--target=generic-gnu ${all_platforms}"
- gen_config_files linux/generic "--target=generic-gnu $HIGHBD ${all_platforms}"
- gen_config_files win/arm64 \
- "--target=arm64-win64-vs15 ${all_platforms} ${HIGHBD}"
-@@ -468,7 +468,7 @@
- gen_rtcd_header linux/mipsel mipsel
- gen_rtcd_header linux/mips64el mips64el
- gen_rtcd_header linux/loongarch loongarch
--gen_rtcd_header linux/ppc64 ppc
-+gen_rtcd_header linux/ppc64 generic
- gen_rtcd_header linux/generic generic
- gen_rtcd_header win/arm64 armv8
- gen_rtcd_header win/ia32 x86 "${require_sse2}"
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch b/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
deleted file mode 100644
index 4bfb5d494b06..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/sandbox/linux/system_headers/linux_stat.h
-+++ b/sandbox/linux/system_headers/linux_stat.h
-@@ -155,6 +155,28 @@ struct kernel_stat {
- unsigned int __unused4;
- unsigned int __unused5;
- };
-+#elif defined(__powerpc64__)
-+struct kernel_stat {
-+ unsigned long st_dev;
-+ unsigned long st_ino;
-+ unsigned long st_nlink;
-+ unsigned int st_mode;
-+ unsigned int st_uid;
-+ unsigned int st_gid;
-+ unsigned long st_rdev;
-+ long st_size;
-+ unsigned long st_blksize;
-+ unsigned long st_blocks;
-+ unsigned long st_atime_;
-+ unsigned long st_atime_nsec_;
-+ unsigned long st_mtime_;
-+ unsigned long st_mtime_nsec_;
-+ unsigned long st_ctime_;
-+ unsigned long st_ctime_nsec_;
-+ unsigned long __unused4;
-+ unsigned long __unused5;
-+ unsigned long __unused6;
-+};
- #endif
-
- // On 32-bit systems, we default to the 64-bit stat struct like libc
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 0bc505358916..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,3590 +0,0 @@
-commit 2c013a317b1114ef67cdbbc30824b28907b9ea94
-Author: Daniel Kolesa <daniel@octaforge.org>
-Date: Wed Mar 3 19:08:29 2021 +0100
-
- ppc64le support
-
-diff --git a/build/download_nacl_toolchains.py b/build/download_nacl_toolchains.py
-index 286a92a27..ec36a85d3 100755
---- a/build/download_nacl_toolchains.py
-+++ b/build/download_nacl_toolchains.py
-@@ -13,6 +13,10 @@ import sys
-
-
- def Main(args):
-+ # If `disable_nacl=1` is in GYP_DEFINES, exit
-+ if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''):
-+ return 0
-+
- script_dir = os.path.dirname(os.path.abspath(__file__))
- src_dir = os.path.dirname(script_dir)
- nacl_dir = os.path.join(src_dir, 'native_client')
---- a/chrome/installer/linux/BUILD.gn
-+++ b/chrome/installer/linux/BUILD.gn
-@@ -97,8 +97,6 @@
- "$root_out_dir/xdg-mime",
- "$root_out_dir/xdg-settings",
- "$root_out_dir/locales/en-US.pak",
-- "$root_out_dir/MEIPreload/manifest.json",
-- "$root_out_dir/MEIPreload/preloaded_data.pb",
- ]
-
- action_foreach("calculate_deb_dependencies") {
-@@ -377,7 +377,6 @@
- "//chrome",
- "//chrome:packed_resources",
- "//chrome/browser/enterprise/connectors/device_trust/key_management/installer/management_service:chrome_management_service",
-- "//chrome/browser/resources/media/mei_preload:component",
- "//components/crash/core/app:chrome_crashpad_handler",
- "//sandbox/linux:chrome_sandbox",
- ]
-diff --git a/sandbox/features.gni b/sandbox/features.gni
-index db30ae6d6..9dc09bf53 100644
---- a/sandbox/features.gni
-+++ b/sandbox/features.gni
-@@ -11,7 +11,8 @@ import("//build/config/nacl/config.gni")
- use_seccomp_bpf = (is_linux || is_chromeos || is_android) &&
- (current_cpu == "x86" || current_cpu == "x64" ||
- current_cpu == "arm" || current_cpu == "arm64" ||
-- current_cpu == "mipsel" || current_cpu == "mips64el")
-+ current_cpu == "mipsel" || current_cpu == "mips64el" ||
-+ current_cpu == "ppc64")
-
- use_seccomp_bpf = use_seccomp_bpf || is_nacl_nonsfi
-
-diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn
-index e9a94b461..cca1a5da5 100644
---- a/sandbox/linux/BUILD.gn
-+++ b/sandbox/linux/BUILD.gn
-@@ -427,6 +427,8 @@ component("sandbox_services") {
-
- source_set("sandbox_services_headers") {
- sources = [
-+ "system_headers/ppc64_linux_syscalls.h",
-+ "system_headers/ppc64_linux_ucontext.h",
- "system_headers/arm64_linux_syscalls.h",
- "system_headers/arm_linux_syscalls.h",
- "system_headers/arm_linux_ucontext.h",
-diff --git a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-index 313511f22..0ca3a326f 100644
---- a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-+++ b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-@@ -56,6 +56,13 @@
- #define MAX_PUBLIC_SYSCALL __NR_syscalls
- #define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-
-+#elif defined(__powerpc64__)
-+
-+#include <asm-generic/unistd.h>
-+#define MIN_SYSCALL 0u
-+#define MAX_PUBLIC_SYSCALL __NR_syscalls
-+#define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-+
- #else
- #error "Unsupported architecture"
- #endif
-diff --git a/sandbox/linux/bpf_dsl/seccomp_macros.h b/sandbox/linux/bpf_dsl/seccomp_macros.h
-index 1a407b952..a6aec544e 100644
---- a/sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ b/sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,6 +16,9 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
-+#elif defined(__powerpc64__)
-+// Manually define greg_t on ppc64
-+typedef unsigned long long greg_t;
- #endif
- #endif
-
-@@ -346,6 +349,51 @@ struct regs_struct {
- #define SECCOMP_PT_PARM4(_regs) (_regs).regs[3]
- #define SECCOMP_PT_PARM5(_regs) (_regs).regs[4]
- #define SECCOMP_PT_PARM6(_regs) (_regs).regs[5]
-+
-+#elif defined(__powerpc64__)
-+#include <asm/ptrace.h>
-+
-+typedef struct pt_regs regs_struct;
-+
-+#ifdef ARCH_CPU_LITTLE_ENDIAN
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64LE
-+#else
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64
-+#endif
-+
-+#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+
-+#define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
-+#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
-+#define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-+#define SECCOMP_PARM4(_ctx) SECCOMP_REG(_ctx, 6)
-+#define SECCOMP_PARM5(_ctx) SECCOMP_REG(_ctx, 7)
-+#define SECCOMP_PARM6(_ctx) SECCOMP_REG(_ctx, 8)
-+
-+#define SECCOMP_NR_IDX (offsetof(struct arch_seccomp_data, nr))
-+#define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch))
-+#define SECCOMP_IP_MSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 4)
-+#define SECCOMP_IP_LSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 0)
-+#define SECCOMP_ARG_MSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 4)
-+#define SECCOMP_ARG_LSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 0)
-+
-+#define SECCOMP_PT_RESULT(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_SYSCALL(_regs) (_regs).gpr[0]
-+#define SECCOMP_PT_IP(_regs) (_regs).nip
-+#define SECCOMP_PT_PARM1(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_PARM2(_regs) (_regs).gpr[4]
-+#define SECCOMP_PT_PARM3(_regs) (_regs).gpr[5]
-+#define SECCOMP_PT_PARM4(_regs) (_regs).gpr[6]
-+#define SECCOMP_PT_PARM5(_regs) (_regs).gpr[7]
-+#define SECCOMP_PT_PARM6(_regs) (_regs).gpr[8]
-+
- #else
- #error Unsupported target platform
-
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-index 6a1ec2389..f20c582dd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-@@ -88,7 +88,8 @@ bool IsBaselinePolicyWatched(int sysno) {
- SyscallSets::IsPrctl(sysno) ||
- SyscallSets::IsProcessGroupOrSession(sysno) ||
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- SyscallSets::IsSocketCall(sysno) ||
- #endif
- #if defined(__arm__)
-@@ -227,7 +228,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_mmap)
- return RestrictMmapFlags();
- #endif
-@@ -245,7 +246,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- return RestrictPrctl();
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_socketpair) {
- // Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen.
- static_assert(AF_UNIX == PF_UNIX,
-@@ -285,7 +286,8 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- if (SyscallSets::IsSocketCall(sysno))
- return RestrictSocketcallCommand();
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:11:10.481579470 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:12:43.524831376 -0400
-@@ -302,7 +302,7 @@
- TEST_BASELINE_SIGSYS(__NR_syslog)
- TEST_BASELINE_SIGSYS(__NR_timer_create)
-
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- TEST_BASELINE_SIGSYS(__NR_inotify_init)
- TEST_BASELINE_SIGSYS(__NR_vserver)
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-@@ -358,7 +358,16 @@
- if (args.nr == __NR_fstatat_default) {
- if (*reinterpret_cast<const char*>(args.args[1]) == '\0' &&
- args.args[3] == static_cast<uint64_t>(AT_EMPTY_PATH)) {
-- return syscall(__NR_fstat_default, static_cast<int>(args.args[0]),
-+ int fd = static_cast<int>(args.args[0]);
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO: Investigate the root cause and fix in glibc
-+ if (fd < 0)
-+ fd = -fd;
-+#endif
-+ return syscall(__NR_fstat_default, fd,
- reinterpret_cast<default_stat_struct*>(args.args[2]));
- }
- return -reinterpret_cast<intptr_t>(fs_denied_errno);
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
-index 2a97d3916..8e81aa6cf 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-14 14:41:08.000000000 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-15 13:17:57.808715733 -0400
-@@ -37,7 +37,8 @@
-
- #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
- !defined(__arm__) && !defined(__aarch64__) && \
-- !defined(PTRACE_GET_THREAD_AREA)
-+ !defined(PTRACE_GET_THREAD_AREA) && \
-+ !defined(__powerpc64__)
- // Also include asm/ptrace-abi.h since ptrace.h in older libc (for instance
- // the one in Ubuntu 16.04 LTS) is missing PTRACE_GET_THREAD_AREA.
- // asm/ptrace-abi.h doesn't exist on arm32 and PTRACE_GET_THREAD_AREA isn't
-@@ -45,6 +46,11 @@
- #include <asm/ptrace-abi.h>
- #endif
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- #if BUILDFLAG(IS_ANDROID)
-
- #if !defined(F_DUPFD_CLOEXEC)
-@@ -99,6 +105,14 @@
- return true;
- #else
- return false;
-+#endif
-+}
-+
-+inline bool IsArchitecturePPC64() {
-+#if defined(__powerpc64__)
-+ return true;
-+#else
-+ return false;
- #endif
- }
-
-@@ -239,6 +254,8 @@
- uint64_t kOLargeFileFlag = O_LARGEFILE;
- if (IsArchitectureX86_64() || IsArchitectureI386() || IsArchitectureMips())
- kOLargeFileFlag = 0100000;
-+ else if (IsArchitecturePPC64())
-+ kOLargeFileFlag = 0200000;
-
- const Arg<int> cmd(1);
- const Arg<long> long_arg(2);
-@@ -256,7 +273,16 @@
- F_SETLKW,
- F_GETLK,
- F_DUPFD,
-- F_DUPFD_CLOEXEC),
-+ F_DUPFD_CLOEXEC
-+#if defined(__powerpc64__)
-+// On PPC64, F_SETLK, F_GETLK, F_SETLKW are defined as the 64-bit variants
-+// but glibc will sometimes still use the 32-bit versions. Allow both.
-+ ,
-+ 5, /* F_GETLK (32) */
-+ 6, /* F_SETLK (32) */
-+ 7 /* F_SETLKW (32) */
-+#endif
-+ ),
- Allow())
- .Case(F_SETFL,
- If((long_arg & ~kAllowedMask) == 0, Allow()).Else(CrashSIGSYS()))
-@@ -266,7 +292,7 @@
- // clang-format on
- }
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- ResultExpr RestrictSocketcallCommand() {
- // Unfortunately, we are unable to restrict the first parameter to
- // socketpair(2). Whilst initially sounding bad, it's noteworthy that very
-@@ -419,7 +445,7 @@
- #endif
- return Switch(request)
- .CASES((
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- PTRACE_GETREGS, PTRACE_GETFPREGS, PTRACE_GET_THREAD_AREA,
- PTRACE_GETREGSET,
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-index ba4289f05..9a4d5ab2d 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-@@ -48,7 +48,7 @@ SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictMprotectFlags();
- // O_NONBLOCK | O_SYNC | O_LARGEFILE | O_CLOEXEC | O_NOATIME.
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictFcntlCommands();
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- // Restrict socketcall(2) to only allow socketpair(2), send(2), recv(2),
- // sendto(2), recvfrom(2), shutdown(2), sendmsg(2) and recvmsg(2).
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictSocketcallCommand();
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-index 642df7207..34f47eb73 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-@@ -29,7 +29,8 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- switch (sysno) {
- case __NR_gettimeofday:
- #if defined(__i386__) || defined(__x86_64__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_time:
- #endif
- return true;
-@@ -52,12 +53,14 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- case __NR_clock_nanosleep_time64: // Parameters filtered by RestrictClockID().
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ftime: // Obsolete.
- #endif
- case __NR_settimeofday: // Privileged.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stime:
- #endif
- default:
-@@ -135,7 +138,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_faccessat: // EPERM not a valid errno.
- case __NR_fchmodat:
- case __NR_fchownat: // Should be called chownat ?
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat: // fstatat(). EPERM not a valid errno.
- #elif defined(__i386__) || defined(__arm__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-@@ -154,7 +157,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_memfd_create:
- case __NR_mkdirat:
- case __NR_mknodat:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldlstat:
- case __NR_oldstat:
- #endif
-@@ -168,7 +171,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- #endif
- case __NR_statfs: // EPERM not a valid errno.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_statfs64:
- #endif
- case __NR_symlinkat:
-@@ -178,7 +182,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_truncate64:
- #endif
- case __NR_unlinkat:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_utime:
- #endif
- case __NR_utimensat: // New.
-@@ -203,7 +208,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- #endif
- return true;
- // TODO(jln): these should be denied gracefully as well (moved below).
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_fadvise64: // EPERM not a valid errno.
- #endif
- #if defined(__i386__)
-@@ -216,11 +222,12 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_flock: // EPERM not a valid errno.
- case __NR_fstatfs: // Give information about the whole filesystem.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_fstatfs64:
- #endif
- case __NR_fsync: // EPERM not a valid errno.
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldfstat:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-@@ -228,6 +235,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_sync_file_range: // EPERM not a valid errno.
- #elif defined(__arm__)
- case __NR_arm_sync_file_range: // EPERM not a valid errno.
-+#elif defined(__powerpc64__)
-+ case __NR_sync_file_range2: // EPERM not a valid errno.
- #endif
- default:
- return false;
-@@ -248,7 +257,8 @@ bool SyscallSets::IsDeniedFileSystemAccessViaFd(int sysno) {
- #endif
- case __NR_getdents64: // EPERM not a valid errno.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_readdir:
- #endif
- return true;
-@@ -289,7 +299,7 @@ bool SyscallSets::IsGetSimpleId(int sysno) {
- bool SyscallSets::IsProcessPrivilegeChange(int sysno) {
- switch (sysno) {
- case __NR_capset:
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_ioperm: // Intel privilege.
- case __NR_iopl: // Intel privilege.
- #endif
-@@ -340,8 +350,11 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- case __NR_rt_sigreturn:
- case __NR_rt_sigtimedwait:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
-+#ifndef __powerpc64__
- case __NR_rt_sigtimedwait_time64:
-+#endif
- case __NR_sigaction:
- case __NR_sigprocmask:
- case __NR_sigreturn:
-@@ -357,7 +370,8 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- #endif
- case __NR_signalfd4:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_sigpending:
- case __NR_sigsuspend:
- #endif
-@@ -381,7 +395,7 @@ bool SyscallSets::IsAllowedOperationOnFd(int sysno) {
- #endif
- case __NR_dup3:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_shutdown:
- #endif
- return true;
-@@ -414,7 +428,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- case __NR_exit_group:
- case __NR_wait4:
- case __NR_waitid:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_waitpid:
- #endif
- return true;
-@@ -431,7 +445,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- #endif
- case __NR_set_tid_address:
- case __NR_unshare:
--#if !defined(__mips__) && !defined(__aarch64__)
-+#if !defined(__mips__) && !defined(__aarch64__) || defined(__powerpc64__)
- case __NR_vfork:
- #endif
- default:
-@@ -484,7 +498,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- return true;
- default:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_socketpair: // We will want to inspect its argument.
- #endif
- return false;
-@@ -494,7 +508,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- switch (sysno) {
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_accept:
- case __NR_accept4:
- case __NR_bind:
-@@ -509,7 +523,8 @@ bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- bool SyscallSets::IsSocketCall(int sysno) {
- switch (sysno) {
-@@ -523,7 +538,8 @@ bool SyscallSets::IsSocketCall(int sysno) {
- }
- #endif
-
--#if defined(__x86_64__) || defined(__arm__) || defined(__mips__)
-+#if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- bool SyscallSets::IsNetworkSocketInformation(int sysno) {
- switch (sysno) {
- case __NR_getpeername:
-@@ -548,7 +564,7 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
- case __NR_mincore:
- case __NR_mlockall:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_mmap:
- #endif
- #if defined(__i386__) || defined(__arm__) || \
-@@ -578,7 +594,8 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- switch (sysno) {
- case __NR_lseek:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR__llseek:
- #endif
- #if !defined(__aarch64__)
-@@ -598,26 +615,28 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- case __NR_readv:
- case __NR_pread64:
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_recv:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_recvfrom: // Could specify source.
- case __NR_recvmsg: // Could specify source.
- #endif
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_select:
- #endif
--#if defined(__i386__) || defined(__arm__) || defined(__mips__)
-+#if defined(__i386__) || defined(__arm__) || defined(__mips__) || defined(__powerpc64__)
- case __NR__newselect:
- #endif
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_send:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_sendmsg: // Could specify destination.
- case __NR_sendto: // Could specify destination.
- #endif
-@@ -673,7 +692,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- return true;
- case __NR_getpriority:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_nice:
- #endif
- case __NR_setpriority:
-@@ -685,7 +705,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- bool SyscallSets::IsAdminOperation(int sysno) {
- switch (sysno) {
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_bdflush:
- #endif
- case __NR_kexec_load:
-@@ -701,7 +722,8 @@ bool SyscallSets::IsAdminOperation(int sysno) {
-
- bool SyscallSets::IsKernelModule(int sysno) {
- switch (sysno) {
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_create_module:
- case __NR_get_kernel_syms: // Should ENOSYS.
- case __NR_query_module:
-@@ -734,7 +756,8 @@ bool SyscallSets::IsFsControl(int sysno) {
- case __NR_swapoff:
- case __NR_swapon:
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_umount:
- #endif
- case __NR_umount2:
-@@ -750,7 +773,7 @@ bool SyscallSets::IsNuma(int sysno) {
- case __NR_getcpu:
- case __NR_mbind:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_migrate_pages:
- #endif
- case __NR_move_pages:
-@@ -785,14 +808,15 @@ bool SyscallSets::IsGlobalProcessEnvironment(int sysno) {
- switch (sysno) {
- case __NR_acct: // Privileged.
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
--#if defined(__i386__) || defined(__arm__)
-+#if defined(__i386__) || defined(__arm__) || defined(__powerpc64__)
- case __NR_ugetrlimit:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ulimit:
- #endif
- case __NR_getrusage:
-@@ -826,7 +850,7 @@ bool SyscallSets::IsGlobalSystemStatus(int sysno) {
- #endif
- case __NR_sysinfo:
- case __NR_uname:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_olduname:
- case __NR_oldolduname:
- #endif
-@@ -892,8 +916,16 @@ bool SyscallSets::IsSystemVSemaphores(int sysno) {
- }
- #endif
-
-+/* shitty hack around Void's 4.19 kernel headers missing those numbers */
-+#if defined(__powerpc64__) && !defined(__NR_shmget)
-+#define __NR_shmget 395
-+#define __NR_shmctl 396
-+#define __NR_shmat 397
-+#define __NR_shmdt 398
-+#endif
-+
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- bool SyscallSets::IsSystemVSharedMemory(int sysno) {
-@@ -925,7 +957,8 @@ bool SyscallSets::IsSystemVMessageQueue(int sysno) {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- bool SyscallSets::IsSystemVIpc(int sysno) {
- switch (sysno) {
-@@ -945,7 +978,8 @@ bool SyscallSets::IsAnySystemV(int sysno) {
- return IsSystemVMessageQueue(sysno) || IsSystemVSemaphores(sysno) ||
- IsSystemVSharedMemory(sysno);
- #elif defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- return IsSystemVIpc(sysno);
- #endif
- }
-@@ -1002,7 +1036,8 @@ bool SyscallSets::IsFaNotify(int sysno) {
- bool SyscallSets::IsTimer(int sysno) {
- switch (sysno) {
- case __NR_getitimer:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_alarm:
- #endif
- case __NR_setitimer:
-@@ -1084,18 +1119,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_syncfs:
- case __NR_vhangup:
- // The system calls below are not implemented.
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_afs_syscall:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_break:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_getpmsg:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_gtty:
- case __NR_idle:
- case __NR_lock:
-@@ -1103,20 +1142,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_prof:
- case __NR_profil:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_putpmsg:
- #endif
- #if defined(__x86_64__)
- case __NR_security:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stty:
- #endif
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- case __NR_tuxcall:
- #endif
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- case __NR_vserver:
- #endif
- return true;
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-index 923533ec9..411f72acd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-@@ -43,13 +43,14 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsDeniedGetOrModifySocket(int sysno);
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- static bool IsSocketCall(int sysno);
- #endif
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- static bool IsNetworkSocketInformation(int sysno);
- #endif
-
-@@ -76,7 +77,7 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsSystemVSemaphores(int sysno);
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- static bool IsSystemVSharedMemory(int sysno);
-@@ -88,7 +89,8 @@ class SANDBOX_EXPORT SyscallSets {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- static bool IsSystemVIpc(int sysno);
- #endif
-diff --git a/sandbox/linux/seccomp-bpf/syscall.cc b/sandbox/linux/seccomp-bpf/syscall.cc
-index e47e98bf5..d53a7ff56 100644
---- a/sandbox/linux/seccomp-bpf/syscall.cc
-+++ b/sandbox/linux/seccomp-bpf/syscall.cc
-@@ -18,7 +18,7 @@ namespace sandbox {
- namespace {
-
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined (ARCH_CPU_PPC64_FAMILY)
- // Number that's not currently used by any Linux kernel ABIs.
- const int kInvalidSyscallNumber = 0x351d3;
- #else
-@@ -310,12 +310,56 @@ asm(// We need to be able to tell the kernel exactly where we made a
- // Enter the kernel
- "svc 0\n"
- "2:ret\n"
-+ ".cfi_endproc\n"
-+ ".size SyscallAsm, .-SyscallAsm\n"
-+#elif defined(__powerpc64__)
-+ ".text\n"
-+ ".align 4\n"
-+ ".type SyscallAsm @function\n"
-+ "SyscallAsm:\n"
-+ ".cfi_startproc\n"
-+
-+ // Check if r3 is negative
-+ "cmpdi 3, 0\n"
-+ "bgt 2f\n"
-+
-+ // Load address of 3f into r3 and return
-+ "mflr 10\n"
-+ "bl 1f\n"
-+ "1: mflr 3\n"
-+ "mtlr 10\n"
-+ "addi 3, 3, 4*13\n"
-+ "blr\n"
-+
-+ // Load arguments from array into r3-8
-+ // save param 3 in r10
-+ "2:\n"
-+ "mr 0, 3\n"
-+ "ld 3, 0(4)\n"
-+ "ld 5, 16(4)\n"
-+ "ld 6, 24(4)\n"
-+ "ld 7, 32(4)\n"
-+ "ld 8, 40(4)\n"
-+ "ld 4, 8(4)\n"
-+ "li 9, 0\n"
-+
-+ // Enter kernel
-+ "sc\n"
-+
-+ // Magic return address
-+ "3:\n"
-+ // Like MIPS, ppc64 return values are always positive.
-+ // Check for error in cr0.SO and negate upon error
-+ "bc 4, 3, 4f\n"
-+ "neg 3, 3\n"
-+ "4: blr\n"
-+
- ".cfi_endproc\n"
- ".size SyscallAsm, .-SyscallAsm\n"
- #endif
- ); // asm
-
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- extern "C" {
- intptr_t SyscallAsm(intptr_t nr, const intptr_t args[6]);
- }
-@@ -429,6 +473,8 @@ intptr_t Syscall::Call(int nr,
- ret = inout;
- }
-
-+#elif defined(__powerpc64__)
-+ intptr_t ret = SyscallAsm(nr, args);
- #else
- #error "Unimplemented architecture"
- #endif
-@@ -445,8 +491,18 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // needs to be changed back.
- ret_val = -ret_val;
- SECCOMP_PARM4(ctx) = 1;
-- } else
-+ } else {
- SECCOMP_PARM4(ctx) = 0;
-+ }
-+#endif
-+#if defined(__powerpc64__)
-+ // Same as MIPS, need to invert ret and set error register (cr0.SO)
-+ if (ret_val <= -1 && ret_val >= -4095) {
-+ ret_val = -ret_val;
-+ ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ } else {
-+ ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
- }
-diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc
-index f5b86a73a..5e6c4a068 100644
---- a/sandbox/linux/seccomp-bpf/trap.cc
-+++ b/sandbox/linux/seccomp-bpf/trap.cc
-@@ -232,6 +232,20 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
- SetIsInSigHandler();
- }
-
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO(shawn@anastas.io): investigate this issue further
-+ auto nr = SECCOMP_SYSCALL(ctx);
-+ if (nr == __NR_openat || nr == __NR_mkdirat || nr == __NR_faccessat || nr == __NR_readlinkat ||
-+ nr == __NR_renameat || nr == __NR_renameat2 || nr == __NR_newfstatat || nr == __NR_unlinkat) {
-+ if (static_cast<int>(SECCOMP_PARM1(ctx)) > 0) {
-+ SECCOMP_PARM1(ctx) = -SECCOMP_PARM1(ctx);
-+ }
-+ }
-+#endif
-+
- // Copy the seccomp-specific data into a arch_seccomp_data structure. This
- // is what we are showing to TrapFnc callbacks that the system call
- // evaluator registered with the sandbox.
-diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc
-index d7b5d8c44..4adc6d0d4 100644
---- a/sandbox/linux/services/credentials.cc
-+++ b/sandbox/linux/services/credentials.cc
-@@ -81,7 +81,7 @@ bool ChrootToSafeEmptyDir() {
- pid_t pid = -1;
- alignas(16) char stack_buf[PTHREAD_STACK_MIN];
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // The stack grows downward.
- void* stack = stack_buf + sizeof(stack_buf);
- #else
-@@ -90,7 +90,9 @@
-
- int clone_flags = CLONE_FS | LINUX_SIGCHLD;
- void* tls = nullptr;
--#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
-+// RAJA this might be it...
-+#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY) || \
-+ defined(ARCH_CPU_PPC64_FAMILY)) && \
- !defined(MEMORY_SANITIZER)
- // Use CLONE_VM | CLONE_VFORK as an optimization to avoid copying page tables.
- // Since clone writes to the new child's TLS before returning, we must set a
-@@ -98,6 +100,11 @@
- // glibc performs syscalls by calling a function pointer in TLS, so we do not
- // attempt this optimization.
- // TODO(crbug.com/1247458) Broken in MSan builds after LLVM f1bb30a4956f.
-+ //
-+ // NOTE: Without CLONE_VM, fontconfig will attempt to reload configuration
-+ // in every thread. Since the rendered threads are sandboxed without
-+ // filesystem access (e.g. to /etc/fonts/fonts.conf) this will cause font
-+ // configuraiton loading failures and no fonts will be displayed!
- clone_flags |= CLONE_VM | CLONE_VFORK | CLONE_SETTLS;
-
- char tls_buf[PTHREAD_STACK_MIN] = {0};
-diff --git a/sandbox/linux/services/syscall_wrappers.cc b/sandbox/linux/services/syscall_wrappers.cc
-index fcfd2aa12..f6eb32fb7 100644
---- a/sandbox/linux/services/syscall_wrappers.cc
-+++ b/sandbox/linux/services/syscall_wrappers.cc
-@@ -58,7 +58,7 @@ long sys_clone(unsigned long flags,
- #if defined(ARCH_CPU_X86_64)
- return syscall(__NR_clone, flags, child_stack, ptid, ctid, tls);
- #elif defined(ARCH_CPU_X86) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // CONFIG_CLONE_BACKWARDS defined.
- return syscall(__NR_clone, flags, child_stack, ptid, tls, ctid);
- #endif
-diff --git a/sandbox/linux/syscall_broker/broker_process.cc b/sandbox/linux/syscall_broker/broker_process.cc
-index d72c9d238..77f1d95f5 100644
---- a/sandbox/linux/syscall_broker/broker_process.cc
-+++ b/sandbox/linux/syscall_broker/broker_process.cc
-@@ -169,7 +169,7 @@ bool BrokerProcess::IsSyscallBrokerable(int sysno, bool fast_check) const {
- #if defined(__NR_fstatat64)
- case __NR_fstatat64:
- #endif
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat:
- #endif
- return !fast_check || allowed_command_set_.test(COMMAND_STAT);
-diff --git a/sandbox/linux/system_headers/linux_seccomp.h b/sandbox/linux/system_headers/linux_seccomp.h
-index 1fa47ed09..39cc9ab53 100644
---- a/sandbox/linux/system_headers/linux_seccomp.h
-+++ b/sandbox/linux/system_headers/linux_seccomp.h
-@@ -41,6 +41,9 @@
- #ifndef EM_AARCH64
- #define EM_AARCH64 183
- #endif
-+#ifndef EM_PPC64
-+#define EM_PPC64 21
-+#endif
-
- #ifndef __AUDIT_ARCH_64BIT
- #define __AUDIT_ARCH_64BIT 0x80000000
-@@ -73,6 +76,12 @@
- #ifndef AUDIT_ARCH_AARCH64
- #define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
- #endif
-+#ifndef AUDIT_ARCH_PPC64
-+#define AUDIT_ARCH_PPC64 (EM_PPC64 | __AUDIT_ARCH_64BIT)
-+#endif
-+#ifndef AUDIT_ARCH_PPC64LE
-+#define AUDIT_ARCH_PPC64LE (EM_PPC64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
-+#endif
-
- // For prctl.h
- #ifndef PR_SET_SECCOMP
-diff --git a/sandbox/linux/system_headers/linux_signal.h b/sandbox/linux/system_headers/linux_signal.h
-index f5a736761..515b21a5f 100644
---- a/sandbox/linux/system_headers/linux_signal.h
-+++ b/sandbox/linux/system_headers/linux_signal.h
-@@ -13,7 +13,7 @@
- // (not undefined, but defined different values and in different memory
- // layouts). So, fill the gap here.
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
-
- #define LINUX_SIGHUP 1
- #define LINUX_SIGINT 2
-diff --git a/sandbox/linux/system_headers/linux_syscalls.h b/sandbox/linux/system_headers/linux_syscalls.h
-index 2b78a0cc3..0a70f5ea5 100644
---- a/sandbox/linux/system_headers/linux_syscalls.h
-+++ b/sandbox/linux/system_headers/linux_syscalls.h
-@@ -35,5 +35,9 @@
- #include "sandbox/linux/system_headers/arm64_linux_syscalls.h"
- #endif
-
-+#if defined(__powerpc64__)
-+#include "sandbox/linux/system_headers/ppc64_linux_syscalls.h"
-+#endif
-+
- #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SYSCALLS_H_
-
-diff --git a/sandbox/linux/system_headers/ppc64_linux_syscalls.h b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-new file mode 100644
-index 000000000..ccacffe22
---- /dev/null
-+++ b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-@@ -0,0 +1,12 @@
-+// Copyright 2014 The Chromium Authors. All rights reserved.
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+#define SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+
-+#include <asm/unistd.h>
-+
-+//TODO: is it necessary to redefine syscall numbers for PPC64?
-+
-+#endif // SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-diff --git a/sandbox/policy/linux/bpf_utility_policy_linux.cc b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_utility_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-@@ -34,7 +34,7 @@
- case __NR_fdatasync:
- case __NR_fsync:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
- #if defined(__i386__) || defined(__arm__)
-diff --git a/sandbox/policy/linux/bpf_renderer_policy_linux.cc b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-@@ -15,6 +15,11 @@
- #include "sandbox/linux/system_headers/linux_syscalls.h"
- #include "sandbox/policy/linux/sandbox_linux.h"
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- // TODO(vignatti): replace the local definitions below with #include
- // <linux/dma-buf.h> once kernel version 4.6 becomes widely used.
- #include <linux/types.h>
-@@ -77,7 +77,7 @@
- case __NR_ftruncate64:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- case __NR_setrlimit:
- // We allow setrlimit to dynamically adjust the address space limit as
-diff --git a/third_party/angle/src/compiler/translator/InfoSink.h b/third_party/angle/src/compiler/translator/InfoSink.h
-index 3a807e1e3..5258617a7 100644
---- a/third_party/angle/src/compiler/translator/InfoSink.h
-+++ b/third_party/angle/src/compiler/translator/InfoSink.h
-@@ -92,7 +92,16 @@ class TInfoSinkBase
- stream.precision(8);
- stream << f;
- }
-- sink.append(stream.str());
-+
-+ // Hack to work around a bug where negative floating point values
-+ // are rendered like '.0.5' instead of '-0.5'
-+ std::string res(stream.str());
-+
-+ if (signbit(f)) { // test if f is negative
-+ res[0] = '-';
-+ }
-+
-+ sink.append(res);
- return *this;
- }
- // Write boolean values as their names instead of integral value.
-diff --git a/third_party/angle/src/libANGLE/Constants.h b/third_party/angle/src/libANGLE/Constants.h
-index fcbc9246a..39ae66148 100644
---- a/third_party/angle/src/libANGLE/Constants.h
-+++ b/third_party/angle/src/libANGLE/Constants.h
-@@ -9,6 +9,7 @@
- #ifndef LIBANGLE_CONSTANTS_H_
- #define LIBANGLE_CONSTANTS_H_
-
-+#include <cstddef>
- #include "common/platform.h"
-
- #include <stdint.h>
-diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
-index 17cf9cda9..8ce96bd32 100644
---- a/third_party/boringssl/BUILD.gn
-+++ b/third_party/boringssl/BUILD.gn
-@@ -103,6 +103,13 @@ if (is_win && !is_msan && current_cpu != "arm64") {
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-+ } else if (current_cpu == "ppc64") {
-+ if (is_linux) {
-+ # TODO: ppc64 (be) check
-+ sources += crypto_sources_linux_ppc64le
-+ } else {
-+ public_configs = [ ":no_asm_config" ]
-+ }
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-diff --git a/third_party/breakpad/BUILD.gn b/third_party/breakpad/BUILD.gn
-index 4af3d7bbf..adbf54159 100644
---- a/third_party/breakpad/BUILD.gn
-+++ b/third_party/breakpad/BUILD.gn
-@@ -596,7 +596,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/minidump_file_writer.h",
- "breakpad/src/common/convert_UTF.cc",
- "breakpad/src/common/convert_UTF.h",
-- "breakpad/src/common/linux/breakpad_getcontext.S",
- "breakpad/src/common/linux/elf_core_dump.cc",
- "breakpad/src/common/linux/elf_core_dump.h",
- "breakpad/src/common/linux/elfutils.cc",
-@@ -634,6 +633,14 @@ if (is_linux || is_chromeos || is_android) {
-
- libs = [ "dl" ]
-
-+ if (current_cpu == "ppc64") {
-+ defines = [ "HAVE_GETCONTEXT" ]
-+ } else {
-+ sources += [
-+ "breakpad/src/common/linux/breakpad_getcontext.S"
-+ ]
-+ }
-+
- include_dirs = [
- ".",
- "breakpad/src",
-@@ -682,7 +689,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc",
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
- "breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
-- "breakpad/src/common/linux/breakpad_getcontext_unittest.cc",
- "breakpad/src/common/linux/elf_core_dump_unittest.cc",
- "breakpad/src/common/linux/file_id_unittest.cc",
- "breakpad/src/common/linux/linux_libc_support_unittest.cc",
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-index 07d9171a0..9aed4cb36 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-@@ -44,6 +44,8 @@ typedef MDRawContextARM RawContextCPU;
- typedef MDRawContextARM64_Old RawContextCPU;
- #elif defined(__mips__)
- typedef MDRawContextMIPS RawContextCPU;
-+#elif defined(__powerpc64__)
-+typedef MDRawContextPPC64 RawContextCPU;
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index aae1dc13b..03afec7a5 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -270,7 +270,42 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->float_save.fir = mcontext.fpc_eir;
- #endif
- }
--#endif // __mips__
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t ThreadInfo::GetInstructionPointer() const {
-+ return mcontext.gp_regs[PT_NIP];
-+}
-+
-+void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = mcontext.gp_regs[i];
-+
-+ out->lr = mcontext.gp_regs[PT_LNK];
-+ out->srr0 = mcontext.gp_regs[PT_NIP];
-+ out->srr1 = mcontext.gp_regs[PT_MSR];
-+ out->cr = mcontext.gp_regs[PT_CCR];
-+ out->xer = mcontext.gp_regs[PT_XER];
-+ out->ctr = mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] = \
-+ {(((uint64_t)vregs.vrregs[i][0]) << 32)
-+ | vregs.vrregs[i][1],
-+ (((uint64_t)vregs.vrregs[i][2]) << 32)
-+ | vregs.vrregs[i][3]};
-+
-+ out->vrsave = vregs.vrsave;
-+ out->vector_save.save_vscr = {0, vregs.vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+#endif // __powerpc64__
-
- void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- assert(gp_regs || size);
-@@ -279,6 +314,11 @@ void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- *gp_regs = mcontext.gregs;
- if (size)
- *size = sizeof(mcontext.gregs);
-+#elif defined(__powerpc64__)
-+ if (gp_regs)
-+ *gp_regs = mcontext.gp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.gp_regs);
- #else
- if (gp_regs)
- *gp_regs = ®s;
-@@ -294,6 +334,11 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- *fp_regs = &mcontext.fpregs;
- if (size)
- *size = sizeof(mcontext.fpregs);
-+#elif defined(__powerpc64__)
-+ if (fp_regs)
-+ *fp_regs = &mcontext.fp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.fp_regs);
- #else
- if (fp_regs)
- *fp_regs = &fpregs;
-@@ -302,4 +347,13 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- #endif
- }
-
-+#if defined(__powerpc64__)
-+void ThreadInfo::GetVectorRegisters(void** v_regs, size_t* size) {
-+ if (v_regs)
-+ *v_regs = &vregs;
-+ if (size)
-+ *size = sizeof(vregs);
-+}
-+#endif
-+
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-index fb216fa6d..593aac822 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-@@ -68,6 +68,10 @@ struct ThreadInfo {
- // Use the structures defined in <sys/user.h>
- struct user_regs_struct regs;
- struct user_fpsimd_struct fpregs;
-+#elif defined(__powerpc64__)
-+ // Use the structures defined in <sys/ucontext.h>.
-+ mcontext_t mcontext;
-+ vrregset_t vregs;
- #elif defined(__mips__)
- // Use the structure defined in <sys/ucontext.h>.
- mcontext_t mcontext;
-@@ -84,6 +88,11 @@ struct ThreadInfo {
-
- // Returns the pointer and size of float point register area.
- void GetFloatingPointRegisters(void** fp_regs, size_t* size);
-+
-+#if defined(__powerpc64__)
-+ // Returns the pointer and size of the vector register area. (PPC64 only)
-+ void GetVectorRegisters(void** v_regs, size_t* size);
-+#endif
- };
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 6eec1be24..741983a1a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -254,6 +254,48 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc) {
- out->float_save.fir = uc->uc_mcontext.fpc_eir; // Unused.
- #endif
- }
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
-+}
-+
-+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[PT_NIP];
-+}
-+
-+void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
-+ const vrregset_t* vregs) {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = uc->uc_mcontext.gp_regs[i];
-+
-+ out->lr = uc->uc_mcontext.gp_regs[PT_LNK];
-+ out->srr0 = uc->uc_mcontext.gp_regs[PT_NIP];
-+ out->srr1 = uc->uc_mcontext.gp_regs[PT_MSR];
-+ out->cr = uc->uc_mcontext.gp_regs[PT_CCR];
-+ out->xer = uc->uc_mcontext.gp_regs[PT_XER];
-+ out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] =
-+ {(((uint64_t)vregs->vrregs[i][0]) << 32)
-+ | vregs->vrregs[i][1],
-+ (((uint64_t)vregs->vrregs[i][2]) << 32)
-+ | vregs->vrregs[i][3]};
-+
-+ out->vrsave = vregs->vrsave;
-+ out->vector_save.save_vscr = {0, vregs->vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+
- #endif
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-index 7d4100881..c122ac92e 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-@@ -55,6 +55,9 @@ struct UContextReader {
- #elif defined(__aarch64__)
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- const struct fpsimd_context* fpregs);
-+#elif defined(__powerpc64__)
-+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
-+ const vrregset_t* vregs);
- #else
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc);
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index a6cb5f984..ae16b64d9 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -461,9 +461,16 @@ bool ExceptionHandler::HandleSignal(int /*sig*/, siginfo_t* info, void* uc) {
- memcpy(&g_crash_context_.float_state, fp_ptr,
- sizeof(g_crash_context_.float_state));
- }
-+#elif defined(__powerpc64__)
-+ // On PPC64, we must copy VR state
-+ ucontext_t* uc_ptr = (ucontext_t*)uc;
-+ if (uc_ptr->uc_mcontext.v_regs) {
-+ memcpy(&g_crash_context_.vector_state, uc_ptr->uc_mcontext.v_regs,
-+ sizeof(g_crash_context_.vector_state));
-+ }
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- // FP state is not part of user ABI on ARM Linux.
-- // In case of MIPS Linux FP state is already part of ucontext_t
-+ // In case of MIPS, Linux FP state is already part of ucontext_t
- // and 'float_state' is not a member of CrashContext.
- ucontext_t* uc_ptr = (ucontext_t*)uc;
- if (uc_ptr->uc_mcontext.fpregs) {
-@@ -708,11 +715,19 @@ bool ExceptionHandler::WriteMinidump() {
- }
- #endif
-
--#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__)
-+#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__) \
-+ && !defined(__powerpc64__)
- // FPU state is not part of ARM EABI ucontext_t.
- memcpy(&context.float_state, context.context.uc_mcontext.fpregs,
- sizeof(context.float_state));
- #endif
-+
-+#if defined(__powerpc64__)
-+ // Vector registers must be copied on PPC64
-+ memcpy(&context.vector_state, context.context.uc_mcontext.v_regs,
-+ sizeof(context.vector_state));
-+#endif
-+
- context.tid = sys_gettid();
-
- // Add an exception stream to the minidump for better reporting.
-@@ -733,6 +748,9 @@ bool ExceptionHandler::WriteMinidump() {
- #elif defined(__mips__)
- context.siginfo.si_addr =
- reinterpret_cast<void*>(context.context.uc_mcontext.pc);
-+#elif defined(__powerpc64__)
-+ context.siginfo.si_addr =
-+ reinterpret_cast<void*>(context.context.uc_mcontext.gp_regs[PT_NIP]);
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-index f80843ea7..260dd10f7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-@@ -192,7 +192,11 @@ class ExceptionHandler {
- siginfo_t siginfo;
- pid_t tid; // the crashing thread.
- ucontext_t context;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ // PPC64's FP state is a part of ucontext_t like MIPS but the vector
-+ // state is not, so a struct is needed.
-+ vstate_t vector_state;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- // #ifdef this out because FP state is not part of user ABI for Linux ARM.
- // In case of MIPS Linux FP state is already part of ucontext_t so
- // 'float_state' is not required.
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-index 35dcbfd4d..7934370fd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-@@ -307,7 +307,7 @@ TEST(ExceptionHandlerTest, ParallelChildCrashesDontHang) {
- }
-
- // Wait a while until the child should have crashed.
-- usleep(1000000);
-+ usleep(2000000);
- // Kill the child if it is still running.
- kill(child, SIGKILL);
-
-@@ -559,6 +559,8 @@ const unsigned char kIllegalInstruction[] = {
- #if defined(__mips__)
- // mfc2 zero,Impl - usually illegal in userspace.
- 0x48, 0x00, 0x00, 0x48
-+#elif defined(__powerpc64__)
-+ 0x01, 0x01, 0x01, 0x01 // Crashes on a tested POWER9 cpu
- #else
- // This crashes with SIGILL on x86/x86-64/arm.
- 0xff, 0xff, 0xff, 0xff
-@@ -754,10 +756,10 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
-
- // These are defined here so the parent can use them to check the
- // data from the minidump afterwards.
-- // Use 4k here because the OS will hand out a single page even
-+ // Use the page size here because the OS will hand out a single page even
- // if a smaller size is requested, and this test wants to
- // test the upper bound of the memory range.
-- const uint32_t kMemorySize = 4096; // bytes
-+ const uint32_t kMemorySize = getpagesize(); // bytes
- const int kOffset = kMemorySize - sizeof(kIllegalInstruction);
-
- const pid_t child = fork();
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-index fa3c1713a..6ce709e2f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-@@ -138,7 +138,9 @@ class MicrodumpWriter {
- const MicrodumpExtraInfo& microdump_extra_info,
- LinuxDumper* dumper)
- : ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -337,6 +339,8 @@ class MicrodumpWriter {
- # else
- # error "This mips ABI is currently not supported (n32)"
- #endif
-+#elif defined(__powerpc64__)
-+ const char kArch[] = "ppc64";
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -409,7 +413,9 @@ class MicrodumpWriter {
- void DumpCPUState() {
- RawContextCPU cpu;
- my_memset(&cpu, 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(&cpu, ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(&cpu, ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(&cpu, ucontext_);
-@@ -605,7 +611,9 @@ class MicrodumpWriter {
- void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); }
-
- const ucontext_t* const ucontext_;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_;
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-index 6339ac0cd..291af106b 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-@@ -279,10 +279,19 @@ TEST(MicrodumpWriterTest, BasicWithMappings) {
- CrashAndGetMicrodump(mappings, MicrodumpExtraInfo(), &buf);
- ASSERT_TRUE(ContainsMicrodump(buf));
-
-+ int page_size = getpagesize();
- #ifdef __LP64__
-- ASSERT_NE(std::string::npos,
-- buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-- "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ // This test is only available for the following page sizes
-+ ASSERT_TRUE((page_size == 4096) || (page_size == 65536));
-+ if (page_size == 4096) {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ } else {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000010000 000000000000002A 0000000000010000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ }
- #else
- ASSERT_NE(std::string::npos,
- buf.find("M 00001000 0000002A 00001000 "
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-index 415068983..b93e4afcf 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-@@ -112,6 +112,9 @@ bool LinuxCoreDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-@@ -197,7 +200,10 @@ bool LinuxCoreDumper::EnumerateThreads() {
- memset(&info, 0, sizeof(ThreadInfo));
- info.tgid = status->pr_pgrp;
- info.ppid = status->pr_ppid;
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ for (int i = 0; i < 31; i++)
-+ info.mcontext.gp_regs[i] = status->pr_reg[i];
-+#elif defined(__mips__)
- #if defined(__ANDROID__)
- for (int i = EF_R0; i <= EF_R31; i++)
- info.mcontext.gregs[i - EF_R0] = status->pr_reg[i];
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-index 7fd6532ad..199cbfffd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-@@ -765,7 +765,9 @@ bool LinuxDumper::GetStackInfo(const void** stack, size_t* stack_len,
- reinterpret_cast<uint8_t*>(int_stack_pointer & ~(page_size - 1));
-
- // The number of bytes of stack which we try to capture.
-- static const ptrdiff_t kStackToCapture = 32 * 1024;
-+ // This now depends on page_size to avoid missing data
-+ // on systems with larger page sizes.
-+ static const ptrdiff_t kStackToCapture = 8 * page_size;
-
- const MappingInfo* mapping = FindMapping(stack_pointer);
- if (!mapping)
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-index 7bee160f1..07bb2b81a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-@@ -63,7 +63,8 @@ namespace google_breakpad {
- (defined(__mips__) && _MIPS_SIM == _ABIO32)
- typedef Elf32_auxv_t elf_aux_entry;
- #elif defined(__x86_64) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM != _ABIO32)
-+ (defined(__mips__) && _MIPS_SIM != _ABIO32) || \
-+ defined(__powerpc64__)
- typedef Elf64_auxv_t elf_aux_entry;
- #endif
-
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-index 331f4bb34..3f722947f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-@@ -51,6 +51,8 @@
- #define TID_PTR_REGISTER "rcx"
- #elif defined(__mips__)
- #define TID_PTR_REGISTER "$1"
-+#elif defined(__powerpc64__)
-+#define TID_PTR_REGISTER "r8"
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-index e3ddb81a6..fa28575ef 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-@@ -149,19 +149,27 @@ bool LinuxPtraceDumper::CopyFromProcess(void* dest, pid_t child,
- return true;
- }
-
--bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid)
--{
-+bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid) {
- #ifdef PTRACE_GETREGSET
- struct iovec io;
- info->GetGeneralPurposeRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
- return false;
- }
-
- info->GetFloatingPointRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
- return false;
- }
-+
-+#if defined(__powerpc64__)
-+ // Grab the vector registers on PPC64 too
-+ info->GetVectorRegisters(&io.iov_base, &io.iov_len);
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PPC_VMX, (void*)&io) == -1) {
-+ return false;
-+ }
-+#endif // defined(__powerpc64__)
-+
- return true;
- #else
- return false;
-@@ -298,6 +306,9 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-index da71e15dc..12bfb317a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-@@ -462,6 +462,9 @@ TEST(LinuxPtraceDumperTest, VerifyStackReadWithMultipleThreads) {
- #elif defined(__mips__)
- pid_t* process_tid_location =
- reinterpret_cast<pid_t*>(one_thread.mcontext.gregs[1]);
-+#elif defined(__powerpc64__)
-+ pid_t* process_tid_location =
-+ reinterpret_cast<pid_t*>(one_thread.mcontext.gp_regs[8]);
- #else
- #error This test has not been ported to this platform.
- #endif
-@@ -559,6 +562,8 @@ TEST_F(LinuxPtraceDumperTest, SanitizeStackCopy) {
- uintptr_t heap_addr = thread_info.regs.rcx;
- #elif defined(__mips__)
- uintptr_t heap_addr = thread_info.mcontext.gregs[1];
-+#elif defined(__powerpc64__)
-+ uintptr_t heap_addr = thread_info.mcontext.gp_regs[8];
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-index 32634ef00..2a56948de 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-@@ -136,7 +136,9 @@ class MinidumpWriter {
- : fd_(minidump_fd),
- path_(minidump_path),
- ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -468,7 +470,9 @@ class MinidumpWriter {
- if (!cpu.Allocate())
- return false;
- my_memset(cpu.get(), 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(cpu.get(), ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(cpu.get(), ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(cpu.get(), ucontext_);
-@@ -897,7 +901,7 @@ class MinidumpWriter {
- dirent->location.rva = 0;
- }
-
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || defined(__powerpc64__)
- bool WriteCPUInformation(MDRawSystemInfo* sys_info) {
- char vendor_id[sizeof(sys_info->cpu.x86_cpu_info.vendor_id) + 1] = {0};
- static const char vendor_id_name[] = "vendor_id";
-@@ -917,7 +921,9 @@ class MinidumpWriter {
-
- // processor_architecture should always be set, do this first
- sys_info->processor_architecture =
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ MD_CPU_ARCHITECTURE_PPC64;
-+#elif defined(__mips__)
- # if _MIPS_SIM == _ABIO32
- MD_CPU_ARCHITECTURE_MIPS;
- # elif _MIPS_SIM == _ABI64
-@@ -1333,7 +1339,9 @@ class MinidumpWriter {
- const char* path_; // Path to the file where the minidum should be written.
-
- const ucontext_t* const ucontext_; // also from the signal handler
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_; // ditto
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-index e3b0b16da..ccd8aa0a4 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-@@ -48,6 +48,8 @@ class ExceptionHandler;
-
- #if defined(__aarch64__)
- typedef struct fpsimd_context fpstate_t;
-+#elif defined(__powerpc64__)
-+typedef vrregset_t vstate_t;
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- typedef std::remove_pointer<fpregset_t>::type fpstate_t;
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-index d192e5cbb..fc1bfa8d7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-@@ -715,6 +715,9 @@ TEST(MinidumpWriterTest, InvalidStackPointer) {
- #elif defined(__mips__)
- context.context.uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP] =
- invalid_stack_pointer;
-+#elif defined(__powerpc64__)
-+ context.context.uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP] =
-+ invalid_stack_pointer;
- #else
- # error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-index 99362945c..c54ba7145 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-@@ -65,8 +65,7 @@ bool MemoryMappedFile::Map(const char* path, size_t offset) {
- }
-
- #if defined(__x86_64__) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM == _ABI64)
--
-+ (defined(__mips__) && _MIPS_SIM == _ABI64) || defined(__powerpc64__)
- struct kernel_stat st;
- if (sys_fstat(fd, &st) == -1 || st.st_size < 0) {
- #else
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-index fad59f40c..616496d67 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-@@ -176,9 +176,10 @@ TEST_F(MemoryMappedFileTest, RemapAfterMap) {
- TEST_F(MemoryMappedFileTest, MapWithOffset) {
- // Put more data in the test file this time. Offsets can only be
- // done on page boundaries, so we need a two page file to test this.
-- const int page_size = 4096;
-- char data1[2 * page_size];
-- size_t data1_size = sizeof(data1);
-+ const int page_size = getpagesize();
-+ char *data1 = static_cast<char*>(malloc(2 * page_size));
-+ EXPECT_TRUE(data1 != NULL);
-+ size_t data1_size = (2 * page_size);
- for (size_t i = 0; i < data1_size; ++i) {
- data1[i] = i & 0x7f;
- }
-diff --git a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-index 5803b90d5..2a1cf14f0 100644
---- a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-@@ -57,8 +57,9 @@ TEST(PageAllocatorTest, LargeObject) {
-
- EXPECT_EQ(0U, allocator.pages_allocated());
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(10000));
-+ uint64_t expected_pages = 1 + ((10000 - 1) / getpagesize());
- ASSERT_FALSE(p == NULL);
-- EXPECT_EQ(3U, allocator.pages_allocated());
-+ EXPECT_EQ(expected_pages, allocator.pages_allocated());
- for (unsigned i = 1; i < 10; ++i) {
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(i));
- ASSERT_FALSE(p == NULL);
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-index 798056dfa..22bd81fff 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-@@ -202,12 +202,14 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) {
- // Check architecture and set architecture variable to corresponding flag
- // in objdump.
- switch (context->GetContextCPU()) {
-+#if defined(__i386) || defined(__x86_64)
- case MD_CONTEXT_X86:
- architecture = "i386";
- break;
- case MD_CONTEXT_AMD64:
- architecture = "i386:x86-64";
- break;
-+#endif
- default:
- // Unsupported architecture. Note that ARM architectures are not
- // supported because objdump does not support ARM.
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-index 528ee5f21..72764d6c1 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-@@ -104,6 +104,8 @@ ExploitabilityFor(const string& filename) {
- }
-
- TEST(ExploitabilityTest, TestWindowsEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("ascii_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -136,9 +138,12 @@ TEST(ExploitabilityTest, TestWindowsEngine) {
- ExploitabilityFor("read_av_clobber_write.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_LOW,
- ExploitabilityFor("read_av_conditional.dmp"));
-+#endif
- }
-
- TEST(ExploitabilityTest, TestLinuxEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if defined(__i386) || defined(__x86_64)
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_null_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -171,7 +176,8 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_executable_heap.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_jmp_to_module_not_exe_region.dmp"));
--#ifndef _WIN32
-+#endif
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_write_to_nonwritable_module.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -182,10 +188,10 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_write_to_outside_module_via_math.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_write_to_under_4k.dmp"));
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (!defined(__i386) && !defined(__x86_64))
- }
-
--#ifndef _WIN32
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- TEST(ExploitabilityLinuxUtilsTest, DisassembleBytesTest) {
- ASSERT_FALSE(ExploitabilityLinuxTest::DisassembleBytes("", NULL, 5, NULL));
- uint8_t bytes[6] = {0xc7, 0x0, 0x5, 0x0, 0x0, 0x0};
-@@ -301,6 +307,7 @@ TEST(ExploitabilityLinuxUtilsTest, CalculateAddressTest) {
- context,
- &write_address));
- }
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
-+
-
- } // namespace
-diff --git a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-index aade82c99..195aa73f3 100644
---- a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-+++ b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-@@ -77,6 +77,8 @@
- #define ELF_ARCH EM_MIPS
- #elif defined(__aarch64__)
- #define ELF_ARCH EM_AARCH64
-+#elif defined(__powerpc64__)
-+ #define ELF_ARCH EM_PPC64
- #endif
-
- #if defined(__arm__)
-@@ -87,6 +89,8 @@ typedef user_regs user_regs_struct;
- #elif defined (__mips__)
- // This file-local typedef simplifies the source code.
- typedef gregset_t user_regs_struct;
-+#elif defined(__powerpc64__)
-+typedef struct pt_regs user_regs_struct;
- #endif
-
- using google_breakpad::MDTypeHelper;
-@@ -321,6 +325,9 @@ struct CrashedProcess {
- #endif
- #if defined(__aarch64__)
- user_fpsimd_struct fpregs;
-+#endif
-+#if defined(__powerpc64__)
-+ mcontext_t mcontext;
- #endif
- uintptr_t stack_addr;
- const uint8_t* stack;
-@@ -535,6 +542,38 @@ ParseThreadRegisters(CrashedProcess::Thread* thread,
- thread->mcontext.fpc_eir = rawregs->float_save.fir;
- #endif
- }
-+#elif defined(__powerpc64__)
-+static void
-+ParseThreadRegisters(CrashedProcess::Thread* thread,
-+ const MinidumpMemoryRange& range) {
-+ const MDRawContextPPC64* rawregs = range.GetData<MDRawContextPPC64>(0);
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ thread->mcontext.gp_regs[i] = rawregs->gpr[i];
-+
-+ thread->mcontext.gp_regs[PT_LNK] = rawregs->lr;
-+ thread->mcontext.gp_regs[PT_NIP] = rawregs->srr0;
-+ thread->mcontext.gp_regs[PT_MSR] = rawregs->srr1;
-+ thread->mcontext.gp_regs[PT_CCR] = rawregs->cr;
-+ thread->mcontext.gp_regs[PT_XER] = rawregs->xer;
-+ thread->mcontext.gp_regs[PT_CTR] = rawregs->ctr;
-+ thread->mcontext.v_regs->vrsave = rawregs->vrsave;
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ thread->mcontext.fp_regs[i] = rawregs->float_save.fpregs[i];
-+
-+ thread->mcontext.fp_regs[NFPREG-1] = rawregs->float_save.fpscr;
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++) {
-+ thread->mcontext.v_regs->vrregs[i][0] = rawregs->vector_save.save_vr[i].high >> 32;
-+ thread->mcontext.v_regs->vrregs[i][1] = rawregs->vector_save.save_vr[i].high;
-+ thread->mcontext.v_regs->vrregs[i][2] = rawregs->vector_save.save_vr[i].low >> 32;
-+ thread->mcontext.v_regs->vrregs[i][3] = rawregs->vector_save.save_vr[i].low;
-+ }
-+
-+ thread->mcontext.v_regs->vscr.vscr_word = rawregs->vector_save.save_vscr.low & 0xFFFFFFFF;
-+}
-+
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -623,6 +662,12 @@ ParseSystemInfo(const Options& options, CrashedProcess* crashinfo,
- # else
- # error "This mips ABI is currently not supported (n32)"
- # endif
-+#elif defined(__powerpc64__)
-+ if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_PPC64) {
-+ fprintf(stderr,
-+ "This version of minidump-2-core only supports PPC64.\n");
-+ exit(1);
-+ }
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-diff --git a/third_party/crashpad/crashpad/CONTRIBUTORS b/third_party/crashpad/crashpad/CONTRIBUTORS
-index 8724b7f32..8e29424ef 100644
---- a/third_party/crashpad/crashpad/CONTRIBUTORS
-+++ b/third_party/crashpad/crashpad/CONTRIBUTORS
-@@ -13,3 +13,4 @@ Mark Mentovai <mark@chromium.org>
- Robert Sesek <rsesek@chromium.org>
- Scott Graham <scottmg@chromium.org>
- Joshua Peraza <jperaza@chromium.org>
-+Shawn Anastasio <shawn@anastas.io>
-diff --git a/third_party/crashpad/crashpad/compat/linux/sys/user.h b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-index 6ed77a98e..1fd83469a 100644
---- a/third_party/crashpad/crashpad/compat/linux/sys/user.h
-+++ b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_COMPAT_LINUX_SYS_USER_H_
- #define CRASHPAD_COMPAT_LINUX_SYS_USER_H_
-
-+#include <cstddef>
- #include_next <sys/user.h>
-
- #include <features.h>
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context.h b/third_party/crashpad/crashpad/minidump/minidump_context.h
-index 3a3e603cb..3118d9e9f 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context.h
-@@ -592,6 +592,70 @@ struct MinidumpContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief ppc64-specific flags for MinidumpPPC64::context_flags
-+//! Based on minidump_cpu_ppc64.h from breakpad
-+enum MinidumpContextPPC64Flags : uint32_t {
-+ //! \brief Identifies the context as PPC64.
-+ kMinidumpContextPPC64 = 0x01000000,
-+
-+ //! \brief Indicates the validity of general purpose registers.
-+ //!
-+ //! Registers `r0`-`r31`, `nip`, `msr`, `lr`, etc. are valid.
-+ kMinidumpContextPPC64Base = kMinidumpContextPPC64 | 0x00000001,
-+
-+ //! \brief Indicates the validity of floating point registers.
-+ //!
-+ //! Registers `fp0`-`fp31`, `fpscr` are valid.
-+ kMinidumpContextPPC64Floating = kMinidumpContextPPC64 | 0x00000008,
-+
-+ //! \brief Indicates the validity of Altivec/VMX registers.
-+ //!
-+ //! Registers `v0`-`v31`, `vscr`, `vrsave`.
-+ kMinidumpContextPPC64Vector = kMinidumpContextPPC64 | 0x00000020,
-+
-+ //! \brief Indicates the validity of all registers
-+ kMinidumpContextPPC64All = kMinidumpContextPPC64Base |
-+ kMinidumpContextPPC64Floating |
-+ kMinidumpContextPPC64Vector
-+};
-+
-+//! \brief A PPC64 CPU context carried in a minidump file.
-+//! Based on minidump_cpu_ppc64.h from breakpad.
-+struct MinidumpContextPPC64 {
-+ uint64_t context_flags;
-+
-+ //! \brief General purpose registers.
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+
-+ //! \brief Floating point registers.
-+ double fpregs[32];
-+
-+ //! \brief FPU status register.
-+ double fpscr;
-+
-+ //! \brief Altivec/VMX vector registers.
-+ struct {
-+ //! \brief Vector registers are 128bits.
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad5[4];
-+
-+ //! \brief VRSAVE register.
-+ uint32_t save_vrsave;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad6[7];
-+ } vregs;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-index d7e53a493..d89eb9e01 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-@@ -101,6 +101,13 @@ MinidumpContextWriter::CreateFromSnapshot(const CPUContext* context_snapshot) {
- break;
- }
-
-+ case kCPUArchitecturePPC64: {
-+ context = std::make_unique<MinidumpContextPPC64Writer>();
-+ reinterpret_cast<MinidumpContextPPC64Writer*>(context.get())
-+ ->InitalizeFromSnapshot(context_snapshot->ppc64);
-+ break;
-+ }
-+
- default: {
- LOG(ERROR) << "unknown context architecture "
- << context_snapshot->architecture;
-@@ -453,4 +460,47 @@ size_t MinidumpContextMIPS64Writer::ContextSize() const {
- return sizeof(context_);
- }
-
-+MinidumpContextPPC64Writer::MinidumpContextPPC64Writer()
-+ : MinidumpContextWriter(), context_() {
-+ context_.context_flags = kMinidumpContextPPC64;
-+}
-+
-+MinidumpContextPPC64Writer::~MinidumpContextPPC64Writer() = default;
-+
-+void MinidumpContextPPC64Writer::InitalizeFromSnapshot(
-+ const CPUContextPPC64* context_snapshot) {
-+ DCHECK_EQ(state(), kStateMutable);
-+ DCHECK_EQ(context_.context_flags, kMinidumpContextPPC64);
-+
-+ context_.context_flags = kMinidumpContextPPC64All;
-+
-+ memcpy(context_.regs, context_snapshot->regs, sizeof(context_.regs));
-+ context_.nip = context_snapshot->nip;
-+ context_.msr = context_snapshot->msr;
-+ context_.ccr = context_snapshot->ccr;
-+ context_.xer = context_snapshot->xer;
-+ context_.lnk = context_snapshot->lnk;
-+ context_.ctr = context_snapshot->ctr;
-+
-+ memcpy(context_.fpregs, context_snapshot->fpregs, sizeof(context_.fpregs));
-+ context_.fpscr = context_snapshot->fpscr;
-+
-+ memcpy(context_.vregs.save_vr, context_snapshot->vregs.save_vr,
-+ sizeof(context_.vregs.save_vr));
-+ memcpy(&context_.vregs.save_vscr, &context_snapshot->vregs.save_vscr,
-+ sizeof(context_.vregs.save_vscr));
-+ context_.vregs.save_vrsave = context_snapshot->vregs.save_vrsave;
-+}
-+
-+bool MinidumpContextPPC64Writer::WriteObject(
-+ FileWriterInterface* file_writer) {
-+ DCHECK_EQ(state(), kStateWritable);
-+ return file_writer->Write(&context_, sizeof(context_));
-+}
-+
-+size_t MinidumpContextPPC64Writer::ContextSize() const {
-+ DCHECK_GE(state(), kStateFrozen);
-+ return sizeof(context_);
-+}
-+
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-index d4ab936ee..1d22fc59c 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-@@ -315,6 +315,43 @@ class MinidumpContextMIPS64Writer final : public MinidumpContextWriter {
- MinidumpContextMIPS64 context_;
- };
-
-+class MinidumpContextPPC64Writer final : public MinidumpContextWriter {
-+ public:
-+ MinidumpContextPPC64Writer();
-+ ~MinidumpContextPPC64Writer() override;
-+
-+ //! \brief Initalizes the MinidumpContextPPC64 based on \a context_snapshot.
-+ //!
-+ //! \param[in] context_snapshot The context snapshot to use as source data.
-+ //!
-+ //! \note Valid in #kStateMutable. No mutation of context() may be done before
-+ //! calling this method, and it is not normally necessary to alter
-+ //! context() after calling this method.
-+ void InitalizeFromSnapshot(const CPUContextPPC64* context_snapshot);
-+
-+ //! \brief Returns a pointer to the context structure that this object will
-+ //! write.
-+ //!
-+ //! \attention This returns a non-`const` pointer to this object’s private
-+ //! data so that a caller can populate the context structure directly.
-+ //! This is done because providing setter interfaces to each field in the
-+ //! context structure would be unwieldy and cumbersome. Care must be taken
-+ //! to populate the context structure correctly. The context structure
-+ //! must only be modified while this object is in the #kStateMutable
-+ //! state.
-+ MinidumpContextPPC64* context() { return &context_; }
-+
-+ protected:
-+ // MinidumpWritable:
-+ bool WriteObject(FileWriterInterface* file_writer) override;
-+
-+ // MinidumpContextWriter:
-+ size_t ContextSize() const override;
-+
-+ private:
-+ MinidumpContextPPC64 context_;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_WRITER_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-index 3216a906b..a9fcbe9d8 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-@@ -213,6 +213,21 @@ TEST(MinidumpContextWriter, MIPS64_FromSnapshot) {
- context, ExpectMinidumpContextMIPS64, kSeed);
- }
-
-+TEST(MinidumpContextWriter, PPC64_Zeros) {
-+ EmptyContextTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ ExpectMinidumpContextPPC64);
-+}
-+
-+TEST(MinidumpContextWriter, PPC64_FromSnapshot) {
-+ constexpr uint32_t kSeed = 64;
-+ CPUContextPPC64 context_ppc64;
-+ CPUContext context;
-+ context.ppc64 = &context_ppc64;
-+ InitializeCPUContextPPC64(&context, kSeed);
-+ FromSnapshotTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ context, ExpectMinidumpContextPPC64, kSeed);
-+}
-+
- } // namespace
- } // namespace test
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-index 0974e3ddf..b71ec5880 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-@@ -135,6 +135,8 @@ std::string MinidumpMiscInfoDebugBuildString() {
- static constexpr char kCPU[] = "mips";
- #elif defined(ARCH_CPU_MIPS64EL)
- static constexpr char kCPU[] = "mips64";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kCPU[] = "ppc64";
- #else
- #error define kCPU for this CPU
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/capture_memory.cc b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-index 7a1b2763c..beda8da9e 100644
---- a/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-+++ b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-@@ -112,6 +112,11 @@ void CaptureMemory::PointedToByContext(const CPUContext& context,
- for (size_t i = 0; i < std::size(context.mipsel->regs); ++i) {
- MaybeCaptureMemoryAround(delegate, context.mipsel->regs[i]);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->nip);
-+ for (size_t i = 0; i < std::size(context.ppc64->regs); ++i) {
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->regs[i]);
-+ }
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-index 811a72095..f4f83981d 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-@@ -43,7 +43,10 @@ enum CPUArchitecture {
- kCPUArchitectureMIPSEL,
-
- //! \brief 64-bit MIPSEL.
-- kCPUArchitectureMIPS64EL
-+ kCPUArchitectureMIPS64EL,
-+
-+ //! \brief 64-bit PPC64.
-+ kCPUArchitecturePPC64
- };
-
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.cc b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-index c75b5555e..aeade577a 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-@@ -169,6 +169,8 @@ uint64_t CPUContext::InstructionPointer() const {
- return arm->pc;
- case kCPUArchitectureARM64:
- return arm64->pc;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->nip;
- default:
- NOTREACHED();
- return ~0ull;
-@@ -185,6 +187,8 @@ uint64_t CPUContext::StackPointer() const {
- return arm->sp;
- case kCPUArchitectureARM64:
- return arm64->sp;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->regs[1];
- default:
- NOTREACHED();
- return ~0ull;
-@@ -196,6 +200,7 @@ bool CPUContext::Is64Bit() const {
- case kCPUArchitectureX86_64:
- case kCPUArchitectureARM64:
- case kCPUArchitectureMIPS64EL:
-+ case kCPUArchitecturePPC64:
- return true;
- case kCPUArchitectureX86:
- case kCPUArchitectureARM:
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.h b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-index fb23c4679..eebede63c 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-@@ -352,6 +352,24 @@ struct CPUContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief A context structure carrying PPC64 CPU state.
-+struct CPUContextPPC64 {
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+ double fpregs[32];
-+ double fpscr;
-+ struct {
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+ uint32_t save_vrsave;
-+ } vregs;
-+};
-+
- //! \brief A context structure capable of carrying the context of any supported
- //! CPU architecture.
- struct CPUContext {
-@@ -382,6 +400,7 @@ struct CPUContext {
- CPUContextARM64* arm64;
- CPUContextMIPS* mipsel;
- CPUContextMIPS64* mips64;
-+ CPUContextPPC64* ppc64;
- };
- };
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-index 9f46a4897..aa677c4eb 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
- #define CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
-
-+#include <cstring>
- #include "build/build_config.h"
- #include "snapshot/cpu_context.h"
- #include "snapshot/linux/signal_context.h"
-@@ -174,6 +175,78 @@ void InitializeCPUContextMIPS(
-
- #endif // ARCH_CPU_MIPS_FAMILY || DOXYGEN
-
-+#if defined(ARCH_CPU_PPC64_FAMILY) || DOXYGEN
-+
-+//! \brief Initalizes a CPUContextPPC64 structure from native context
-+//! structures on Linux.
-+//!
-+//! \param[in] thread_context The native thread context.
-+//! \param[in] float_context The native float context.
-+//! \param[in] vector_context The native vector context.
-+//! \param[out] context The CPUContextPPC64 structure to initalize.
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const ThreadContext::t64_t& thread_context,
-+ const FloatContext::f64_t& float_context,
-+ const VectorContext::v64_t& vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.gpr, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.fpregs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const SignalThreadContext64 &thread_context,
-+ const SignalFloatContext64 &float_context,
-+ const SignalVectorContext64 &vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.regs, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.regs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+
-+#endif
-+
- } // namespace internal
- } // namespace crashpad
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-index d32bd1937..2dd538c2b 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-@@ -192,6 +192,8 @@ void TestAgainstTarget(PtraceConnection* connection) {
- device == 0 && inode == 0 && mapping_name == "[vdso]";
- #if defined(ARCH_CPU_X86)
- static constexpr char kPrefix[] = "linux-gate.so.";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kPrefix[] = "linux-vdso64.so.";
- #else
- static constexpr char kPrefix[] = "linux-vdso.so.";
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-index cd40b3b12..6bcf23b6f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-@@ -323,6 +323,69 @@ bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
- reader, context_address, context_.mips64);
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+template <typename Traits>
-+static bool ReadContext(ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address,
-+ typename Traits::CPUContext* dest_context) {
-+ const ProcessMemory* memory = reader->Memory();
-+
-+ LinuxVMAddress gp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, gp_regs);
-+
-+ typename Traits::SignalThreadContext thread_context;
-+ if (!memory->Read(gp_regs_address, sizeof(thread_context), &thread_context)) {
-+ LOG(ERROR) << "Couldn't read gp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress fp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, fp_regs);
-+
-+ typename Traits::SignalFloatContext fp_context;
-+ if (!memory->Read(fp_regs_address, sizeof(fp_context), &fp_context)) {
-+ LOG(ERROR) << "Couldn't read fp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress v_regs_ptr_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, vmx_reserve) + 8;
-+
-+ typename Traits::SignalVectorContext v_context;
-+ if (!memory->Read(v_regs_ptr_address, sizeof(v_context), &v_context)) {
-+ LOG(ERROR) << "Couldn't read v_regs!";
-+ return false;
-+ }
-+
-+ InitializeCPUContextPPC64<ContextTraits64>(thread_context, fp_context,
-+ v_context, dest_context);
-+
-+ return true;
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+
-+ return internal::ReadContext<ContextTraits64>(
-+ reader, context_address, context_.ppc64);
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits32>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ // PPC64 is 64-bit
-+ return false;
-+}
-+
- #endif // ARCH_CPU_X86_FAMILY
-
- bool ExceptionSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-index ea0cd2106..e42df520f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-@@ -84,6 +84,8 @@ class ExceptionSnapshotLinux final : public ExceptionSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #endif
- } context_union_;
- CPUContext context_;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-index c17170b43..b6a714cc6 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-@@ -296,7 +296,28 @@ void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
- 0);
- #undef CPU_ARCH_NAME
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+using NativeCPUContext = ucontext_t;
-+
-+void InitializeContext(NativeCPUContext* context) {
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ context->uc_mcontext.gp_regs[reg] = reg;
-+ }
-+
-+ memset(&context->uc_mcontext.fp_regs, 44,
-+ sizeof(context->uc_mcontext.fp_regs));
-+}
-
-+void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
-+ EXPECT_EQ(actual.architecture, kCPUArchitecturePPC64);
-+
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ EXPECT_EQ(actual.ppc64->regs[reg], expected.uc_mcontext.gp_regs[reg]);
-+ }
-+
-+ EXPECT_EQ(memcmp(actual.ppc64->fpregs, expected.uc_mcontext.fp_regs,
-+ sizeof(actual.ppc64->fpregs)), 0);
-+}
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-index ee246e8bc..9555dce04 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-@@ -108,6 +108,8 @@ void ProcessReaderLinux::Thread::InitializeStack(ProcessReaderLinux* reader) {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- stack_pointer = reader->Is64Bit() ? thread_info.thread_context.t64.regs[29]
- : thread_info.thread_context.t32.regs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ stack_pointer = thread_info.thread_context.t64.gpr[1];
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 110024680..a1f2da259 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -422,6 +422,89 @@ static_assert(offsetof(UContext<ContextTraits64>, mcontext.fpregs) ==
- "context offset mismatch");
- #endif
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+struct SignalThreadContext64 {
-+ uint64_t regs[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_r3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
-+ uint64_t dscr;
-+ uint64_t fpr0[3];
-+};
-+
-+struct SignalFloatContext64 {
-+ double regs[32];
-+ double fpscr;
-+};
-+
-+struct SignalVectorContext64 {
-+ int32_t vrregs[32][4];
-+ struct {
-+ int32_t __pad[3];
-+ int32_t vscr_word;
-+ } vscr;
-+ int32_t vrsave;
-+ int32_t __pad[3];
-+} __attribute__((__aligned__(16)));
-+
-+
-+#pragma pack(pop)
-+struct MContext64 {
-+ uint64_t reserved[4];
-+ int32_t signal;
-+ int32_t __pad0;
-+ uint64_t handler;
-+ uint64_t oldmask;
-+ uint64_t pt_regs_ptr;
-+ SignalThreadContext64 gp_regs;
-+ SignalFloatContext64 fp_regs;
-+ SignalVectorContext64 *v_regs;
-+ int64_t vmx_reserve[69];
-+};
-+
-+struct ContextTraits64 : public Traits64 {
-+ using MContext = MContext64;
-+ using SignalThreadContext = SignalThreadContext64;
-+ using SignalFloatContext = SignalFloatContext64;
-+ using SignalVectorContext = SignalVectorContext64;
-+ using CPUContext = CPUContextPPC64;
-+};
-+
-+struct ContextTraits32 : public Traits32 {};
-+
-+struct UContext {
-+ uint64_t flags;
-+ uint64_t link;
-+ SignalStack<ContextTraits64> stack;
-+ Sigset<ContextTraits64> sigmask;
-+ MContext64 mcontext;
-+};
-+#pragma pack(push, 1)
-+
-+static_assert(sizeof(UContext) == sizeof(ucontext_t),
-+ "ucontext_t size mismatch");
-+static_assert(sizeof(MContext64) == sizeof(mcontext_t),
-+ "mcontext_t size mismatch");
-+static_assert(sizeof(SignalThreadContext64) == sizeof(gregset_t),
-+ "gregset_t size mismatch");
-+static_assert(sizeof(SignalFloatContext64) == sizeof(fpregset_t),
-+ "fpregset_t size mismatch");
-+static_assert(sizeof(SignalVectorContext64) == sizeof(vrregset_t),
-+ "vrregset_t size mismatch");
-+static_assert(offsetof(UContext, mcontext) ==
-+ offsetof(ucontext_t, uc_mcontext), "mcontext offset mismatch");
-+static_assert(offsetof(MContext64, gp_regs) ==
-+ offsetof(mcontext_t, gp_regs), "gp_regs offset mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-index a99da3e4b..03b973083 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-@@ -204,6 +204,8 @@ CPUArchitecture SystemSnapshotLinux::GetCPUArchitecture() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return process_reader_->Is64Bit() ? kCPUArchitectureMIPS64EL
- : kCPUArchitectureMIPSEL;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return kCPUArchitecturePPC64;
- #else
- #error port to your architecture
- #endif
-@@ -219,6 +221,9 @@ uint32_t SystemSnapshotLinux::CPURevision() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return 0;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return 0;
- #else
- #error port to your architecture
- #endif
-@@ -239,6 +244,9 @@ std::string SystemSnapshotLinux::CPUVendor() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return std::string();
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return std::string();
- #else
- #error port to your architecture
- #endif
-@@ -372,6 +380,9 @@ bool SystemSnapshotLinux::NXEnabled() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return false;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return false;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-index b2450c206..7ba78b2ae 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-@@ -110,6 +110,8 @@ bool WriteTestModule(const base::FilePath& module_path,
- module.ehdr.e_machine = EM_AARCH64;
- #elif defined(ARCH_CPU_MIPSEL) || defined(ARCH_CPU_MIPS64EL)
- module.ehdr.e_machine = EM_MIPS;
-+#elif defined(ARCH_CPU_PPC64)
-+ module.ehdr.e_machine = EM_PPC64;
- #endif
-
- module.ehdr.e_version = EV_CURRENT;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-index e3e2bebdd..8ef43752e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-@@ -186,6 +186,14 @@ bool ThreadSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
- thread.thread_info.float_context.f32,
- context_.mipsel);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+ InitializeCPUContextPPC64<ContextTraits64>(
-+ thread.thread_info.thread_context.t64,
-+ thread.thread_info.float_context.f64,
-+ thread.thread_info.vector_context.v64,
-+ context_.ppc64);
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-index 44cc6f6d9..d4136461e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-@@ -68,6 +68,8 @@ class ThreadSnapshotLinux final : public ThreadSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
---- a/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-+++ b/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-@@ -236,6 +236,12 @@
- #elif defined(ARCH_CPU_BIG_ENDIAN)
- static constexpr char arch[] = "aarch64_be";
- #endif
-+#elif defined(__powerpc64__)
-+#if defined(ARCH_CPU_LITTLE_ENDIAN)
-+ static constexpr char arch[] = "ppc64le";
-+#elif defined(ARCH_CPU_BIG_ENDIAN)
-+ static constexpr char arch[] = "ppc64";
-+#endif
- #else
- #error Port
- #endif
-diff --git a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-index d3d5ebdfb..3fd730cb5 100644
---- a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-+++ b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-@@ -56,6 +56,11 @@ bool AuxiliaryVector::Read(PtraceConnection* connection) {
- if (type == AT_IGNORE) {
- continue;
- }
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ if (type == AT_IGNOREPPC) {
-+ continue;
-+ }
-+#endif
- if (!MapInsertOrReplace(&values_, type, value, nullptr)) {
- LOG(ERROR) << "duplicate auxv entry";
- return false;
-diff --git a/third_party/crashpad/crashpad/util/linux/ptracer.cc b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-index 557e0d363..08ae434b8 100644
---- a/third_party/crashpad/crashpad/util/linux/ptracer.cc
-+++ b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-@@ -398,6 +398,64 @@ bool GetThreadArea64(pid_t tid,
- return true;
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+// PPC64 has had HAVE_ARCH_TRACEHOOK set since 2.6.27 (even before x86 had it).
-+// That means we can simply use PTRACE_GETREGESET.
-+
-+template <typename Destination>
-+bool GetRegisterSet(pid_t tid, int set, Destination* dest, bool can_log) {
-+ iovec iov;
-+ iov.iov_base = reinterpret_cast<void*>(dest);
-+ iov.iov_len = sizeof(*dest);
-+ if (ptrace(PTRACE_GETREGSET, tid, reinterpret_cast<void*>(set), &iov) != 0) {
-+ PLOG_IF(ERROR, can_log) << "ptrace";
-+ return false;
-+ }
-+ if (iov.iov_len != sizeof(*dest)) {
-+ LOG_IF(ERROR, can_log) << "Unexpected registers size";
-+ return false;
-+ }
-+ return true;
-+}
-+
-+bool GetVectorRegisters64(pid_t tid,
-+ VectorContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PPC_VMX, &context->v64, can_log);
-+}
-+
-+bool GetFloatingPointRegisters64(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PRFPREG, &context->f64, can_log);
-+}
-+
-+bool GetThreadArea64(pid_t tid,
-+ const ThreadContext& context,
-+ LinuxVMAddress* address,
-+ bool can_log) {
-+ // PPC64 doesn't have PTRACE_GET_THREAD_AREA since the thread pointer
-+ // is stored in GPR 13.
-+ ThreadContext::t64_t tc;
-+ if (!GetRegisterSet(tid, NT_PRSTATUS, &tc, can_log)) {
-+ LOG_IF(ERROR, can_log) << "Unable to get thread pointer!";
-+ return false;
-+ }
-+
-+ *address = tc.gpr[13];
-+
-+ return true;
-+}
-+
-+// Stubs for 32-bit functions not applicable on PPC64
-+bool GetFloatingPointRegisters32(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) { return false; }
-+bool GetThreadArea32(pid_t tid,
-+ const ThreadContext &context,
-+ LinuxVMAddress *address,
-+ bool can_log) { return false; }
-+
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -494,6 +552,9 @@ bool Ptracer::GetThreadInfo(pid_t tid, ThreadInfo* info) {
- if (is_64_bit_) {
- return GetGeneralPurposeRegisters64(tid, &info->thread_context, can_log_) &&
- GetFloatingPointRegisters64(tid, &info->float_context, can_log_) &&
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ GetVectorRegisters64(tid, &info->vector_context, can_log_) &&
-+#endif
- GetThreadArea64(tid,
- info->thread_context,
- &info->thread_specific_data_address,
-diff --git a/third_party/crashpad/crashpad/util/linux/thread_info.h b/third_party/crashpad/crashpad/util/linux/thread_info.h
-index 5b55c24a7..dea0d1f39 100644
---- a/third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ b/third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -28,6 +28,10 @@
- #include <android/api-level.h>
- #endif
-
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+#include <sys/ucontext.h>
-+#endif
-+
- namespace crashpad {
-
- //! \brief The set of general purpose registers for an architecture family.
-@@ -79,6 +83,8 @@ union ThreadContext {
- uint32_t cp0_status;
- uint32_t cp0_cause;
- uint32_t padding1_;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // PPC64 is 64-bit
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -132,6 +138,21 @@ union ThreadContext {
- uint64_t cp0_badvaddr;
- uint64_t cp0_status;
- uint64_t cp0_cause;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects struct pt_regs in asm/ptrace.h.
-+ uint64_t gpr[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_gpr3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -143,6 +164,8 @@ union ThreadContext {
- using NativeThreadContext = user_regs;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate NativeThreadsContext type available for MIPS
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ using NativeThreadContext = struct pt_regs;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY || ARCH_CPU_ARM64
-@@ -218,6 +241,9 @@ union FloatContext {
- } fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Crashpad's PPC support is 64-bit only, so this
-+ // 32bit-only struct is declared as empty.
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -252,6 +278,10 @@ union FloatContext {
- double fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects fpregset_t in sys/ucontext.h
-+ double fpregs[32];
-+ double fpscr;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -280,6 +310,8 @@ union FloatContext {
- static_assert(sizeof(f64) == sizeof(user_fpsimd_struct), "Size mismatch");
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate floating point context native type for available MIPS.
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ static_assert(sizeof(f64) == sizeof(fpregset_t), "Size mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86
-@@ -287,6 +319,26 @@ union FloatContext {
- static_assert(std::is_standard_layout<FloatContext>::value,
- "Not standard layout");
-
-+//! \brief The vector registers used for an architecture family
-+union VectorContext {
-+ struct v32_t {} v32;
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ __attribute__((__aligned__(16))) // Vector context must be doubleword aligned.
-+#endif
-+ struct v64_t {
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects vrregset_t in sys/ucontext.h
-+ uint32_t vrregs[32][4];
-+ struct {
-+ uint32_t __pad[3];
-+ uint32_t vscr_word;
-+ } vscr;
-+ uint32_t vrsave;
-+ uint32_t __pad[3];
-+#endif
-+ } v64;
-+};
-+
- //! \brief A collection of `ptrace`-able information about a thread.
- struct ThreadInfo {
- ThreadInfo();
-@@ -298,6 +350,9 @@ struct ThreadInfo {
- //! \brief The floating point registers for the thread.
- FloatContext float_context;
-
-+ //! \brief (Optional) The vector registers used for the thread.
-+ VectorContext vector_context;
-+
- //! \brief The thread-local storage address for the thread.
- LinuxVMAddress thread_specific_data_address;
- };
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context.h b/third_party/crashpad/crashpad/util/misc/capture_context.h
-index d21a24f19..acc325349 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context.h
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context.h
-@@ -69,6 +69,7 @@ using NativeCPUContext = ucontext_t;
- //! macOS/Linux/Fuchsia | x86_64 | `%%rdi`
- //! Linux | ARM/ARM64 | `r0`/`x0`
- //! Linux | MIPS/MIPS64 | `$a0`
-+//! Linux | PPC64 | `r3`
- //!
- //! Additionally, the value `LR` on ARM/ARM64 will be the return address of
- //! this function.
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-index 52215ee5d..b3e4a3ec7 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-@@ -32,7 +32,7 @@
- .balign 4, 0x0
- .type CAPTURECONTEXT_SYMBOL, %function
- .type CAPTURECONTEXT_SYMBOL2, %function
--#elif defined(__mips__)
-+#elif defined(__mips__) || defined(__powerpc64__)
- .balign 4, 0x0
- #endif
-
-@@ -423,4 +423,214 @@ CAPTURECONTEXT_SYMBOL2:
- jr $ra
-
- .set at
-+#elif defined(__powerpc64__)
-+ // Store r0-r31
-+ std 0, 0xe8(3) // context->uc_mcontext.gp_regs[0]
-+ std 1, 0xf0(3) // context->uc_mcontext.gp_regs[1]
-+ std 2, 0xf8(3) // context->uc_mcontext.gp_regs[2]
-+ // note that r3's original value was lost
-+ std 3, 0x100(3) // context->uc_mcontext.gp_regs[3]
-+ std 4, 0x108(3) // context->uc_mcontext.gp_regs[4]
-+ std 5, 0x110(3) // context->uc_mcontext.gp_regs[5]
-+ std 6, 0x118(3) // context->uc_mcontext.gp_regs[6]
-+ std 7, 0x120(3) // context->uc_mcontext.gp_regs[7]
-+ std 8, 0x128(3) // context->uc_mcontext.gp_regs[8]
-+ std 9, 0x130(3) // context->uc_mcontext.gp_regs[9]
-+ std 10, 0x138(3) // context->uc_mcontext.gp_regs[10]
-+ std 11, 0x140(3) // context->uc_mcontext.gp_regs[11]
-+ std 12, 0x148(3) // context->uc_mcontext.gp_regs[12]
-+ std 13, 0x150(3) // context->uc_mcontext.gp_regs[13]
-+ std 14, 0x158(3) // context->uc_mcontext.gp_regs[14]
-+ std 15, 0x160(3) // context->uc_mcontext.gp_regs[15]
-+ std 16, 0x168(3) // context->uc_mcontext.gp_regs[16]
-+ std 17, 0x170(3) // context->uc_mcontext.gp_regs[17]
-+ std 18, 0x178(3) // context->uc_mcontext.gp_regs[18]
-+ std 19, 0x180(3) // context->uc_mcontext.gp_regs[19]
-+ std 20, 0x188(3) // context->uc_mcontext.gp_regs[20]
-+ std 21, 0x190(3) // context->uc_mcontext.gp_regs[21]
-+ std 22, 0x198(3) // context->uc_mcontext.gp_regs[22]
-+ std 23, 0x1a0(3) // context->uc_mcontext.gp_regs[23]
-+ std 24, 0x1a8(3) // context->uc_mcontext.gp_regs[24]
-+ std 25, 0x1b0(3) // context->uc_mcontext.gp_regs[25]
-+ std 26, 0x1b8(3) // context->uc_mcontext.gp_regs[26]
-+ std 27, 0x1c0(3) // context->uc_mcontext.gp_regs[27]
-+ std 28, 0x1c8(3) // context->uc_mcontext.gp_regs[28]
-+ std 29, 0x1d0(3) // context->uc_mcontext.gp_regs[29]
-+ std 30, 0x1d8(3) // context->uc_mcontext.gp_regs[30]
-+ std 31, 0x1e0(3) // context->uc_mcontext.gp_regs[31]
-+
-+ // For NIP, we can use the value in the link register
-+ mflr 0
-+ std 0, 0x1e8(3) // context->uc_mcontext.gp_regs[PT_NIP]
-+
-+ // CTR
-+ mfctr 0
-+ std 0, 0x200(3) // context->uc_mcontext.gp_regs[PT_CTR]
-+
-+ // For LNK, we'll use the caller's LR save area (2 stack frames up).
-+ // r4 can be used as a scratch register since it has already been saved.
-+ ld 4, 0(1)
-+ ld 4, 16(4)
-+ std 4, 0x208(3) // context->uc_mcontext.gp_regs[PT_LNK]
-+
-+ // XER
-+ mfxer 0
-+ std 0, 0x210(3) // context->uc_mcontext.gp_regs[PT_XER]
-+
-+ // CCR
-+ mfcr 0
-+ std 0, 0x218(3) // context->uc_mcontext.gp_regs[PT_CCR]
-+
-+ // MSR, orig_r3, MQ, TRAP, DAR, DSISR, RESULT, DSCR,
-+ // not used or not relevant, zero them out.
-+ li 4, 0
-+ std 4, 0x1f0(3) // context->uc_mcontext.gp_regs[PT_MSR]
-+ std 4, 0x1f8(3) // context->uc_mcontext.gp_regs[PT_ORIG_R3]
-+ std 4, 0x220(3) // context->uc_mcontext.gp_regs[PT_MQ]
-+ std 4, 0x228(3) // context->uc_mcontext.gp_regs[PT_TRAP]
-+ std 4, 0x230(3) // context->uc_mcontext.gp_regs[PT_DAR]
-+ std 4, 0x238(3) // context->uc_mcontext.gp_regs[PT_DSISR]
-+ std 4, 0x240(3) // context->uc_mcontext.gp_regs[PT_RESULT]
-+ std 4, 0x248(3) // context->uc_mcontext.gp_regs[PT_DSCR]
-+
-+ // Update context->uc_mcontext.regs to point to gp_regs
-+ addi 0, 3, 0xe8
-+ std 0, 0xe0(3)
-+
-+ // Save floating point registers 0-31
-+ stfd 0, 0x268(3) // context->uc_mcontext.fp_regs[0]
-+ stfd 1, 0x270(3) // context->uc_mcontext.fp_regs[1]
-+ stfd 2, 0x278(3) // context->uc_mcontext.fp_regs[2]
-+ stfd 3, 0x280(3) // context->uc_mcontext.fp_regs[3]
-+ stfd 4, 0x288(3) // context->uc_mcontext.fp_regs[4]
-+ stfd 5, 0x290(3) // context->uc_mcontext.fp_regs[5]
-+ stfd 6, 0x298(3) // context->uc_mcontext.fp_regs[6]
-+ stfd 7, 0x2a0(3) // context->uc_mcontext.fp_regs[7]
-+ stfd 8, 0x2a8(3) // context->uc_mcontext.fp_regs[8]
-+ stfd 9, 0x2b0(3) // context->uc_mcontext.fp_regs[9]
-+ stfd 10, 0x2b8(3) // context->uc_mcontext.fp_regs[10]
-+ stfd 11, 0x2c0(3) // context->uc_mcontext.fp_regs[11]
-+ stfd 12, 0x2c8(3) // context->uc_mcontext.fp_regs[12]
-+ stfd 13, 0x2d0(3) // context->uc_mcontext.fp_regs[13]
-+ stfd 14, 0x2d8(3) // context->uc_mcontext.fp_regs[14]
-+ stfd 15, 0x2e0(3) // context->uc_mcontext.fp_regs[15]
-+ stfd 16, 0x2e8(3) // context->uc_mcontext.fp_regs[16]
-+ stfd 17, 0x2f0(3) // context->uc_mcontext.fp_regs[17]
-+ stfd 18, 0x2f8(3) // context->uc_mcontext.fp_regs[18]
-+ stfd 19, 0x300(3) // context->uc_mcontext.fp_regs[19]
-+ stfd 20, 0x308(3) // context->uc_mcontext.fp_regs[20]
-+ stfd 21, 0x310(3) // context->uc_mcontext.fp_regs[21]
-+ stfd 22, 0x318(3) // context->uc_mcontext.fp_regs[22]
-+ stfd 23, 0x320(3) // context->uc_mcontext.fp_regs[23]
-+ stfd 24, 0x328(3) // context->uc_mcontext.fp_regs[24]
-+ stfd 25, 0x330(3) // context->uc_mcontext.fp_regs[25]
-+ stfd 26, 0x338(3) // context->uc_mcontext.fp_regs[26]
-+ stfd 27, 0x340(3) // context->uc_mcontext.fp_regs[27]
-+ stfd 28, 0x348(3) // context->uc_mcontext.fp_regs[28]
-+ stfd 29, 0x350(3) // context->uc_mcontext.fp_regs[29]
-+ stfd 30, 0x358(3) // context->uc_mcontext.fp_regs[30]
-+ stfd 31, 0x360(3) // context->uc_mcontext.fp_regs[31]
-+
-+ // FPSCR
-+ mffs 0
-+ stfd 0, 0x368(3) // context->uc_mcontext.fp_regs[32]
-+
-+ // Save VMX Vector registers
-+ // Update r4 to contain the base address of vmx_reserve
-+ addi 4, 3, 0x378
-+ // Ensure that it is quadword aligned
-+ andi. 5, 4, 0xF
-+ beq 1f // No alignment is necessary
-+ // Address is doubleword aligned and not quadword aligned, add 8
-+ addi 4, 4, 8
-+
-+1:
-+ // Store VMX registers 0-31
-+ // r4 will contain the base address
-+ // r5 will contain the index
-+ li 5, 0
-+ stvx 0, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 0]
-+ addi 5, 5, 16
-+ stvx 1, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 1]
-+ addi 5, 5, 16
-+ stvx 2, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 2]
-+ addi 5, 5, 16
-+ stvx 3, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 3]
-+ addi 5, 5, 16
-+ stvx 4, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 4]
-+ addi 5, 5, 16
-+ stvx 5, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 5]
-+ addi 5, 5, 16
-+ stvx 6, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 6]
-+ addi 5, 5, 16
-+ stvx 7, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 7]
-+ addi 5, 5, 16
-+ stvx 8, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 8]
-+ addi 5, 5, 16
-+ stvx 9, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 9]
-+ addi 5, 5, 16
-+ stvx 10, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 10]
-+ addi 5, 5, 16
-+ stvx 11, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 11]
-+ addi 5, 5, 16
-+ stvx 12, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 12]
-+ addi 5, 5, 16
-+ stvx 13, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 13]
-+ addi 5, 5, 16
-+ stvx 14, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 14]
-+ addi 5, 5, 16
-+ stvx 15, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 15]
-+ addi 5, 5, 16
-+ stvx 16, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 16]
-+ addi 5, 5, 16
-+ stvx 17, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 17]
-+ addi 5, 5, 16
-+ stvx 18, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 18]
-+ addi 5, 5, 16
-+ stvx 19, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 19]
-+ addi 5, 5, 16
-+ stvx 20, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 20]
-+ addi 5, 5, 16
-+ stvx 21, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 21]
-+ addi 5, 5, 16
-+ stvx 22, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 22]
-+ addi 5, 5, 16
-+ stvx 23, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 23]
-+ addi 5, 5, 16
-+ stvx 24, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 24]
-+ addi 5, 5, 16
-+ stvx 25, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 25]
-+ addi 5, 5, 16
-+ stvx 26, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 26]
-+ addi 5, 5, 16
-+ stvx 27, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 27]
-+ addi 5, 5, 16
-+ stvx 28, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 28]
-+ addi 5, 5, 16
-+ stvx 29, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 29]
-+ addi 5, 5, 16
-+ stvx 30, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 30]
-+ addi 5, 5, 16
-+ stvx 31, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 31]
-+ addi 5, 5, 16
-+
-+ // VSCR
-+ mfvscr 0
-+ stvx 0, 4, 5
-+ addi 5, 5, 16
-+
-+ // VRSAVE
-+ mfvrsave 0
-+ stwx 0, 4, 5
-+
-+ // Update context->uc_mcontext.v_regs to point to vmx_reserve + alignment.
-+ std 4, 0x370(3)
-+
-+ // Zero out all unused fields
-+ li 4, 0
-+ std 4, 0xc8(3) // context->uc_mcontext.signal
-+ std 4, 0xd0(3) // context->uc_mcontext.handler
-+ std 4, 0xd8(3) // context->uc_mcontext.oldmask
-+
-+ blr
- #endif // __i386__
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-index cf23c2def..5f264bc92 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-@@ -57,7 +57,7 @@ void TestCaptureContext() {
- uintptr_t pc = ProgramCounterFromContext(context_1);
-
- #if !defined(ADDRESS_SANITIZER) && !defined(ARCH_CPU_MIPS_FAMILY) && \
-- !defined(MEMORY_SANITIZER)
-+ !defined(MEMORY_SANITIZER) && !defined(ARCH_CPU_PPC64_FAMILY)
- // Sanitizers can cause enough code bloat that the “nearby” check would
- // likely fail.
- const uintptr_t kReferencePC =
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-index 30a2ab21d..60509f21d 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-@@ -35,6 +35,8 @@ void SanityCheckContext(const NativeCPUContext& context) {
- EXPECT_EQ(context.uc_mcontext.regs[0], FromPointerCast<uintptr_t>(&context));
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- EXPECT_EQ(context.uc_mcontext.gregs[4], FromPointerCast<uintptr_t>(&context));
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ EXPECT_EQ(context.uc_mcontext.gp_regs[3], FromPointerCast<uintptr_t>(&context));
- #endif
- }
-
-@@ -49,6 +51,8 @@ uintptr_t ProgramCounterFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.pc;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.pc;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[PT_NIP];
- #endif
- }
-
-@@ -63,6 +67,8 @@ uintptr_t StackPointerFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.sp;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.gregs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[1];
- #endif
- }
-
-diff --git a/third_party/dav1d/config/linux/ppc64/config.h b/third_party/dav1d/config/linux/ppc64/config.h
-new file mode 100644
-index 000000000..9fbbf75cc
---- /dev/null
-+++ b/third_party/dav1d/config/linux/ppc64/config.h
-@@ -0,0 +1,39 @@
-+/*
-+ * Autogenerated by the Meson build system.
-+ * Do not edit, your changes will be lost.
-+ */
-+
-+#pragma once
-+
-+#define ARCH_AARCH64 0
-+
-+#define ARCH_ARM 0
-+
-+#define ARCH_PPC64LE 1
-+
-+#define ARCH_X86 0
-+
-+#define ARCH_X86_32 0
-+
-+#define ARCH_X86_64 0
-+
-+#define CONFIG_16BPC 1
-+
-+#define CONFIG_8BPC 1
-+
-+// #define CONFIG_LOG 1 -- Logging is controlled by Chromium
-+
-+#define ENDIANNESS_BIG 0
-+
-+#define HAVE_ASM 1
-+
-+#define HAVE_CLOCK_GETTIME 1
-+
-+#define HAVE_DLSYM 1
-+
-+#define HAVE_GETAUXVAL 1
-+
-+#define HAVE_POSIX_MEMALIGN 1
-+
-+#define HAVE_UNISTD_H 1
-+
-diff --git a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-index 0b4bd72f0..a0caa5e71 100644
---- a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-+++ b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-@@ -51,4 +51,19 @@
- #define u16l_to_i32(v) ((i32x4) vec_mergel((u16x8) v, vec_splat_u16(0)))
- #define i16l_to_i32(v) ((i32x4) vec_unpackl((i16x8)v))
-
-+#if defined(__clang__)
-+#undef vec_splats
-+#define vec_splats(N) \
-+ _Generic((N), \
-+ unsigned char: ((u8x16)(N)), \
-+ signed char: ((i8x16)(N)), \
-+ unsigned short: ((u16x8)(N)), \
-+ signed short: ((i16x8)(N)), \
-+ unsigned int: ((u32x4)(N)), \
-+ signed int: ((i32x4)(N)), \
-+ unsigned long long: ((u64x2)(N)), \
-+ signed long long: ((i64x2)(N)) \
-+ )
-+#endif
-+
- #endif /* DAV1D_SRC_PPC_TYPES_H */
-diff --git a/third_party/eigen3/BUILD.gn b/third_party/eigen3/BUILD.gn
-index 0d4e184..f2ce484 100644
---- a/third_party/eigen3/BUILD.gn
-+++ b/third_party/eigen3/BUILD.gn
-@@ -22,4 +22,8 @@ config("eigen_includes") {
- # for this component on Windows on Arm due to compilation errors.
- defines += [ "EIGEN_DONT_VECTORIZE" ]
- }
-+
-+ if (target_cpu == "ppc64") {
-+ defines += [ "EIGEN_DONT_VECTORIZE" ]
-+ }
- }
-
-diff --git a/third_party/libaom/BUILD.gn b/third_party/libaom/BUILD.gn
-index 9b065bd..df3af02 100644
---- a/third_party/libaom/BUILD.gn
-+++ b/third_party/libaom/BUILD.gn
-@@ -40,6 +40,8 @@
- cpu_arch_full = "generic"
- } else if (current_cpu == "loong64") {
- cpu_arch_full = "generic"
-+} else if (current_cpu == "ppc64") {
-+ cpu_arch_full = "generic"
- } else {
- cpu_arch_full = current_cpu
- }
-diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h
-index e4ac22644..1c57015db 100644
---- a/third_party/lss/linux_syscall_support.h
-+++ b/third_party/lss/linux_syscall_support.h
-@@ -3947,7 +3947,7 @@ struct kernel_statfs {
- LSS_REG(2, buf);
- LSS_BODY(void*, mmap2, "0"(__r2));
- }
--#else
-+#elif !defined(__powerpc64__) /* ppc64 doesn't have mmap2 */
- #define __NR__mmap2 __NR_mmap2
- LSS_INLINE _syscall6(void*, _mmap2, void*, s,
- size_t, l, int, p,
-@@ -4058,7 +4058,7 @@ struct kernel_statfs {
- #if defined(__i386__) || \
- defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \
- (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \
-- defined(__PPC__) || \
-+ (defined(__PPC__) && !defined(__powerpc64__)) || \
- (defined(__s390__) && !defined(__s390x__))
- /* On these architectures, implement mmap() with mmap2(). */
- LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d,
-@@ -4872,11 +4872,11 @@ struct kernel_statx {
- LSS_SC_BODY(4, int, 8, d, type, protocol, sv);
- }
- #endif
-- #if defined(__NR_recvmsg)
-+ #if defined(__NR_recvmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, recvmsg, int, s, struct kernel_msghdr*, msg,
- int, flags)
- #endif
-- #if defined(__NR_sendmsg)
-+ #if defined(__NR_sendmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, sendmsg, int, s, const struct kernel_msghdr*,
- msg, int, flags)
- #endif
-@@ -4885,13 +4885,13 @@ struct kernel_statx {
- int, flags, const struct kernel_sockaddr*, to,
- unsigned int, tolen)
- #endif
-- #if defined(__NR_shutdown)
-+ #if defined(__NR_shutdown) && !defined(__PPC__)
- LSS_INLINE _syscall2(int, shutdown, int, s, int, how)
- #endif
-- #if defined(__NR_socket)
-+ #if defined(__NR_socket) && !defined(__PPC__)
- LSS_INLINE _syscall3(int, socket, int, domain, int, type, int, protocol)
- #endif
-- #if defined(__NR_socketpair)
-+ #if defined(__NR_socketpair) && !defined(__PPC__)
- LSS_INLINE _syscall4(int, socketpair, int, d, int, type, int, protocol,
- int*, sv)
- #endif
-diff --git a/third_party/pdfium/third_party/libpng16/pngpriv.h b/third_party/pdfium/third_party/libpng16/pngpriv.h
-index 583c26f..e03d697 100644
---- a/third_party/pdfium/third_party/libpng16/pngpriv.h
-+++ b/third_party/pdfium/third_party/libpng16/pngpriv.h
-@@ -196,11 +196,7 @@
- #endif
-
- #ifndef PNG_POWERPC_VSX_OPT
--# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
--# define PNG_POWERPC_VSX_OPT 2
--# else
--# define PNG_POWERPC_VSX_OPT 0
--# endif
-+# define PNG_POWERPC_VSX_OPT 0
- #endif
-
- #ifndef PNG_INTEL_SSE_OPT
-diff --git a/third_party/pffft/src/pffft.c b/third_party/pffft/src/pffft.c
-index bdac4d784..51e0f2cac 100644
---- a/third_party/pffft/src/pffft.c
-+++ b/third_party/pffft/src/pffft.c
-@@ -100,6 +100,7 @@
- Altivec support macros
- */
- #if !defined(PFFFT_SIMD_DISABLE) && (defined(__ppc__) || defined(__ppc64__))
-+#include <altivec.h>
- typedef vector float v4sf;
- # define SIMD_SZ 4
- # define VZERO() ((vector float) vec_splat_u8(0))
-diff --git a/third_party/sqlite/src/amalgamation/sqlite3.c b/third_party/sqlite/src/amalgamation/sqlite3.c
-index 6b4a7899d..b8c7fe414 100644
---- a/third_party/sqlite/src/amalgamation/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation/sqlite3.c
-@@ -14474,7 +14474,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/amalgamation_dev/sqlite3.c b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-index d30c9b7de..cf75a69d9 100644
---- a/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-@@ -14487,7 +14487,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/ext/rtree/rtree.c b/third_party/sqlite/src/ext/rtree/rtree.c
-index f5b57a5e2..80a2d0ad8 100644
---- a/third_party/sqlite/src/ext/rtree/rtree.c
-+++ b/third_party/sqlite/src/ext/rtree/rtree.c
-@@ -450,7 +450,7 @@ struct RtreeMatchArg {
- #if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__arm__)
-+ defined(__arm__) || defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- #elif defined(sparc) || defined(__ppc__)
- # define SQLITE_BYTEORDER 4321
-diff --git a/third_party/sqlite/src/src/sqliteInt.h b/third_party/sqlite/src/src/sqliteInt.h
-index 245070d4f..b25164e95 100644
---- a/third_party/sqlite/src/src/sqliteInt.h
-+++ b/third_party/sqlite/src/src/sqliteInt.h
-@@ -877,7 +877,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/webrtc/rtc_base/system/arch.h b/third_party/webrtc/rtc_base/system/arch.h
-index be2367b85..be4ee4233 100644
---- a/third_party/webrtc/rtc_base/system/arch.h
-+++ b/third_party/webrtc/rtc_base/system/arch.h
-@@ -79,6 +79,18 @@
- #elif defined(__EMSCRIPTEN__)
- #define WEBRTC_ARCH_32_BITS
- #define WEBRTC_ARCH_LITTLE_ENDIAN
-+#elif defined(__PPC__)
-+#define WEBRTC_ARCH_PPC_FAMILY
-+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-+#define WEBRTC_ARCH_LITTLE_ENDIAN
-+#else
-+#define WEBRTC_ARCH_BIG_ENDIAN
-+#endif
-+#if defined(__LP64__)
-+#define WEBRTC_ARCH_64_BITS
-+#else
-+#define WEBRTC_ARCH_32_BITS
-+#endif
- #else
- #error Please add support for your architecture in rtc_base/system/arch.h
- #endif
-diff --git a/v8/BUILD.gn b/v8/BUILD.gn
-index f39529a3a..e84fc449e 100644
---- a/v8/BUILD.gn
-+++ b/v8/BUILD.gn
-@@ -850,6 +850,12 @@ config("toolchain") {
- }
- if (host_byteorder == "little") {
- defines += [ "V8_TARGET_ARCH_PPC_LE" ]
-+ cflags += [
-+ # Enable usage of AltiVec, VSX, and other POWER8 and higher features
-+ "-mcpu=power8",
-+ "-maltivec",
-+ "-mvsx",
-+ ]
- } else if (host_byteorder == "big") {
- defines += [ "V8_TARGET_ARCH_PPC_BE" ]
- if (current_os == "aix") {
---- a/ui/gl/features.gni
-+++ b/ui/gl/features.gni
-@@ -33,5 +33,5 @@
- is_chromeos_ash || is_fuchsia) &&
- (target_cpu == "x86" || target_cpu == "x64" || target_cpu == "arm" ||
- target_cpu == "arm64" || target_cpu == "mipsel" ||
-- target_cpu == "mips64el" || target_cpu == "riscv64")
-+ target_cpu == "mips64el" || target_cpu == "riscv64" || target_cpu == "ppc64")
- }
-diff --git a/v8/test/BUILD.gn b/v8/test/BUILD.gn
-index fb872ad39..45fc585dd 100644
---- a/v8/test/BUILD.gn
-+++ b/v8/test/BUILD.gn
-@@ -42,7 +42,7 @@ group("gn_all") {
- "benchmarks/cpp:gn_all",
- "cctest:cctest",
- "unittests:generate-bytecode-expectations",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
- }
- }
-@@ -84,7 +84,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- "webkit:v8_webkit",
- ]
-
-@@ -109,7 +109,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
-
- if (v8_enable_webassembly) {
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch b/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
deleted file mode 100644
index df453f491d8c..000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-+++ b/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-@@ -574,6 +574,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCAsmInfoCOFF.cpp",
- "llvm/lib/MC/MCAsmInfoDarwin.cpp",
- "llvm/lib/MC/MCAsmInfoELF.cpp",
-+ "llvm/lib/MC/MCAsmInfoXCOFF.cpp",
- "llvm/lib/MC/MCAsmMacro.cpp",
- "llvm/lib/MC/MCAsmStreamer.cpp",
- "llvm/lib/MC/MCAssembler.cpp",
-@@ -629,6 +630,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCWinCOFFStreamer.cpp",
- "llvm/lib/MC/MCWinEH.cpp",
- "llvm/lib/MC/MCXCOFFStreamer.cpp",
-+ "llvm/lib/MC/MCXCOFFObjectTargetWriter.cpp",
- "llvm/lib/MC/MachObjectWriter.cpp",
- "llvm/lib/MC/StringTableBuilder.cpp",
- "llvm/lib/MC/SubtargetFeature.cpp",
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 7dea8bbe50d3..4a7faab9eebd 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -1,9 +1,9 @@
# Template file for 'chromium'
pkgname=chromium
# See https://chromiumdash.appspot.com/releases?platform=Linux for the latest version
-version=108.0.5359.124
+version=109.0.5414.74
revision=1
-archs="i686* x86_64* aarch64* armv7l* ppc64le*"
+archs="i686* x86_64* aarch64* armv7l*"
hostmakedepends="
$(vopt_if clang "clang lld llvm12")
$(vopt_if js_optimize openjdk)
@@ -28,7 +28,7 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://www.chromium.org/"
distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz"
-checksum=d48dfac2a61b14a5d7d2f460b09b70ef3ab88e27b82e3173938cb54eaa612a75
+checksum=eded233c26ab631be325ad49cb306c338513b6a6528197d42653e66187548e5d
lib32disabled=yes
@@ -39,10 +39,9 @@ desc_option_debug="Build with debug symbols"
desc_option_js_optimize="Optimize the JS used for Chromium's UI"
desc_option_pipewire="Enable support for screen sharing for WebRTC via PipeWire"
-
-case "$XBPS_TARGET_MACHINE" in
- ppc64*-musl) makedepends+=" libucontext-devel" ;;
-esac
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+ makedepends+=" musl-legacy-compat"
+fi
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" libX11-devel libxcb-devel pciutils-devel libXext-devel libglvnd-devel
@@ -65,10 +64,6 @@ if [ "$CROSS_BUILD" ]; then
esac
fi
-case "${XBPS_TARGET_MACHINE}" in
- i686*) broken="https://build.voidlinux.org/builders/i686_builder/builds/40258/steps/shell_3/logs/stdio" ;;
-esac
-
post_patch() {
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
for f in "${FILESDIR}"/musl-patches/*.patch; do
@@ -135,20 +130,6 @@ do_configure() {
CFLAGS=$CFLAGS_FOR_BUILD CXXFLAGS=$CXXFLAGS_FOR_BUILD LDFLAGS=$LDFLAGS_FOR_BUILD \
tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles
- # we need to generate ppc64 stuff for libvpx as it's not shipped
- # this has to be done before unbundling, but after gn is built
- # comment out if we switch back to system libvpx again later
- case "$XBPS_TARGET_MACHINE" in
- ppc64*)
- pushd third_party/libvpx
- mkdir -p source/config/linux/ppc64
- # need PATH to find gn
- PATH="${wrksrc}/out/Release:$PATH" ./generate_gni.sh || \
- msg_error "failed to generate libvpx gni"
- popd
- ;;
- esac
-
# Use system-provided libraries.
# TODO: use_system_hunspell (upstream changes needed).
# TODO: use_system_libsrtp.
@@ -220,9 +201,6 @@ do_configure() {
'icu_use_data_file=true'
- 'use_allocator="none"'
- 'use_allocator_shim=false'
-
'enable_widevine=true'
'enable_hangout_services_extension=true'
@@ -286,11 +264,6 @@ do_configure() {
)
fi
- # this does not work on ppc64 yet
- case "$XBPS_TARGET_MACHINE" in
- ppc64*) conf+=( "enable_jxl_decoder=false" );;
- esac
-
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
conf+=( 'is_musl=true' )
fi
@@ -300,7 +273,6 @@ do_configure() {
i686*) conf+=( 'target_cpu="x86"' ) ;;
arm*) conf+=( 'target_cpu="arm"' ) ;;
aarch64*) conf+=( 'target_cpu="arm64"' ) ;;
- ppc64*) conf+=( 'target_cpu="ppc64"' ) ;;
esac
if [ "$CROSS_BUILD" ]; then
@@ -309,7 +281,6 @@ do_configure() {
i686*) conf+=( 'host_cpu="x86"' ) ;;
arm*) conf+=( 'host_cpu="arm"' ) ;;
aarch64*) conf+=( 'host_cpu="arm64"' ) ;;
- ppc64*) conf+=( 'host_cpu="ppc64"' ) ;;
esac
fi
_setup_toolchain
@@ -318,13 +289,13 @@ do_configure() {
do_build() {
_setup_toolchain
- CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver chrome_crashpad_handler
+ CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver.unstripped chrome_crashpad_handler
}
do_install() {
vinstall out/Release/chrome 755 usr/lib/${pkgname} ${pkgname}
vinstall out/Release/chrome_crashpad_handler 755 usr/lib/${pkgname} chrome_crashpad_handler
- vinstall out/Release/chromedriver 755 usr/lib/${pkgname} chromedriver
+ vinstall out/Release/chromedriver.unstripped 755 usr/lib/${pkgname} chromedriver
vinstall out/Release/libEGL.so 755 usr/lib/${pkgname} libEGL.so
vinstall out/Release/libGLESv2.so 755 usr/lib/${pkgname} libGLESv2.so
vinstall out/Release/libvk_swiftshader.so 755 usr/lib/${pkgname} libvk_swiftshader.so
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] chromium: update to 109.0.5414.74.
2023-01-11 1:12 [PR PATCH] chromium: update to 109.0.5414.74 Duncaen
` (6 preceding siblings ...)
2023-01-12 20:38 ` Duncaen
@ 2023-01-12 20:44 ` Duncaen
2023-01-12 20:45 ` [PR PATCH] [Merged]: " Duncaen
8 siblings, 0 replies; 10+ messages in thread
From: Duncaen @ 2023-01-12 20:44 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]
There is an updated pull request by Duncaen against master on the void-packages repository
https://github.com/Duncaen/void-packages chromium-109
https://github.com/void-linux/void-packages/pull/41570
chromium: update to 109.0.5414.74.
[ci skip]
* [x] x86_64-glibc
* [x] x86_64-musl
* [ ] aarch64-musl
* [ ] i686
A patch file from https://github.com/void-linux/void-packages/pull/41570.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-chromium-109-41570.patch --]
[-- Type: text/x-diff, Size: 182762 bytes --]
From e2c4bc20762564e5f1602210f44dce1df23de6f0 Mon Sep 17 00:00:00 2001
From: Duncaen <duncaen@voidlinux.org>
Date: Wed, 11 Jan 2023 01:28:40 +0100
Subject: [PATCH] chromium: update to 109.0.5414.74.
---
.../musl-patches/xxx-ppc64le-support.patch | 187 -
.../patches/build-add-use_cxx17.patch | 38 +-
.../patches/fix-build-with-old-clang.patch | 20 +
.../patches/fix-constexpr-narrowing.patch | 21 +
.../patches/fix-musl-no-mallinfo.patch | 11 +
.../patches/fix-musl-pthread-stacksize.patch | 40 -
.../chromium/patches/fix-narrowing-cast.patch | 39 +-
.../patches/fix-nasm-musl-config.patch | 12 -
.../patches/musl-partition-atfork.patch | 11 +
...uild-error-on-linux-with-system-zlib.patch | 41 -
.../patches/remove-strip_binary.patch | 32 -
.../patches/xxx-ppc64le-4k-pages.patch | 60 -
.../chromium/patches/xxx-ppc64le-libvpx.patch | 33 -
.../xxx-ppc64le-sandbox-linux-stat.patch | 31 -
.../patches/xxx-ppc64le-support.patch | 3590 -----------------
.../patches/xxx-ppc64le-swiftshader.patch | 18 -
srcpkgs/chromium/template | 41 +-
17 files changed, 89 insertions(+), 4136 deletions(-)
delete mode 100644 srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
create mode 100644 srcpkgs/chromium/patches/fix-build-with-old-clang.patch
create mode 100644 srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
create mode 100644 srcpkgs/chromium/patches/fix-musl-no-mallinfo.patch
delete mode 100644 srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
delete mode 100644 srcpkgs/chromium/patches/fix-nasm-musl-config.patch
create mode 100644 srcpkgs/chromium/patches/musl-partition-atfork.patch
delete mode 100644 srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
delete mode 100644 srcpkgs/chromium/patches/remove-strip_binary.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-support.patch
delete mode 100644 srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
diff --git a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 555f69c072c8a..0000000000000
--- a/srcpkgs/chromium/files/musl-patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,187 +0,0 @@
-diff --git sandbox/linux/bpf_dsl/seccomp_macros.h sandbox/linux/bpf_dsl/seccomp_macros.h
-index a6aec544e..2a4a7f1bc 100644
---- sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,7 +16,7 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
--#elif defined(__powerpc64__)
-+#elif defined(__powerpc64__) && defined(__GLIBC__)
- // Manually define greg_t on ppc64
- typedef unsigned long long greg_t;
- #endif
-@@ -361,11 +361,11 @@ typedef struct pt_regs regs_struct;
- #define SECCOMP_ARCH AUDIT_ARCH_PPC64
- #endif
-
--#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+#define SECCOMP_REG(_ctx, _reg) (((struct pt_regs *)(_ctx)->uc_mcontext.regs)->gpr[_reg])
-
- #define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
--#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_IP(_ctx) ((struct pt_regs *)(_ctx)->uc_mcontext.regs)->nip
- #define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
- #define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
- #define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-diff --git sandbox/linux/seccomp-bpf/syscall.cc sandbox/linux/seccomp-bpf/syscall.cc
-index d53a7ff56..c290f0e92 100644
---- sandbox/linux/seccomp-bpf/syscall.cc
-+++ sandbox/linux/seccomp-bpf/syscall.cc
-@@ -499,9 +499,9 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // Same as MIPS, need to invert ret and set error register (cr0.SO)
- if (ret_val <= -1 && ret_val >= -4095) {
- ret_val = -ret_val;
-- ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr |= (1 << 28);
- } else {
-- ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ ((struct pt_regs *)ctx->uc_mcontext.regs)->ccr &= ~(1 << 28);
- }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
---- third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-+++ third_party/abseil-cpp/absl/base/internal/unscaledcycleclock_config.h
-@@ -22,6 +22,7 @@
- // The following platforms have an implementation of a hardware counter.
- #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
- defined(__powerpc__) || defined(__ppc__) || defined(__riscv) || \
-+ ((defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC__)) || defined(__riscv) || \
- defined(_M_IX86) || (defined(_M_X64) && !defined(_M_ARM64EC))
- #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1
- #else
---- third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-+++ third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-@@ -64,7 +64,7 @@
- #elif defined(__i386__) || defined(__x86_64__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_x86-inl.inc"
--#elif defined(__ppc__) || defined(__PPC__)
-+#elif (defined(__ppc__) || defined(__PPC__)) && defined(__GLIBC__)
- #define ABSL_STACKTRACE_INL_HEADER \
- "absl/debugging/internal/stacktrace_powerpc-inl.inc"
- #elif defined(__aarch64__)
-diff --git third_party/breakpad/BUILD.gn third_party/breakpad/BUILD.gn
-index f9a60e37..25f3a0b7 100644
---- third_party/breakpad/BUILD.gn
-+++ third_party/breakpad/BUILD.gn
-@@ -637,6 +637,7 @@ if (is_linux || is_android) {
-
- if (current_cpu == "ppc64") {
- defines = [ "HAVE_GETCONTEXT" ]
-+ libs += [ "ucontext" ]
- } else {
- sources += [
- "breakpad/src/common/linux/breakpad_getcontext.S"
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index 03afec7a..0264ecf1 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -273,6 +273,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t ThreadInfo::GetInstructionPointer() const {
- return mcontext.gp_regs[PT_NIP];
- }
-@@ -290,9 +293,9 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->ctr = mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] = \
-diff --git third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 1090470f..e580233d 100644
---- third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -257,6 +257,9 @@ void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) {
-
- #elif defined(__powerpc64__)
-
-+#include <asm/elf.h>
-+#include <asm/ptrace.h>
-+
- uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
- return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
- }
-@@ -280,9 +283,9 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-
- for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-- out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+ out->float_save.fpregs[i] = ((uint64_t *)&uc->uc_mcontext.fp_regs)[i];
-
-- out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+ out->float_save.fpscr = ((uint64_t *)&uc->uc_mcontext.fp_regs)[ELF_NFPREG-1];
-
- for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
- out->vector_save.save_vr[i] =
-diff --git third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index 5a7ab50c..ee8b858c 100644
---- third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -105,6 +105,11 @@
- #define PR_SET_PTRACER 0x59616d61
- #endif
-
-+/* musl hack, can't include asm/ptrace.h as that causes conflicts */
-+#if defined(__powerpc64__) && !defined(PT_NIP)
-+#define PT_NIP 32
-+#endif
-+
- namespace google_breakpad {
-
- namespace {
-diff --git third_party/crashpad/crashpad/snapshot/linux/signal_context.h third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 8e335a09..b2a0f155 100644
---- third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -469,7 +469,7 @@ struct MContext64 {
- SignalThreadContext64 gp_regs;
- SignalFloatContext64 fp_regs;
- SignalVectorContext64 *v_regs;
-- int64_t vmx_reserve[69];
-+ int64_t vmx_reserve[101];
- };
-
- struct ContextTraits64 : public Traits64 {
-diff --git third_party/crashpad/crashpad/util/linux/thread_info.h third_party/crashpad/crashpad/util/linux/thread_info.h
-index dea0d1f3..b203e5b2 100644
---- third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -30,6 +30,7 @@
-
- #if defined(ARCH_CPU_PPC64_FAMILY)
- #include <sys/ucontext.h>
-+#include <asm/ptrace.h>
- #endif
-
- namespace crashpad {
-diff --git third_party/lss/linux_syscall_support.h third_party/lss/linux_syscall_support.h
-index 9955ce44..4c1cc488 100644
---- third_party/lss/linux_syscall_support.h
-+++ third_party/lss/linux_syscall_support.h
-@@ -4216,9 +4216,13 @@ struct kernel_statfs {
- }
- #endif
- #if defined(__NR_fstatat64)
-+ // musl does #define fstatat64 fstatat
-+ #undef fstatat64
- LSS_INLINE _syscall4(int, fstatat64, int, d,
- const char *, p,
- struct kernel_stat64 *, b, int, f)
-+ // set it back like it was
-+ #define fstatat64 fstatat
- #endif
- #if defined(__NR_waitpid)
- // waitpid is polyfilled below when not available.
diff --git a/srcpkgs/chromium/patches/build-add-use_cxx17.patch b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
index 091b1c5537270..b50825fb7e2c4 100644
--- a/srcpkgs/chromium/patches/build-add-use_cxx17.patch
+++ b/srcpkgs/chromium/patches/build-add-use_cxx17.patch
@@ -1,26 +1,22 @@
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
-@@ -167,6 +167,10 @@
- # Enable -H, which prints the include tree during compilation.
- # For use by tools/clang/scripts/analyze_includes.py
- show_includes = false
-+
-+ # Allow projects that wish to stay on C++17 to override Chromium's default.
-+ # TODO(crbug.com/1402249): evaluate removing this end of 2023
-+ use_cxx17 = false
+@@ -191,6 +191,10 @@
+ current_cpu == "x64"))))
}
- declare_args() {
-@@ -596,7 +600,11 @@
- } else if (is_linux) {
- # TODO(crbug.com/1284275): Switch to C++20 on all platforms.
- if (is_clang) {
-- cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ if (use_cxx17) {
-+ cflags_cc += [ "-std=${standard_prefix}++17" ]
-+ } else {
-+ cflags_cc += [ "-std=${standard_prefix}++20" ]
-+ }
++declare_args() {
++ use_cxx17 = false
++}
++
+ if (is_android || (is_chromeos_ash && is_chromeos_device)) {
+ # Set the path to use orderfile for linking Chrome
+ # Note that this is for using only one orderfile for linking
+@@ -605,7 +609,7 @@
+ cflags_cc += [ "-fno-trigraphs" ]
+ }
+ } else if (is_clang) {
+- if (is_chromeos_device) {
++ if (is_chromeos_device || use_cxx17) {
+ # TODO(crbug.com/1392471): Support C++20 in CrOS toolchain.
+ cflags_cc += [ "-std=${standard_prefix}++17" ]
} else {
- # The gcc bots are currently using GCC 9, which is not new enough to
- # support "c++20"/"gnu++20".
diff --git a/srcpkgs/chromium/patches/fix-build-with-old-clang.patch b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
new file mode 100644
index 0000000000000..f23218e71e4d9
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-build-with-old-clang.patch
@@ -0,0 +1,20 @@
+--- a/build/config/compiler/BUILD.gn
++++ b/build/config/compiler/BUILD.gn
+@@ -805,17 +805,6 @@
+ cflags += [ "-fcomplete-member-pointers" ]
+ }
+
+- # Use DWARF simple template names, with the following exceptions:
+- #
+- # * Windows is not supported as it doesn't use DWARF.
+- # * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode
+- # lldb doesn't have the needed changes yet.
+- # * Fuchsia isn't supported as zxdb doesn't support simple template names yet.
+- # TODO(crbug.com/1379070): Remove if the upstream default ever changes.
+- if (is_clang && !is_nacl && !is_win && !is_apple && !is_fuchsia) {
+- cflags_cc += [ "-gsimple-template-names" ]
+- }
+-
+ # MLGO specific flags. These flags enable an ML-based inliner trained on
+ # Chrome on Android (arm32) with ThinLTO enabled, optimizing for size.
+ # The "release" ML model is embedded into clang as part of its build.
diff --git a/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch b/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
new file mode 100644
index 0000000000000..570ca6e69a805
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-constexpr-narrowing.patch
@@ -0,0 +1,21 @@
+--- a/third_party/blink/renderer/platform/media/web_media_player_impl.cc.orig
++++ b/third_party/blink/renderer/platform/media/web_media_player_impl.cc
+@@ -3881,15 +3881,15 @@
+ const T&... values) {
+ std::string strkey = std::string(key);
+
+- if constexpr (Flags & kEncrypted) {
++ if constexpr (Flags & kEncrypted != 0) {
+ if (is_encrypted_)
+ UmaFunction(strkey + ".EME", values...);
+ }
+
+- if constexpr (Flags & kTotal)
++ if constexpr (Flags & kTotal != 0)
+ UmaFunction(strkey + ".All", values...);
+
+- if constexpr (Flags & kPlaybackType) {
++ if constexpr (Flags & kPlaybackType != 0) {
+ auto demuxer_type = GetDemuxerType();
+ if (!demuxer_type.has_value())
+ return;
diff --git a/srcpkgs/chromium/patches/fix-musl-no-mallinfo.patch b/srcpkgs/chromium/patches/fix-musl-no-mallinfo.patch
new file mode 100644
index 0000000000000..1718eccb22047
--- /dev/null
+++ b/srcpkgs/chromium/patches/fix-musl-no-mallinfo.patch
@@ -0,0 +1,11 @@
+--- a/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
++++ b/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
+@@ -717,7 +717,7 @@
+
+ #endif // !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS)
+ SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW {
+ base::SimplePartitionStatsDumper allocator_dumper;
+ Allocator()->DumpStats("malloc", true, &allocator_dumper);
diff --git a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch b/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
deleted file mode 100644
index cd5533190db96..0000000000000
--- a/srcpkgs/chromium/patches/fix-musl-pthread-stacksize.patch
+++ /dev/null
@@ -1,40 +0,0 @@
---- a/base/threading/platform_thread_linux.cc
-+++ b/base/threading/platform_thread_linux.cc
-@@ -436,8 +436,13 @@
-
- size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
- #if !defined(THREAD_SANITIZER)
-+#if defined(__GLIBC__)
- return 0;
- #else
-+ // musl libcs default is too small, use 8mb like glibc
-+ return (1 << 23);
-+#endif
-+#else
- // ThreadSanitizer bloats the stack heavily. Evidence has been that the
- // default stack size isn't enough for some browser tests.
- return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux).
---- a/chrome/browser/shutdown_signal_handlers_posix.cc
-+++ b/chrome/browser/shutdown_signal_handlers_posix.cc
-@@ -188,11 +188,21 @@
- g_shutdown_pipe_read_fd = pipefd[0];
- g_shutdown_pipe_write_fd = pipefd[1];
- #if !defined(ADDRESS_SANITIZER)
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
- #else
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2 * 8;
-+#endif
-+#else
- // ASan instrumentation bloats the stack frames, so we need to increase the
- // stack size to avoid hitting the guard page.
-+#if defined(__GLIBC__)
- const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
-+#else
-+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4 * 8;
-+ // match up musls 2k PTHREAD_STACK_MIN with glibcs 16k
-+#endif
- #endif
- ShutdownDetector* detector = new ShutdownDetector(
- g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);
diff --git a/srcpkgs/chromium/patches/fix-narrowing-cast.patch b/srcpkgs/chromium/patches/fix-narrowing-cast.patch
index afd42a1489ae7..1a247e54fe7cd 100644
--- a/srcpkgs/chromium/patches/fix-narrowing-cast.patch
+++ b/srcpkgs/chromium/patches/fix-narrowing-cast.patch
@@ -1,43 +1,6 @@
---- a/base/files/file_util_linux.cc
-+++ b/base/files/file_util_linux.cc
-@@ -23,14 +23,14 @@
-
- // Not all possible |statfs_buf.f_type| values are in linux/magic.h.
- // Missing values are copied from the statfs man page.
-- switch (statfs_buf.f_type) {
-+ switch (static_cast<uintmax_t>(statfs_buf.f_type)) {
- case 0:
- *type = FILE_SYSTEM_0;
- break;
- case EXT2_SUPER_MAGIC: // Also ext3 and ext4
- case MSDOS_SUPER_MAGIC:
- case REISERFS_SUPER_MAGIC:
-- case static_cast<int>(BTRFS_SUPER_MAGIC):
-+ case BTRFS_SUPER_MAGIC:
- case 0x5346544E: // NTFS
- case 0x58465342: // XFS
- case 0x3153464A: // JFS
-@@ -40,14 +40,14 @@
- *type = FILE_SYSTEM_NFS;
- break;
- case SMB_SUPER_MAGIC:
-- case static_cast<int>(0xFF534D42): // CIFS
-+ case 0xFF534D42: // CIFS
- *type = FILE_SYSTEM_SMB;
- break;
- case CODA_SUPER_MAGIC:
- *type = FILE_SYSTEM_CODA;
- break;
-- case static_cast<int>(HUGETLBFS_MAGIC):
-- case static_cast<int>(RAMFS_MAGIC):
-+ case HUGETLBFS_MAGIC:
-+ case RAMFS_MAGIC:
- case TMPFS_MAGIC:
- *type = FILE_SYSTEM_MEMORY;
- break;
--- a/base/system/sys_info_posix.cc
+++ b/base/system/sys_info_posix.cc
-@@ -100,10 +100,10 @@
+@@ -62,10 +62,10 @@
if (HANDLE_EINTR(statfs(path.value().c_str(), &stats)) != 0)
return false;
diff --git a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch b/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
deleted file mode 100644
index 7a0337f3bf3b5..0000000000000
--- a/srcpkgs/chromium/patches/fix-nasm-musl-config.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/third_party/nasm/config/config-linux.h
-+++ b/third_party/nasm/config/config-linux.h
-@@ -139,7 +139,9 @@
- #define HAVE_ACCESS 1
-
- /* Define to 1 if you have the `canonicalize_file_name' function. */
-+#ifdef __GLIBC__
- #define HAVE_CANONICALIZE_FILE_NAME 1
-+#endif
-
- /* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
- /* #undef HAVE_CPU_TO_LE16 */
diff --git a/srcpkgs/chromium/patches/musl-partition-atfork.patch b/srcpkgs/chromium/patches/musl-partition-atfork.patch
new file mode 100644
index 0000000000000..2910aa2bbf9b1
--- /dev/null
+++ b/srcpkgs/chromium/patches/musl-partition-atfork.patch
@@ -0,0 +1,11 @@
+--- a/base/allocator/partition_allocator/partition_root.cc
++++ b/base/allocator/partition_allocator/partition_root.cc
+@@ -239,7 +239,7 @@
+ if (!g_global_init_called.compare_exchange_strong(expected, true))
+ return;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && defined(__GLIBC__)) || BUILDFLAG(IS_CHROMEOS)
+ // When fork() is called, only the current thread continues to execute in the
+ // child process. If the lock is held, but *not* by this thread when fork() is
+ // called, we have a deadlock.
diff --git a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch b/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
deleted file mode 100644
index 13d504d3e7920..0000000000000
--- a/srcpkgs/chromium/patches/re-fix-TFLite-build-error-on-linux-with-system-zlib.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From dda01a706453ded8c01c41775707cb5ef4e316f8 Mon Sep 17 00:00:00 2001
-From: Andres Salomon <dilinger@queued.net>
-Date: Tue, 25 Oct 2022 21:11:46 +0000
-Subject: [PATCH] Re-fix TFLite build error on linux when using the system zlib
-
-In commit ae0f9adb7e14c0d19ca695ef6ad40b321a8cb64c, I fixed some build
-errors related to minizip patch inclusion in TFLite. However, after that
-when TFLite Support was rolled to HEAD, a small part of that patch got
-dropped. The result is the following build error with 107.0.5304.62:
-
-../../third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc:22:10: fatal error: 'contrib/minizip/ioapi.h' file not found
- ^~~~~~~~~~~~~~~~~~~~~~~~~
-1 error generated.
-
-This commit re-adds the lost fix.
-
-R=junzou@chromium.org
-
-Change-Id: Ie96c3571894b5100a1e2a2771da29699eff0beb3
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3972087
-Reviewed-by: Robert Ogden <robertogden@chromium.org>
-Commit-Queue: Robert Ogden <robertogden@chromium.org>
-Auto-Submit: Andres Salomon <dilinger@queued.net>
-Cr-Commit-Position: refs/heads/main@{#1063478}
----
- .../metadata/cc/utils/zip_readonly_mem_file.cc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-index 392b6b411fe..525ae4a2b45 100644
---- a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-+++ b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc
-@@ -19,7 +19,7 @@ limitations under the License.
- #include <cstdio>
-
- #include "absl/strings/string_view.h" // from @com_google_absl
--#include "contrib/minizip/ioapi.h"
-+#include "third_party/zlib/contrib/minizip/ioapi.h"
-
- namespace tflite {
- namespace metadata {
diff --git a/srcpkgs/chromium/patches/remove-strip_binary.patch b/srcpkgs/chromium/patches/remove-strip_binary.patch
deleted file mode 100644
index 8b13c6a056a86..0000000000000
--- a/srcpkgs/chromium/patches/remove-strip_binary.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/chrome/test/chromedriver/BUILD.gn.orig
-+++ b/chrome/test/chromedriver/BUILD.gn
-@@ -308,11 +308,7 @@
- }
- }
-
--if (is_linux) {
-- chromedriver_output = "chromedriver.unstripped"
--} else {
-- chromedriver_output = "chromedriver"
--}
-+chromedriver_output = "chromedriver"
-
- executable("$chromedriver_output") {
- testonly = true
-@@ -336,16 +332,6 @@
- }
- }
-
--if (is_linux) {
-- strip_binary("chromedriver") {
-- testonly = true
-- binary_input = "$root_out_dir/$chromedriver_output"
-- symbol_output = "$root_out_dir/chromedriver.debug"
-- stripped_binary_output = "$root_out_dir/chromedriver"
-- deps = [ ":$chromedriver_output" ]
-- }
--}
--
- python_library("chromedriver_py_tests") {
- testonly = true
- deps = [
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch b/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
deleted file mode 100644
index 28c4ad35f14e0..0000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-4k-pages.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-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;
-
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch b/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
deleted file mode 100644
index 0c03ad4a65eb4..0000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-libvpx.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-commit 981437bc846fcdb854062e89fd3d86f112e5f426
-Author: q66 <daniel@octaforge.org>
-Date: Sat Jun 25 12:35:37 2022 +0200
-
- Use generic target for now.
-
- This is because the source tree is missing vsx optimizations that
- then do not get included and result in failed linking such as:
-
- ld.lld: error: undefined symbol: vpx_mse16x16_vsx
-
-diff --git a/third_party/libvpx/generate_gni.sh b/third_party/libvpx/generate_gni.sh
-index 7429080..43ee29a 100755
---- a/third_party/libvpx/generate_gni.sh
-+++ b/third_party/libvpx/generate_gni.sh
-@@ -405,7 +405,7 @@
- gen_config_files linux/mips64el "--target=mips64-linux-gcc ${all_platforms}"
- gen_config_files linux/loongarch \
- "--target=loongarch64-linux-gcc ${all_platforms}"
--gen_config_files linux/ppc64 "--target=ppc64le-linux-gcc ${all_platforms}"
-+gen_config_files linux/ppc64 "--target=generic-gnu ${all_platforms}"
- gen_config_files linux/generic "--target=generic-gnu $HIGHBD ${all_platforms}"
- gen_config_files win/arm64 \
- "--target=arm64-win64-vs15 ${all_platforms} ${HIGHBD}"
-@@ -468,7 +468,7 @@
- gen_rtcd_header linux/mipsel mipsel
- gen_rtcd_header linux/mips64el mips64el
- gen_rtcd_header linux/loongarch loongarch
--gen_rtcd_header linux/ppc64 ppc
-+gen_rtcd_header linux/ppc64 generic
- gen_rtcd_header linux/generic generic
- gen_rtcd_header win/arm64 armv8
- gen_rtcd_header win/ia32 x86 "${require_sse2}"
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch b/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
deleted file mode 100644
index 4bfb5d494b06f..0000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-sandbox-linux-stat.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/sandbox/linux/system_headers/linux_stat.h
-+++ b/sandbox/linux/system_headers/linux_stat.h
-@@ -155,6 +155,28 @@ struct kernel_stat {
- unsigned int __unused4;
- unsigned int __unused5;
- };
-+#elif defined(__powerpc64__)
-+struct kernel_stat {
-+ unsigned long st_dev;
-+ unsigned long st_ino;
-+ unsigned long st_nlink;
-+ unsigned int st_mode;
-+ unsigned int st_uid;
-+ unsigned int st_gid;
-+ unsigned long st_rdev;
-+ long st_size;
-+ unsigned long st_blksize;
-+ unsigned long st_blocks;
-+ unsigned long st_atime_;
-+ unsigned long st_atime_nsec_;
-+ unsigned long st_mtime_;
-+ unsigned long st_mtime_nsec_;
-+ unsigned long st_ctime_;
-+ unsigned long st_ctime_nsec_;
-+ unsigned long __unused4;
-+ unsigned long __unused5;
-+ unsigned long __unused6;
-+};
- #endif
-
- // On 32-bit systems, we default to the 64-bit stat struct like libc
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch b/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
deleted file mode 100644
index 0bc5053589168..0000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-support.patch
+++ /dev/null
@@ -1,3590 +0,0 @@
-commit 2c013a317b1114ef67cdbbc30824b28907b9ea94
-Author: Daniel Kolesa <daniel@octaforge.org>
-Date: Wed Mar 3 19:08:29 2021 +0100
-
- ppc64le support
-
-diff --git a/build/download_nacl_toolchains.py b/build/download_nacl_toolchains.py
-index 286a92a27..ec36a85d3 100755
---- a/build/download_nacl_toolchains.py
-+++ b/build/download_nacl_toolchains.py
-@@ -13,6 +13,10 @@ import sys
-
-
- def Main(args):
-+ # If `disable_nacl=1` is in GYP_DEFINES, exit
-+ if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''):
-+ return 0
-+
- script_dir = os.path.dirname(os.path.abspath(__file__))
- src_dir = os.path.dirname(script_dir)
- nacl_dir = os.path.join(src_dir, 'native_client')
---- a/chrome/installer/linux/BUILD.gn
-+++ b/chrome/installer/linux/BUILD.gn
-@@ -97,8 +97,6 @@
- "$root_out_dir/xdg-mime",
- "$root_out_dir/xdg-settings",
- "$root_out_dir/locales/en-US.pak",
-- "$root_out_dir/MEIPreload/manifest.json",
-- "$root_out_dir/MEIPreload/preloaded_data.pb",
- ]
-
- action_foreach("calculate_deb_dependencies") {
-@@ -377,7 +377,6 @@
- "//chrome",
- "//chrome:packed_resources",
- "//chrome/browser/enterprise/connectors/device_trust/key_management/installer/management_service:chrome_management_service",
-- "//chrome/browser/resources/media/mei_preload:component",
- "//components/crash/core/app:chrome_crashpad_handler",
- "//sandbox/linux:chrome_sandbox",
- ]
-diff --git a/sandbox/features.gni b/sandbox/features.gni
-index db30ae6d6..9dc09bf53 100644
---- a/sandbox/features.gni
-+++ b/sandbox/features.gni
-@@ -11,7 +11,8 @@ import("//build/config/nacl/config.gni")
- use_seccomp_bpf = (is_linux || is_chromeos || is_android) &&
- (current_cpu == "x86" || current_cpu == "x64" ||
- current_cpu == "arm" || current_cpu == "arm64" ||
-- current_cpu == "mipsel" || current_cpu == "mips64el")
-+ current_cpu == "mipsel" || current_cpu == "mips64el" ||
-+ current_cpu == "ppc64")
-
- use_seccomp_bpf = use_seccomp_bpf || is_nacl_nonsfi
-
-diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn
-index e9a94b461..cca1a5da5 100644
---- a/sandbox/linux/BUILD.gn
-+++ b/sandbox/linux/BUILD.gn
-@@ -427,6 +427,8 @@ component("sandbox_services") {
-
- source_set("sandbox_services_headers") {
- sources = [
-+ "system_headers/ppc64_linux_syscalls.h",
-+ "system_headers/ppc64_linux_ucontext.h",
- "system_headers/arm64_linux_syscalls.h",
- "system_headers/arm_linux_syscalls.h",
- "system_headers/arm_linux_ucontext.h",
-diff --git a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-index 313511f22..0ca3a326f 100644
---- a/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-+++ b/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
-@@ -56,6 +56,13 @@
- #define MAX_PUBLIC_SYSCALL __NR_syscalls
- #define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-
-+#elif defined(__powerpc64__)
-+
-+#include <asm-generic/unistd.h>
-+#define MIN_SYSCALL 0u
-+#define MAX_PUBLIC_SYSCALL __NR_syscalls
-+#define MAX_SYSCALL MAX_PUBLIC_SYSCALL
-+
- #else
- #error "Unsupported architecture"
- #endif
-diff --git a/sandbox/linux/bpf_dsl/seccomp_macros.h b/sandbox/linux/bpf_dsl/seccomp_macros.h
-index 1a407b952..a6aec544e 100644
---- a/sandbox/linux/bpf_dsl/seccomp_macros.h
-+++ b/sandbox/linux/bpf_dsl/seccomp_macros.h
-@@ -16,6 +16,9 @@
- #if defined(__mips__)
- // sys/user.h in eglibc misses size_t definition
- #include <stddef.h>
-+#elif defined(__powerpc64__)
-+// Manually define greg_t on ppc64
-+typedef unsigned long long greg_t;
- #endif
- #endif
-
-@@ -346,6 +349,51 @@ struct regs_struct {
- #define SECCOMP_PT_PARM4(_regs) (_regs).regs[3]
- #define SECCOMP_PT_PARM5(_regs) (_regs).regs[4]
- #define SECCOMP_PT_PARM6(_regs) (_regs).regs[5]
-+
-+#elif defined(__powerpc64__)
-+#include <asm/ptrace.h>
-+
-+typedef struct pt_regs regs_struct;
-+
-+#ifdef ARCH_CPU_LITTLE_ENDIAN
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64LE
-+#else
-+#define SECCOMP_ARCH AUDIT_ARCH_PPC64
-+#endif
-+
-+#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.regs->gpr[_reg])
-+
-+#define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, 0)
-+#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.regs->nip
-+#define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, 3)
-+#define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, 4)
-+#define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, 5)
-+#define SECCOMP_PARM4(_ctx) SECCOMP_REG(_ctx, 6)
-+#define SECCOMP_PARM5(_ctx) SECCOMP_REG(_ctx, 7)
-+#define SECCOMP_PARM6(_ctx) SECCOMP_REG(_ctx, 8)
-+
-+#define SECCOMP_NR_IDX (offsetof(struct arch_seccomp_data, nr))
-+#define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch))
-+#define SECCOMP_IP_MSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 4)
-+#define SECCOMP_IP_LSB_IDX \
-+ (offsetof(struct arch_seccomp_data, instruction_pointer) + 0)
-+#define SECCOMP_ARG_MSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 4)
-+#define SECCOMP_ARG_LSB_IDX(nr) \
-+ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 0)
-+
-+#define SECCOMP_PT_RESULT(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_SYSCALL(_regs) (_regs).gpr[0]
-+#define SECCOMP_PT_IP(_regs) (_regs).nip
-+#define SECCOMP_PT_PARM1(_regs) (_regs).gpr[3]
-+#define SECCOMP_PT_PARM2(_regs) (_regs).gpr[4]
-+#define SECCOMP_PT_PARM3(_regs) (_regs).gpr[5]
-+#define SECCOMP_PT_PARM4(_regs) (_regs).gpr[6]
-+#define SECCOMP_PT_PARM5(_regs) (_regs).gpr[7]
-+#define SECCOMP_PT_PARM6(_regs) (_regs).gpr[8]
-+
- #else
- #error Unsupported target platform
-
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-index 6a1ec2389..f20c582dd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
-@@ -88,7 +88,8 @@ bool IsBaselinePolicyWatched(int sysno) {
- SyscallSets::IsPrctl(sysno) ||
- SyscallSets::IsProcessGroupOrSession(sysno) ||
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- SyscallSets::IsSocketCall(sysno) ||
- #endif
- #if defined(__arm__)
-@@ -227,7 +228,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_mmap)
- return RestrictMmapFlags();
- #endif
-@@ -245,7 +246,7 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- return RestrictPrctl();
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- if (sysno == __NR_socketpair) {
- // Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen.
- static_assert(AF_UNIX == PF_UNIX,
-@@ -285,7 +286,8 @@ ResultExpr EvaluateSyscallImpl(int fs_denied_errno,
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- if (SyscallSets::IsSocketCall(sysno))
- return RestrictSocketcallCommand();
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:11:10.481579470 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/baseline_policy_unittest.cc 2021-04-15 13:12:43.524831376 -0400
-@@ -302,7 +302,7 @@
- TEST_BASELINE_SIGSYS(__NR_syslog)
- TEST_BASELINE_SIGSYS(__NR_timer_create)
-
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- TEST_BASELINE_SIGSYS(__NR_inotify_init)
- TEST_BASELINE_SIGSYS(__NR_vserver)
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-index 01c046dda..7e5a6be82 100644
---- a/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc
-@@ -358,7 +358,16 @@
- if (args.nr == __NR_fstatat_default) {
- if (*reinterpret_cast<const char*>(args.args[1]) == '\0' &&
- args.args[3] == static_cast<uint64_t>(AT_EMPTY_PATH)) {
-- return syscall(__NR_fstat_default, static_cast<int>(args.args[0]),
-+ int fd = static_cast<int>(args.args[0]);
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO: Investigate the root cause and fix in glibc
-+ if (fd < 0)
-+ fd = -fd;
-+#endif
-+ return syscall(__NR_fstat_default, fd,
- reinterpret_cast<default_stat_struct*>(args.args[2]));
- }
- return -reinterpret_cast<intptr_t>(fs_denied_errno);
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
-index 2a97d3916..8e81aa6cf 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-14 14:41:08.000000000 -0400
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2021-04-15 13:17:57.808715733 -0400
-@@ -37,7 +37,8 @@
-
- #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
- !defined(__arm__) && !defined(__aarch64__) && \
-- !defined(PTRACE_GET_THREAD_AREA)
-+ !defined(PTRACE_GET_THREAD_AREA) && \
-+ !defined(__powerpc64__)
- // Also include asm/ptrace-abi.h since ptrace.h in older libc (for instance
- // the one in Ubuntu 16.04 LTS) is missing PTRACE_GET_THREAD_AREA.
- // asm/ptrace-abi.h doesn't exist on arm32 and PTRACE_GET_THREAD_AREA isn't
-@@ -45,6 +46,11 @@
- #include <asm/ptrace-abi.h>
- #endif
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- #if BUILDFLAG(IS_ANDROID)
-
- #if !defined(F_DUPFD_CLOEXEC)
-@@ -99,6 +105,14 @@
- return true;
- #else
- return false;
-+#endif
-+}
-+
-+inline bool IsArchitecturePPC64() {
-+#if defined(__powerpc64__)
-+ return true;
-+#else
-+ return false;
- #endif
- }
-
-@@ -239,6 +254,8 @@
- uint64_t kOLargeFileFlag = O_LARGEFILE;
- if (IsArchitectureX86_64() || IsArchitectureI386() || IsArchitectureMips())
- kOLargeFileFlag = 0100000;
-+ else if (IsArchitecturePPC64())
-+ kOLargeFileFlag = 0200000;
-
- const Arg<int> cmd(1);
- const Arg<long> long_arg(2);
-@@ -256,7 +273,16 @@
- F_SETLKW,
- F_GETLK,
- F_DUPFD,
-- F_DUPFD_CLOEXEC),
-+ F_DUPFD_CLOEXEC
-+#if defined(__powerpc64__)
-+// On PPC64, F_SETLK, F_GETLK, F_SETLKW are defined as the 64-bit variants
-+// but glibc will sometimes still use the 32-bit versions. Allow both.
-+ ,
-+ 5, /* F_GETLK (32) */
-+ 6, /* F_SETLK (32) */
-+ 7 /* F_SETLKW (32) */
-+#endif
-+ ),
- Allow())
- .Case(F_SETFL,
- If((long_arg & ~kAllowedMask) == 0, Allow()).Else(CrashSIGSYS()))
-@@ -266,7 +292,7 @@
- // clang-format on
- }
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- ResultExpr RestrictSocketcallCommand() {
- // Unfortunately, we are unable to restrict the first parameter to
- // socketpair(2). Whilst initially sounding bad, it's noteworthy that very
-@@ -419,7 +445,7 @@
- #endif
- return Switch(request)
- .CASES((
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- PTRACE_GETREGS, PTRACE_GETFPREGS, PTRACE_GET_THREAD_AREA,
- PTRACE_GETREGSET,
- #endif
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-index ba4289f05..9a4d5ab2d 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h
-@@ -48,7 +48,7 @@ SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictMprotectFlags();
- // O_NONBLOCK | O_SYNC | O_LARGEFILE | O_CLOEXEC | O_NOATIME.
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictFcntlCommands();
-
--#if defined(__i386__) || defined(__mips__)
-+#if defined(__i386__) || defined(__mips__) || defined(__powerpc64__)
- // Restrict socketcall(2) to only allow socketpair(2), send(2), recv(2),
- // sendto(2), recvfrom(2), shutdown(2), sendmsg(2) and recvmsg(2).
- SANDBOX_EXPORT bpf_dsl::ResultExpr RestrictSocketcallCommand();
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-index 642df7207..34f47eb73 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
-@@ -29,7 +29,8 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- switch (sysno) {
- case __NR_gettimeofday:
- #if defined(__i386__) || defined(__x86_64__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_time:
- #endif
- return true;
-@@ -52,12 +53,14 @@ bool SyscallSets::IsAllowedGettime(int sysno) {
- case __NR_clock_nanosleep_time64: // Parameters filtered by RestrictClockID().
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ftime: // Obsolete.
- #endif
- case __NR_settimeofday: // Privileged.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stime:
- #endif
- default:
-@@ -135,7 +138,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_faccessat: // EPERM not a valid errno.
- case __NR_fchmodat:
- case __NR_fchownat: // Should be called chownat ?
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat: // fstatat(). EPERM not a valid errno.
- #elif defined(__i386__) || defined(__arm__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-@@ -154,7 +157,7 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_memfd_create:
- case __NR_mkdirat:
- case __NR_mknodat:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldlstat:
- case __NR_oldstat:
- #endif
-@@ -168,7 +171,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- #endif
- case __NR_statfs: // EPERM not a valid errno.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_statfs64:
- #endif
- case __NR_symlinkat:
-@@ -178,7 +182,8 @@ bool SyscallSets::IsFileSystem(int sysno) {
- case __NR_truncate64:
- #endif
- case __NR_unlinkat:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_utime:
- #endif
- case __NR_utimensat: // New.
-@@ -203,7 +208,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- #endif
- return true;
- // TODO(jln): these should be denied gracefully as well (moved below).
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_fadvise64: // EPERM not a valid errno.
- #endif
- #if defined(__i386__)
-@@ -216,11 +222,12 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_flock: // EPERM not a valid errno.
- case __NR_fstatfs: // Give information about the whole filesystem.
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_fstatfs64:
- #endif
- case __NR_fsync: // EPERM not a valid errno.
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_oldfstat:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-@@ -228,6 +235,8 @@ bool SyscallSets::IsAllowedFileSystemAccessViaFd(int sysno) {
- case __NR_sync_file_range: // EPERM not a valid errno.
- #elif defined(__arm__)
- case __NR_arm_sync_file_range: // EPERM not a valid errno.
-+#elif defined(__powerpc64__)
-+ case __NR_sync_file_range2: // EPERM not a valid errno.
- #endif
- default:
- return false;
-@@ -248,7 +257,8 @@ bool SyscallSets::IsDeniedFileSystemAccessViaFd(int sysno) {
- #endif
- case __NR_getdents64: // EPERM not a valid errno.
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_readdir:
- #endif
- return true;
-@@ -289,7 +299,7 @@ bool SyscallSets::IsGetSimpleId(int sysno) {
- bool SyscallSets::IsProcessPrivilegeChange(int sysno) {
- switch (sysno) {
- case __NR_capset:
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_ioperm: // Intel privilege.
- case __NR_iopl: // Intel privilege.
- #endif
-@@ -340,8 +350,11 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- case __NR_rt_sigreturn:
- case __NR_rt_sigtimedwait:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
-+#ifndef __powerpc64__
- case __NR_rt_sigtimedwait_time64:
-+#endif
- case __NR_sigaction:
- case __NR_sigprocmask:
- case __NR_sigreturn:
-@@ -357,7 +370,8 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) {
- #endif
- case __NR_signalfd4:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_sigpending:
- case __NR_sigsuspend:
- #endif
-@@ -381,7 +395,7 @@ bool SyscallSets::IsAllowedOperationOnFd(int sysno) {
- #endif
- case __NR_dup3:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_shutdown:
- #endif
- return true;
-@@ -414,7 +428,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- case __NR_exit_group:
- case __NR_wait4:
- case __NR_waitid:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_waitpid:
- #endif
- return true;
-@@ -431,7 +445,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) {
- #endif
- case __NR_set_tid_address:
- case __NR_unshare:
--#if !defined(__mips__) && !defined(__aarch64__)
-+#if !defined(__mips__) && !defined(__aarch64__) || defined(__powerpc64__)
- case __NR_vfork:
- #endif
- default:
-@@ -484,7 +498,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- return true;
- default:
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_socketpair: // We will want to inspect its argument.
- #endif
- return false;
-@@ -494,7 +508,7 @@ bool SyscallSets::IsAllowedGetOrModifySocket(int sysno) {
- bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- switch (sysno) {
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_accept:
- case __NR_accept4:
- case __NR_bind:
-@@ -509,7 +523,8 @@ bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
- }
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- bool SyscallSets::IsSocketCall(int sysno) {
- switch (sysno) {
-@@ -523,7 +538,8 @@ bool SyscallSets::IsSocketCall(int sysno) {
- }
- #endif
-
--#if defined(__x86_64__) || defined(__arm__) || defined(__mips__)
-+#if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- bool SyscallSets::IsNetworkSocketInformation(int sysno) {
- switch (sysno) {
- case __NR_getpeername:
-@@ -548,7 +564,7 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
- case __NR_mincore:
- case __NR_mlockall:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_mmap:
- #endif
- #if defined(__i386__) || defined(__arm__) || \
-@@ -578,7 +594,8 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- switch (sysno) {
- case __NR_lseek:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR__llseek:
- #endif
- #if !defined(__aarch64__)
-@@ -598,26 +615,28 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
- case __NR_readv:
- case __NR_pread64:
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_recv:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_recvfrom: // Could specify source.
- case __NR_recvmsg: // Could specify source.
- #endif
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc64__)
- case __NR_select:
- #endif
--#if defined(__i386__) || defined(__arm__) || defined(__mips__)
-+#if defined(__i386__) || defined(__arm__) || defined(__mips__) || defined(__powerpc64__)
- case __NR__newselect:
- #endif
- #if defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_send:
- #endif
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_sendmsg: // Could specify destination.
- case __NR_sendto: // Could specify destination.
- #endif
-@@ -673,7 +692,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- return true;
- case __NR_getpriority:
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_nice:
- #endif
- case __NR_setpriority:
-@@ -685,7 +705,8 @@ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
- bool SyscallSets::IsAdminOperation(int sysno) {
- switch (sysno) {
- #if defined(__i386__) || defined(__arm__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_bdflush:
- #endif
- case __NR_kexec_load:
-@@ -701,7 +722,8 @@ bool SyscallSets::IsAdminOperation(int sysno) {
-
- bool SyscallSets::IsKernelModule(int sysno) {
- switch (sysno) {
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_create_module:
- case __NR_get_kernel_syms: // Should ENOSYS.
- case __NR_query_module:
-@@ -734,7 +756,8 @@ bool SyscallSets::IsFsControl(int sysno) {
- case __NR_swapoff:
- case __NR_swapon:
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_umount:
- #endif
- case __NR_umount2:
-@@ -750,7 +773,7 @@ bool SyscallSets::IsNuma(int sysno) {
- case __NR_getcpu:
- case __NR_mbind:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_migrate_pages:
- #endif
- case __NR_move_pages:
-@@ -785,14 +808,15 @@ bool SyscallSets::IsGlobalProcessEnvironment(int sysno) {
- switch (sysno) {
- case __NR_acct: // Privileged.
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
--#if defined(__i386__) || defined(__arm__)
-+#if defined(__i386__) || defined(__arm__) || defined(__powerpc64__)
- case __NR_ugetrlimit:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_ulimit:
- #endif
- case __NR_getrusage:
-@@ -826,7 +850,7 @@ bool SyscallSets::IsGlobalSystemStatus(int sysno) {
- #endif
- case __NR_sysinfo:
- case __NR_uname:
--#if defined(__i386__)
-+#if defined(__i386__) || defined(__powerpc64__)
- case __NR_olduname:
- case __NR_oldolduname:
- #endif
-@@ -892,8 +916,16 @@ bool SyscallSets::IsSystemVSemaphores(int sysno) {
- }
- #endif
-
-+/* shitty hack around Void's 4.19 kernel headers missing those numbers */
-+#if defined(__powerpc64__) && !defined(__NR_shmget)
-+#define __NR_shmget 395
-+#define __NR_shmctl 396
-+#define __NR_shmat 397
-+#define __NR_shmdt 398
-+#endif
-+
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- bool SyscallSets::IsSystemVSharedMemory(int sysno) {
-@@ -925,7 +957,8 @@ bool SyscallSets::IsSystemVMessageQueue(int sysno) {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- bool SyscallSets::IsSystemVIpc(int sysno) {
- switch (sysno) {
-@@ -945,7 +978,8 @@ bool SyscallSets::IsAnySystemV(int sysno) {
- return IsSystemVMessageQueue(sysno) || IsSystemVSemaphores(sysno) ||
- IsSystemVSharedMemory(sysno);
- #elif defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- return IsSystemVIpc(sysno);
- #endif
- }
-@@ -1002,7 +1036,8 @@ bool SyscallSets::IsFaNotify(int sysno) {
- bool SyscallSets::IsTimer(int sysno) {
- switch (sysno) {
- case __NR_getitimer:
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_alarm:
- #endif
- case __NR_setitimer:
-@@ -1084,18 +1119,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_syncfs:
- case __NR_vhangup:
- // The system calls below are not implemented.
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_afs_syscall:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_break:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_getpmsg:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_gtty:
- case __NR_idle:
- case __NR_lock:
-@@ -1103,20 +1142,22 @@ bool SyscallSets::IsMisc(int sysno) {
- case __NR_prof:
- case __NR_profil:
- #endif
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-+ defined(__powerpc64__)
- case __NR_putpmsg:
- #endif
- #if defined(__x86_64__)
- case __NR_security:
- #endif
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- case __NR_stty:
- #endif
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- case __NR_tuxcall:
- #endif
--#if !defined(__aarch64__)
-+#if !defined(__aarch64__) && !defined(__powerpc64__)
- case __NR_vserver:
- #endif
- return true;
-diff --git a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-index 923533ec9..411f72acd 100644
---- a/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
-@@ -43,13 +43,14 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsDeniedGetOrModifySocket(int sysno);
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big multiplexing system call for sockets.
- static bool IsSocketCall(int sysno);
- #endif
-
- #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- static bool IsNetworkSocketInformation(int sysno);
- #endif
-
-@@ -76,7 +77,7 @@ class SANDBOX_EXPORT SyscallSets {
- static bool IsSystemVSemaphores(int sysno);
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__) || \
-+ defined(__aarch64__) || defined(__powerpc64__) || \
- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
- // These give a lot of ambient authority and bypass the setuid sandbox.
- static bool IsSystemVSharedMemory(int sysno);
-@@ -88,7 +89,8 @@ class SANDBOX_EXPORT SyscallSets {
- #endif
-
- #if defined(__i386__) || \
-- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
-+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS)) || \
-+ defined(__powerpc64__)
- // Big system V multiplexing system call.
- static bool IsSystemVIpc(int sysno);
- #endif
-diff --git a/sandbox/linux/seccomp-bpf/syscall.cc b/sandbox/linux/seccomp-bpf/syscall.cc
-index e47e98bf5..d53a7ff56 100644
---- a/sandbox/linux/seccomp-bpf/syscall.cc
-+++ b/sandbox/linux/seccomp-bpf/syscall.cc
-@@ -18,7 +18,7 @@ namespace sandbox {
- namespace {
-
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined (ARCH_CPU_PPC64_FAMILY)
- // Number that's not currently used by any Linux kernel ABIs.
- const int kInvalidSyscallNumber = 0x351d3;
- #else
-@@ -310,12 +310,56 @@ asm(// We need to be able to tell the kernel exactly where we made a
- // Enter the kernel
- "svc 0\n"
- "2:ret\n"
-+ ".cfi_endproc\n"
-+ ".size SyscallAsm, .-SyscallAsm\n"
-+#elif defined(__powerpc64__)
-+ ".text\n"
-+ ".align 4\n"
-+ ".type SyscallAsm @function\n"
-+ "SyscallAsm:\n"
-+ ".cfi_startproc\n"
-+
-+ // Check if r3 is negative
-+ "cmpdi 3, 0\n"
-+ "bgt 2f\n"
-+
-+ // Load address of 3f into r3 and return
-+ "mflr 10\n"
-+ "bl 1f\n"
-+ "1: mflr 3\n"
-+ "mtlr 10\n"
-+ "addi 3, 3, 4*13\n"
-+ "blr\n"
-+
-+ // Load arguments from array into r3-8
-+ // save param 3 in r10
-+ "2:\n"
-+ "mr 0, 3\n"
-+ "ld 3, 0(4)\n"
-+ "ld 5, 16(4)\n"
-+ "ld 6, 24(4)\n"
-+ "ld 7, 32(4)\n"
-+ "ld 8, 40(4)\n"
-+ "ld 4, 8(4)\n"
-+ "li 9, 0\n"
-+
-+ // Enter kernel
-+ "sc\n"
-+
-+ // Magic return address
-+ "3:\n"
-+ // Like MIPS, ppc64 return values are always positive.
-+ // Check for error in cr0.SO and negate upon error
-+ "bc 4, 3, 4f\n"
-+ "neg 3, 3\n"
-+ "4: blr\n"
-+
- ".cfi_endproc\n"
- ".size SyscallAsm, .-SyscallAsm\n"
- #endif
- ); // asm
-
--#if defined(__x86_64__)
-+#if defined(__x86_64__) || defined(__powerpc64__)
- extern "C" {
- intptr_t SyscallAsm(intptr_t nr, const intptr_t args[6]);
- }
-@@ -429,6 +473,8 @@ intptr_t Syscall::Call(int nr,
- ret = inout;
- }
-
-+#elif defined(__powerpc64__)
-+ intptr_t ret = SyscallAsm(nr, args);
- #else
- #error "Unimplemented architecture"
- #endif
-@@ -445,8 +491,18 @@ void Syscall::PutValueInUcontext(intptr_t ret_val, ucontext_t* ctx) {
- // needs to be changed back.
- ret_val = -ret_val;
- SECCOMP_PARM4(ctx) = 1;
-- } else
-+ } else {
- SECCOMP_PARM4(ctx) = 0;
-+ }
-+#endif
-+#if defined(__powerpc64__)
-+ // Same as MIPS, need to invert ret and set error register (cr0.SO)
-+ if (ret_val <= -1 && ret_val >= -4095) {
-+ ret_val = -ret_val;
-+ ctx->uc_mcontext.regs->ccr |= (1 << 28);
-+ } else {
-+ ctx->uc_mcontext.regs->ccr &= ~(1 << 28);
-+ }
- #endif
- SECCOMP_RESULT(ctx) = static_cast<greg_t>(ret_val);
- }
-diff --git a/sandbox/linux/seccomp-bpf/trap.cc b/sandbox/linux/seccomp-bpf/trap.cc
-index f5b86a73a..5e6c4a068 100644
---- a/sandbox/linux/seccomp-bpf/trap.cc
-+++ b/sandbox/linux/seccomp-bpf/trap.cc
-@@ -232,6 +232,20 @@ void Trap::SigSys(int nr, LinuxSigInfo* info, ucontext_t* ctx) {
- SetIsInSigHandler();
- }
-
-+#if defined(__powerpc64__)
-+ // On ppc64+glibc, some syscalls seem to accidentally negate the first
-+ // parameter which causes checks against it to fail. For now, manually
-+ // negate them back.
-+ // TODO(shawn@anastas.io): investigate this issue further
-+ auto nr = SECCOMP_SYSCALL(ctx);
-+ if (nr == __NR_openat || nr == __NR_mkdirat || nr == __NR_faccessat || nr == __NR_readlinkat ||
-+ nr == __NR_renameat || nr == __NR_renameat2 || nr == __NR_newfstatat || nr == __NR_unlinkat) {
-+ if (static_cast<int>(SECCOMP_PARM1(ctx)) > 0) {
-+ SECCOMP_PARM1(ctx) = -SECCOMP_PARM1(ctx);
-+ }
-+ }
-+#endif
-+
- // Copy the seccomp-specific data into a arch_seccomp_data structure. This
- // is what we are showing to TrapFnc callbacks that the system call
- // evaluator registered with the sandbox.
-diff --git a/sandbox/linux/services/credentials.cc b/sandbox/linux/services/credentials.cc
-index d7b5d8c44..4adc6d0d4 100644
---- a/sandbox/linux/services/credentials.cc
-+++ b/sandbox/linux/services/credentials.cc
-@@ -81,7 +81,7 @@ bool ChrootToSafeEmptyDir() {
- pid_t pid = -1;
- alignas(16) char stack_buf[PTHREAD_STACK_MIN];
- #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // The stack grows downward.
- void* stack = stack_buf + sizeof(stack_buf);
- #else
-@@ -90,7 +90,9 @@
-
- int clone_flags = CLONE_FS | LINUX_SIGCHLD;
- void* tls = nullptr;
--#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY)) && \
-+// RAJA this might be it...
-+#if (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM_FAMILY) || \
-+ defined(ARCH_CPU_PPC64_FAMILY)) && \
- !defined(MEMORY_SANITIZER)
- // Use CLONE_VM | CLONE_VFORK as an optimization to avoid copying page tables.
- // Since clone writes to the new child's TLS before returning, we must set a
-@@ -98,6 +100,11 @@
- // glibc performs syscalls by calling a function pointer in TLS, so we do not
- // attempt this optimization.
- // TODO(crbug.com/1247458) Broken in MSan builds after LLVM f1bb30a4956f.
-+ //
-+ // NOTE: Without CLONE_VM, fontconfig will attempt to reload configuration
-+ // in every thread. Since the rendered threads are sandboxed without
-+ // filesystem access (e.g. to /etc/fonts/fonts.conf) this will cause font
-+ // configuraiton loading failures and no fonts will be displayed!
- clone_flags |= CLONE_VM | CLONE_VFORK | CLONE_SETTLS;
-
- char tls_buf[PTHREAD_STACK_MIN] = {0};
-diff --git a/sandbox/linux/services/syscall_wrappers.cc b/sandbox/linux/services/syscall_wrappers.cc
-index fcfd2aa12..f6eb32fb7 100644
---- a/sandbox/linux/services/syscall_wrappers.cc
-+++ b/sandbox/linux/services/syscall_wrappers.cc
-@@ -58,7 +58,7 @@ long sys_clone(unsigned long flags,
- #if defined(ARCH_CPU_X86_64)
- return syscall(__NR_clone, flags, child_stack, ptid, ctid, tls);
- #elif defined(ARCH_CPU_X86) || defined(ARCH_CPU_ARM_FAMILY) || \
-- defined(ARCH_CPU_MIPS_FAMILY)
-+ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_PPC64_FAMILY)
- // CONFIG_CLONE_BACKWARDS defined.
- return syscall(__NR_clone, flags, child_stack, ptid, tls, ctid);
- #endif
-diff --git a/sandbox/linux/syscall_broker/broker_process.cc b/sandbox/linux/syscall_broker/broker_process.cc
-index d72c9d238..77f1d95f5 100644
---- a/sandbox/linux/syscall_broker/broker_process.cc
-+++ b/sandbox/linux/syscall_broker/broker_process.cc
-@@ -169,7 +169,7 @@ bool BrokerProcess::IsSyscallBrokerable(int sysno, bool fast_check) const {
- #if defined(__NR_fstatat64)
- case __NR_fstatat64:
- #endif
--#if defined(__x86_64__) || defined(__aarch64__)
-+#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__)
- case __NR_newfstatat:
- #endif
- return !fast_check || allowed_command_set_.test(COMMAND_STAT);
-diff --git a/sandbox/linux/system_headers/linux_seccomp.h b/sandbox/linux/system_headers/linux_seccomp.h
-index 1fa47ed09..39cc9ab53 100644
---- a/sandbox/linux/system_headers/linux_seccomp.h
-+++ b/sandbox/linux/system_headers/linux_seccomp.h
-@@ -41,6 +41,9 @@
- #ifndef EM_AARCH64
- #define EM_AARCH64 183
- #endif
-+#ifndef EM_PPC64
-+#define EM_PPC64 21
-+#endif
-
- #ifndef __AUDIT_ARCH_64BIT
- #define __AUDIT_ARCH_64BIT 0x80000000
-@@ -73,6 +76,12 @@
- #ifndef AUDIT_ARCH_AARCH64
- #define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
- #endif
-+#ifndef AUDIT_ARCH_PPC64
-+#define AUDIT_ARCH_PPC64 (EM_PPC64 | __AUDIT_ARCH_64BIT)
-+#endif
-+#ifndef AUDIT_ARCH_PPC64LE
-+#define AUDIT_ARCH_PPC64LE (EM_PPC64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
-+#endif
-
- // For prctl.h
- #ifndef PR_SET_SECCOMP
-diff --git a/sandbox/linux/system_headers/linux_signal.h b/sandbox/linux/system_headers/linux_signal.h
-index f5a736761..515b21a5f 100644
---- a/sandbox/linux/system_headers/linux_signal.h
-+++ b/sandbox/linux/system_headers/linux_signal.h
-@@ -13,7 +13,7 @@
- // (not undefined, but defined different values and in different memory
- // layouts). So, fill the gap here.
- #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
-
- #define LINUX_SIGHUP 1
- #define LINUX_SIGINT 2
-diff --git a/sandbox/linux/system_headers/linux_syscalls.h b/sandbox/linux/system_headers/linux_syscalls.h
-index 2b78a0cc3..0a70f5ea5 100644
---- a/sandbox/linux/system_headers/linux_syscalls.h
-+++ b/sandbox/linux/system_headers/linux_syscalls.h
-@@ -35,5 +35,9 @@
- #include "sandbox/linux/system_headers/arm64_linux_syscalls.h"
- #endif
-
-+#if defined(__powerpc64__)
-+#include "sandbox/linux/system_headers/ppc64_linux_syscalls.h"
-+#endif
-+
- #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SYSCALLS_H_
-
-diff --git a/sandbox/linux/system_headers/ppc64_linux_syscalls.h b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-new file mode 100644
-index 000000000..ccacffe22
---- /dev/null
-+++ b/sandbox/linux/system_headers/ppc64_linux_syscalls.h
-@@ -0,0 +1,12 @@
-+// Copyright 2014 The Chromium Authors. All rights reserved.
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+#define SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-+
-+#include <asm/unistd.h>
-+
-+//TODO: is it necessary to redefine syscall numbers for PPC64?
-+
-+#endif // SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_
-diff --git a/sandbox/policy/linux/bpf_utility_policy_linux.cc b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_utility_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_utility_policy_linux.cc
-@@ -34,7 +34,7 @@
- case __NR_fdatasync:
- case __NR_fsync:
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- #endif
- #if defined(__i386__) || defined(__arm__)
-diff --git a/sandbox/policy/linux/bpf_renderer_policy_linux.cc b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-index 2588fc792..d455c4601 100644
---- a/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-+++ b/sandbox/policy/linux/bpf_renderer_policy_linux.cc
-@@ -15,6 +15,11 @@
- #include "sandbox/linux/system_headers/linux_syscalls.h"
- #include "sandbox/policy/linux/sandbox_linux.h"
-
-+// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h
-+#ifdef __powerpc64__
-+#include <termios.h>
-+#endif
-+
- // TODO(vignatti): replace the local definitions below with #include
- // <linux/dma-buf.h> once kernel version 4.6 becomes widely used.
- #include <linux/types.h>
-@@ -77,7 +77,7 @@
- case __NR_ftruncate64:
- #endif
- #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
-- defined(__aarch64__)
-+ defined(__aarch64__) || defined(__powerpc64__)
- case __NR_getrlimit:
- case __NR_setrlimit:
- // We allow setrlimit to dynamically adjust the address space limit as
-diff --git a/third_party/angle/src/compiler/translator/InfoSink.h b/third_party/angle/src/compiler/translator/InfoSink.h
-index 3a807e1e3..5258617a7 100644
---- a/third_party/angle/src/compiler/translator/InfoSink.h
-+++ b/third_party/angle/src/compiler/translator/InfoSink.h
-@@ -92,7 +92,16 @@ class TInfoSinkBase
- stream.precision(8);
- stream << f;
- }
-- sink.append(stream.str());
-+
-+ // Hack to work around a bug where negative floating point values
-+ // are rendered like '.0.5' instead of '-0.5'
-+ std::string res(stream.str());
-+
-+ if (signbit(f)) { // test if f is negative
-+ res[0] = '-';
-+ }
-+
-+ sink.append(res);
- return *this;
- }
- // Write boolean values as their names instead of integral value.
-diff --git a/third_party/angle/src/libANGLE/Constants.h b/third_party/angle/src/libANGLE/Constants.h
-index fcbc9246a..39ae66148 100644
---- a/third_party/angle/src/libANGLE/Constants.h
-+++ b/third_party/angle/src/libANGLE/Constants.h
-@@ -9,6 +9,7 @@
- #ifndef LIBANGLE_CONSTANTS_H_
- #define LIBANGLE_CONSTANTS_H_
-
-+#include <cstddef>
- #include "common/platform.h"
-
- #include <stdint.h>
-diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
-index 17cf9cda9..8ce96bd32 100644
---- a/third_party/boringssl/BUILD.gn
-+++ b/third_party/boringssl/BUILD.gn
-@@ -103,6 +103,13 @@ if (is_win && !is_msan && current_cpu != "arm64") {
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-+ } else if (current_cpu == "ppc64") {
-+ if (is_linux) {
-+ # TODO: ppc64 (be) check
-+ sources += crypto_sources_linux_ppc64le
-+ } else {
-+ public_configs = [ ":no_asm_config" ]
-+ }
- } else {
- public_configs = [ ":no_asm_config" ]
- }
-diff --git a/third_party/breakpad/BUILD.gn b/third_party/breakpad/BUILD.gn
-index 4af3d7bbf..adbf54159 100644
---- a/third_party/breakpad/BUILD.gn
-+++ b/third_party/breakpad/BUILD.gn
-@@ -596,7 +596,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/minidump_file_writer.h",
- "breakpad/src/common/convert_UTF.cc",
- "breakpad/src/common/convert_UTF.h",
-- "breakpad/src/common/linux/breakpad_getcontext.S",
- "breakpad/src/common/linux/elf_core_dump.cc",
- "breakpad/src/common/linux/elf_core_dump.h",
- "breakpad/src/common/linux/elfutils.cc",
-@@ -634,6 +633,14 @@ if (is_linux || is_chromeos || is_android) {
-
- libs = [ "dl" ]
-
-+ if (current_cpu == "ppc64") {
-+ defines = [ "HAVE_GETCONTEXT" ]
-+ } else {
-+ sources += [
-+ "breakpad/src/common/linux/breakpad_getcontext.S"
-+ ]
-+ }
-+
- include_dirs = [
- ".",
- "breakpad/src",
-@@ -682,7 +689,6 @@ if (is_linux || is_chromeos || is_android) {
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc",
- "breakpad/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc",
- "breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc",
-- "breakpad/src/common/linux/breakpad_getcontext_unittest.cc",
- "breakpad/src/common/linux/elf_core_dump_unittest.cc",
- "breakpad/src/common/linux/file_id_unittest.cc",
- "breakpad/src/common/linux/linux_libc_support_unittest.cc",
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-index 07d9171a0..9aed4cb36 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h
-@@ -44,6 +44,8 @@ typedef MDRawContextARM RawContextCPU;
- typedef MDRawContextARM64_Old RawContextCPU;
- #elif defined(__mips__)
- typedef MDRawContextMIPS RawContextCPU;
-+#elif defined(__powerpc64__)
-+typedef MDRawContextPPC64 RawContextCPU;
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-index aae1dc13b..03afec7a5 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc
-@@ -270,7 +270,42 @@ void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
- out->float_save.fir = mcontext.fpc_eir;
- #endif
- }
--#endif // __mips__
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t ThreadInfo::GetInstructionPointer() const {
-+ return mcontext.gp_regs[PT_NIP];
-+}
-+
-+void ThreadInfo::FillCPUContext(RawContextCPU* out) const {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = mcontext.gp_regs[i];
-+
-+ out->lr = mcontext.gp_regs[PT_LNK];
-+ out->srr0 = mcontext.gp_regs[PT_NIP];
-+ out->srr1 = mcontext.gp_regs[PT_MSR];
-+ out->cr = mcontext.gp_regs[PT_CCR];
-+ out->xer = mcontext.gp_regs[PT_XER];
-+ out->ctr = mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] = \
-+ {(((uint64_t)vregs.vrregs[i][0]) << 32)
-+ | vregs.vrregs[i][1],
-+ (((uint64_t)vregs.vrregs[i][2]) << 32)
-+ | vregs.vrregs[i][3]};
-+
-+ out->vrsave = vregs.vrsave;
-+ out->vector_save.save_vscr = {0, vregs.vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+#endif // __powerpc64__
-
- void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- assert(gp_regs || size);
-@@ -279,6 +314,11 @@ void ThreadInfo::GetGeneralPurposeRegisters(void** gp_regs, size_t* size) {
- *gp_regs = mcontext.gregs;
- if (size)
- *size = sizeof(mcontext.gregs);
-+#elif defined(__powerpc64__)
-+ if (gp_regs)
-+ *gp_regs = mcontext.gp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.gp_regs);
- #else
- if (gp_regs)
- *gp_regs = ®s;
-@@ -294,6 +334,11 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- *fp_regs = &mcontext.fpregs;
- if (size)
- *size = sizeof(mcontext.fpregs);
-+#elif defined(__powerpc64__)
-+ if (fp_regs)
-+ *fp_regs = &mcontext.fp_regs;
-+ if (size)
-+ *size = sizeof(mcontext.fp_regs);
- #else
- if (fp_regs)
- *fp_regs = &fpregs;
-@@ -302,4 +347,13 @@ void ThreadInfo::GetFloatingPointRegisters(void** fp_regs, size_t* size) {
- #endif
- }
-
-+#if defined(__powerpc64__)
-+void ThreadInfo::GetVectorRegisters(void** v_regs, size_t* size) {
-+ if (v_regs)
-+ *v_regs = &vregs;
-+ if (size)
-+ *size = sizeof(vregs);
-+}
-+#endif
-+
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-index fb216fa6d..593aac822 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h
-@@ -68,6 +68,10 @@ struct ThreadInfo {
- // Use the structures defined in <sys/user.h>
- struct user_regs_struct regs;
- struct user_fpsimd_struct fpregs;
-+#elif defined(__powerpc64__)
-+ // Use the structures defined in <sys/ucontext.h>.
-+ mcontext_t mcontext;
-+ vrregset_t vregs;
- #elif defined(__mips__)
- // Use the structure defined in <sys/ucontext.h>.
- mcontext_t mcontext;
-@@ -84,6 +88,11 @@ struct ThreadInfo {
-
- // Returns the pointer and size of float point register area.
- void GetFloatingPointRegisters(void** fp_regs, size_t* size);
-+
-+#if defined(__powerpc64__)
-+ // Returns the pointer and size of the vector register area. (PPC64 only)
-+ void GetVectorRegisters(void** v_regs, size_t* size);
-+#endif
- };
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-index 6eec1be24..741983a1a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc
-@@ -254,6 +254,48 @@ void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc) {
- out->float_save.fir = uc->uc_mcontext.fpc_eir; // Unused.
- #endif
- }
-+
-+#elif defined(__powerpc64__)
-+
-+uintptr_t UContextReader::GetStackPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP];
-+}
-+
-+uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) {
-+ return uc->uc_mcontext.gp_regs[PT_NIP];
-+}
-+
-+void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
-+ const vrregset_t* vregs) {
-+ out->context_flags = MD_CONTEXT_PPC64_FULL;
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ out->gpr[i] = uc->uc_mcontext.gp_regs[i];
-+
-+ out->lr = uc->uc_mcontext.gp_regs[PT_LNK];
-+ out->srr0 = uc->uc_mcontext.gp_regs[PT_NIP];
-+ out->srr1 = uc->uc_mcontext.gp_regs[PT_MSR];
-+ out->cr = uc->uc_mcontext.gp_regs[PT_CCR];
-+ out->xer = uc->uc_mcontext.gp_regs[PT_XER];
-+ out->ctr = uc->uc_mcontext.gp_regs[PT_CTR];
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ out->float_save.fpregs[i] = uc->uc_mcontext.fp_regs[i];
-+
-+ out->float_save.fpscr = uc->uc_mcontext.fp_regs[NFPREG-1];
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++)
-+ out->vector_save.save_vr[i] =
-+ {(((uint64_t)vregs->vrregs[i][0]) << 32)
-+ | vregs->vrregs[i][1],
-+ (((uint64_t)vregs->vrregs[i][2]) << 32)
-+ | vregs->vrregs[i][3]};
-+
-+ out->vrsave = vregs->vrsave;
-+ out->vector_save.save_vscr = {0, vregs->vscr.vscr_word};
-+ out->vector_save.save_vrvalid = 0xFFFFFFFF;
-+}
-+
- #endif
-
- } // namespace google_breakpad
-diff --git a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-index 7d4100881..c122ac92e 100644
---- a/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
-@@ -55,6 +55,9 @@ struct UContextReader {
- #elif defined(__aarch64__)
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc,
- const struct fpsimd_context* fpregs);
-+#elif defined(__powerpc64__)
-+ static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc,
-+ const vrregset_t* vregs);
- #else
- static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc);
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-index a6cb5f984..ae16b64d9 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc
-@@ -461,9 +461,16 @@ bool ExceptionHandler::HandleSignal(int /*sig*/, siginfo_t* info, void* uc) {
- memcpy(&g_crash_context_.float_state, fp_ptr,
- sizeof(g_crash_context_.float_state));
- }
-+#elif defined(__powerpc64__)
-+ // On PPC64, we must copy VR state
-+ ucontext_t* uc_ptr = (ucontext_t*)uc;
-+ if (uc_ptr->uc_mcontext.v_regs) {
-+ memcpy(&g_crash_context_.vector_state, uc_ptr->uc_mcontext.v_regs,
-+ sizeof(g_crash_context_.vector_state));
-+ }
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- // FP state is not part of user ABI on ARM Linux.
-- // In case of MIPS Linux FP state is already part of ucontext_t
-+ // In case of MIPS, Linux FP state is already part of ucontext_t
- // and 'float_state' is not a member of CrashContext.
- ucontext_t* uc_ptr = (ucontext_t*)uc;
- if (uc_ptr->uc_mcontext.fpregs) {
-@@ -708,11 +715,19 @@ bool ExceptionHandler::WriteMinidump() {
- }
- #endif
-
--#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__)
-+#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__) \
-+ && !defined(__powerpc64__)
- // FPU state is not part of ARM EABI ucontext_t.
- memcpy(&context.float_state, context.context.uc_mcontext.fpregs,
- sizeof(context.float_state));
- #endif
-+
-+#if defined(__powerpc64__)
-+ // Vector registers must be copied on PPC64
-+ memcpy(&context.vector_state, context.context.uc_mcontext.v_regs,
-+ sizeof(context.vector_state));
-+#endif
-+
- context.tid = sys_gettid();
-
- // Add an exception stream to the minidump for better reporting.
-@@ -733,6 +748,9 @@ bool ExceptionHandler::WriteMinidump() {
- #elif defined(__mips__)
- context.siginfo.si_addr =
- reinterpret_cast<void*>(context.context.uc_mcontext.pc);
-+#elif defined(__powerpc64__)
-+ context.siginfo.si_addr =
-+ reinterpret_cast<void*>(context.context.uc_mcontext.gp_regs[PT_NIP]);
- #else
- #error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-index f80843ea7..260dd10f7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h
-@@ -192,7 +192,11 @@ class ExceptionHandler {
- siginfo_t siginfo;
- pid_t tid; // the crashing thread.
- ucontext_t context;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ // PPC64's FP state is a part of ucontext_t like MIPS but the vector
-+ // state is not, so a struct is needed.
-+ vstate_t vector_state;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- // #ifdef this out because FP state is not part of user ABI for Linux ARM.
- // In case of MIPS Linux FP state is already part of ucontext_t so
- // 'float_state' is not required.
-diff --git a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-index 35dcbfd4d..7934370fd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
-@@ -307,7 +307,7 @@ TEST(ExceptionHandlerTest, ParallelChildCrashesDontHang) {
- }
-
- // Wait a while until the child should have crashed.
-- usleep(1000000);
-+ usleep(2000000);
- // Kill the child if it is still running.
- kill(child, SIGKILL);
-
-@@ -559,6 +559,8 @@ const unsigned char kIllegalInstruction[] = {
- #if defined(__mips__)
- // mfc2 zero,Impl - usually illegal in userspace.
- 0x48, 0x00, 0x00, 0x48
-+#elif defined(__powerpc64__)
-+ 0x01, 0x01, 0x01, 0x01 // Crashes on a tested POWER9 cpu
- #else
- // This crashes with SIGILL on x86/x86-64/arm.
- 0xff, 0xff, 0xff, 0xff
-@@ -754,10 +756,10 @@ TEST(ExceptionHandlerTest, InstructionPointerMemoryMaxBound) {
-
- // These are defined here so the parent can use them to check the
- // data from the minidump afterwards.
-- // Use 4k here because the OS will hand out a single page even
-+ // Use the page size here because the OS will hand out a single page even
- // if a smaller size is requested, and this test wants to
- // test the upper bound of the memory range.
-- const uint32_t kMemorySize = 4096; // bytes
-+ const uint32_t kMemorySize = getpagesize(); // bytes
- const int kOffset = kMemorySize - sizeof(kIllegalInstruction);
-
- const pid_t child = fork();
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-index fa3c1713a..6ce709e2f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc
-@@ -138,7 +138,9 @@ class MicrodumpWriter {
- const MicrodumpExtraInfo& microdump_extra_info,
- LinuxDumper* dumper)
- : ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -337,6 +339,8 @@ class MicrodumpWriter {
- # else
- # error "This mips ABI is currently not supported (n32)"
- #endif
-+#elif defined(__powerpc64__)
-+ const char kArch[] = "ppc64";
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -409,7 +413,9 @@ class MicrodumpWriter {
- void DumpCPUState() {
- RawContextCPU cpu;
- my_memset(&cpu, 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(&cpu, ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(&cpu, ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(&cpu, ucontext_);
-@@ -605,7 +611,9 @@ class MicrodumpWriter {
- void* Alloc(unsigned bytes) { return dumper_->allocator()->Alloc(bytes); }
-
- const ucontext_t* const ucontext_;
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_;
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-index 6339ac0cd..291af106b 100644
---- a/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc
-@@ -279,10 +279,19 @@ TEST(MicrodumpWriterTest, BasicWithMappings) {
- CrashAndGetMicrodump(mappings, MicrodumpExtraInfo(), &buf);
- ASSERT_TRUE(ContainsMicrodump(buf));
-
-+ int page_size = getpagesize();
- #ifdef __LP64__
-- ASSERT_NE(std::string::npos,
-- buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-- "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ // This test is only available for the following page sizes
-+ ASSERT_TRUE((page_size == 4096) || (page_size == 65536));
-+ if (page_size == 4096) {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000001000 000000000000002A 0000000000001000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ } else {
-+ ASSERT_NE(std::string::npos,
-+ buf.find("M 0000000000010000 000000000000002A 0000000000010000 "
-+ "33221100554477668899AABBCCDDEEFF0 libfoo.so"));
-+ }
- #else
- ASSERT_NE(std::string::npos,
- buf.find("M 00001000 0000002A 00001000 "
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-index 415068983..b93e4afcf 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc
-@@ -112,6 +112,9 @@ bool LinuxCoreDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-@@ -197,7 +200,10 @@ bool LinuxCoreDumper::EnumerateThreads() {
- memset(&info, 0, sizeof(ThreadInfo));
- info.tgid = status->pr_pgrp;
- info.ppid = status->pr_ppid;
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ for (int i = 0; i < 31; i++)
-+ info.mcontext.gp_regs[i] = status->pr_reg[i];
-+#elif defined(__mips__)
- #if defined(__ANDROID__)
- for (int i = EF_R0; i <= EF_R31; i++)
- info.mcontext.gregs[i - EF_R0] = status->pr_reg[i];
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-index 7fd6532ad..199cbfffd 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
-@@ -765,7 +765,9 @@ bool LinuxDumper::GetStackInfo(const void** stack, size_t* stack_len,
- reinterpret_cast<uint8_t*>(int_stack_pointer & ~(page_size - 1));
-
- // The number of bytes of stack which we try to capture.
-- static const ptrdiff_t kStackToCapture = 32 * 1024;
-+ // This now depends on page_size to avoid missing data
-+ // on systems with larger page sizes.
-+ static const ptrdiff_t kStackToCapture = 8 * page_size;
-
- const MappingInfo* mapping = FindMapping(stack_pointer);
- if (!mapping)
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-index 7bee160f1..07bb2b81a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h
-@@ -63,7 +63,8 @@ namespace google_breakpad {
- (defined(__mips__) && _MIPS_SIM == _ABIO32)
- typedef Elf32_auxv_t elf_aux_entry;
- #elif defined(__x86_64) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM != _ABIO32)
-+ (defined(__mips__) && _MIPS_SIM != _ABIO32) || \
-+ defined(__powerpc64__)
- typedef Elf64_auxv_t elf_aux_entry;
- #endif
-
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-index 331f4bb34..3f722947f 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
-@@ -51,6 +51,8 @@
- #define TID_PTR_REGISTER "rcx"
- #elif defined(__mips__)
- #define TID_PTR_REGISTER "$1"
-+#elif defined(__powerpc64__)
-+#define TID_PTR_REGISTER "r8"
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-index e3ddb81a6..fa28575ef 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
-@@ -149,19 +149,27 @@ bool LinuxPtraceDumper::CopyFromProcess(void* dest, pid_t child,
- return true;
- }
-
--bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid)
--{
-+bool LinuxPtraceDumper::ReadRegisterSet(ThreadInfo* info, pid_t tid) {
- #ifdef PTRACE_GETREGSET
- struct iovec io;
- info->GetGeneralPurposeRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PRSTATUS, (void*)&io) == -1) {
- return false;
- }
-
- info->GetFloatingPointRegisters(&io.iov_base, &io.iov_len);
-- if (sys_ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_FPREGSET, (void*)&io) == -1) {
- return false;
- }
-+
-+#if defined(__powerpc64__)
-+ // Grab the vector registers on PPC64 too
-+ info->GetVectorRegisters(&io.iov_base, &io.iov_len);
-+ if (ptrace(PTRACE_GETREGSET, tid, (void*)NT_PPC_VMX, (void*)&io) == -1) {
-+ return false;
-+ }
-+#endif // defined(__powerpc64__)
-+
- return true;
- #else
- return false;
-@@ -298,6 +306,9 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) {
- #elif defined(__mips__)
- stack_pointer =
- reinterpret_cast<uint8_t*>(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]);
-+#elif defined(__powerpc64__)
-+ stack_pointer =
-+ reinterpret_cast<uint8_t*>(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]);
- #else
- #error "This code hasn't been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-index da71e15dc..12bfb317a 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc
-@@ -462,6 +462,9 @@ TEST(LinuxPtraceDumperTest, VerifyStackReadWithMultipleThreads) {
- #elif defined(__mips__)
- pid_t* process_tid_location =
- reinterpret_cast<pid_t*>(one_thread.mcontext.gregs[1]);
-+#elif defined(__powerpc64__)
-+ pid_t* process_tid_location =
-+ reinterpret_cast<pid_t*>(one_thread.mcontext.gp_regs[8]);
- #else
- #error This test has not been ported to this platform.
- #endif
-@@ -559,6 +562,8 @@ TEST_F(LinuxPtraceDumperTest, SanitizeStackCopy) {
- uintptr_t heap_addr = thread_info.regs.rcx;
- #elif defined(__mips__)
- uintptr_t heap_addr = thread_info.mcontext.gregs[1];
-+#elif defined(__powerpc64__)
-+ uintptr_t heap_addr = thread_info.mcontext.gp_regs[8];
- #else
- #error This test has not been ported to this platform.
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-index 32634ef00..2a56948de 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
-@@ -136,7 +136,9 @@ class MinidumpWriter {
- : fd_(minidump_fd),
- path_(minidump_path),
- ucontext_(context ? &context->context : NULL),
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ vector_state_(context ? &context->vector_state : NULL),
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- float_state_(context ? &context->float_state : NULL),
- #endif
- dumper_(dumper),
-@@ -468,7 +470,9 @@ class MinidumpWriter {
- if (!cpu.Allocate())
- return false;
- my_memset(cpu.get(), 0, sizeof(RawContextCPU));
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ UContextReader::FillCPUContext(cpu.get(), ucontext_, vector_state_);
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- UContextReader::FillCPUContext(cpu.get(), ucontext_, float_state_);
- #else
- UContextReader::FillCPUContext(cpu.get(), ucontext_);
-@@ -897,7 +901,7 @@ class MinidumpWriter {
- dirent->location.rva = 0;
- }
-
--#if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || defined(__powerpc64__)
- bool WriteCPUInformation(MDRawSystemInfo* sys_info) {
- char vendor_id[sizeof(sys_info->cpu.x86_cpu_info.vendor_id) + 1] = {0};
- static const char vendor_id_name[] = "vendor_id";
-@@ -917,7 +921,9 @@ class MinidumpWriter {
-
- // processor_architecture should always be set, do this first
- sys_info->processor_architecture =
--#if defined(__mips__)
-+#if defined(__powerpc64__)
-+ MD_CPU_ARCHITECTURE_PPC64;
-+#elif defined(__mips__)
- # if _MIPS_SIM == _ABIO32
- MD_CPU_ARCHITECTURE_MIPS;
- # elif _MIPS_SIM == _ABI64
-@@ -1333,7 +1339,9 @@ class MinidumpWriter {
- const char* path_; // Path to the file where the minidum should be written.
-
- const ucontext_t* const ucontext_; // also from the signal handler
--#if !defined(__ARM_EABI__) && !defined(__mips__)
-+#if defined(__powerpc64__)
-+ const google_breakpad::vstate_t* const vector_state_;
-+#elif !defined(__ARM_EABI__) && !defined(__mips__)
- const google_breakpad::fpstate_t* const float_state_; // ditto
- #endif
- LinuxDumper* dumper_;
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-index e3b0b16da..ccd8aa0a4 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h
-@@ -48,6 +48,8 @@ class ExceptionHandler;
-
- #if defined(__aarch64__)
- typedef struct fpsimd_context fpstate_t;
-+#elif defined(__powerpc64__)
-+typedef vrregset_t vstate_t;
- #elif !defined(__ARM_EABI__) && !defined(__mips__)
- typedef std::remove_pointer<fpregset_t>::type fpstate_t;
- #endif
-diff --git a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-index d192e5cbb..fc1bfa8d7 100644
---- a/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc
-@@ -715,6 +715,9 @@ TEST(MinidumpWriterTest, InvalidStackPointer) {
- #elif defined(__mips__)
- context.context.uc_mcontext.gregs[MD_CONTEXT_MIPS_REG_SP] =
- invalid_stack_pointer;
-+#elif defined(__powerpc64__)
-+ context.context.uc_mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP] =
-+ invalid_stack_pointer;
- #else
- # error "This code has not been ported to your platform yet."
- #endif
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-index 99362945c..c54ba7145 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc
-@@ -65,8 +65,7 @@ bool MemoryMappedFile::Map(const char* path, size_t offset) {
- }
-
- #if defined(__x86_64__) || defined(__aarch64__) || \
-- (defined(__mips__) && _MIPS_SIM == _ABI64)
--
-+ (defined(__mips__) && _MIPS_SIM == _ABI64) || defined(__powerpc64__)
- struct kernel_stat st;
- if (sys_fstat(fd, &st) == -1 || st.st_size < 0) {
- #else
-diff --git a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-index fad59f40c..616496d67 100644
---- a/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc
-@@ -176,9 +176,10 @@ TEST_F(MemoryMappedFileTest, RemapAfterMap) {
- TEST_F(MemoryMappedFileTest, MapWithOffset) {
- // Put more data in the test file this time. Offsets can only be
- // done on page boundaries, so we need a two page file to test this.
-- const int page_size = 4096;
-- char data1[2 * page_size];
-- size_t data1_size = sizeof(data1);
-+ const int page_size = getpagesize();
-+ char *data1 = static_cast<char*>(malloc(2 * page_size));
-+ EXPECT_TRUE(data1 != NULL);
-+ size_t data1_size = (2 * page_size);
- for (size_t i = 0; i < data1_size; ++i) {
- data1[i] = i & 0x7f;
- }
-diff --git a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-index 5803b90d5..2a1cf14f0 100644
---- a/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc
-@@ -57,8 +57,9 @@ TEST(PageAllocatorTest, LargeObject) {
-
- EXPECT_EQ(0U, allocator.pages_allocated());
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(10000));
-+ uint64_t expected_pages = 1 + ((10000 - 1) / getpagesize());
- ASSERT_FALSE(p == NULL);
-- EXPECT_EQ(3U, allocator.pages_allocated());
-+ EXPECT_EQ(expected_pages, allocator.pages_allocated());
- for (unsigned i = 1; i < 10; ++i) {
- uint8_t* p = reinterpret_cast<uint8_t*>(allocator.Alloc(i));
- ASSERT_FALSE(p == NULL);
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-index 798056dfa..22bd81fff 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc
-@@ -202,12 +202,14 @@ bool ExploitabilityLinux::EndedOnIllegalWrite(uint64_t instruction_ptr) {
- // Check architecture and set architecture variable to corresponding flag
- // in objdump.
- switch (context->GetContextCPU()) {
-+#if defined(__i386) || defined(__x86_64)
- case MD_CONTEXT_X86:
- architecture = "i386";
- break;
- case MD_CONTEXT_AMD64:
- architecture = "i386:x86-64";
- break;
-+#endif
- default:
- // Unsupported architecture. Note that ARM architectures are not
- // supported because objdump does not support ARM.
-diff --git a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-index 528ee5f21..72764d6c1 100644
---- a/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-+++ b/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc
-@@ -104,6 +104,8 @@ ExploitabilityFor(const string& filename) {
- }
-
- TEST(ExploitabilityTest, TestWindowsEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("ascii_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -136,9 +138,12 @@ TEST(ExploitabilityTest, TestWindowsEngine) {
- ExploitabilityFor("read_av_clobber_write.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_LOW,
- ExploitabilityFor("read_av_conditional.dmp"));
-+#endif
- }
-
- TEST(ExploitabilityTest, TestLinuxEngine) {
-+// The following tests are only executable on an x86-class linux machine.
-+#if defined(__i386) || defined(__x86_64)
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_null_read_av.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -171,7 +176,8 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_executable_heap.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_jmp_to_module_not_exe_region.dmp"));
--#ifndef _WIN32
-+#endif
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
- ExploitabilityFor("linux_write_to_nonwritable_module.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_HIGH,
-@@ -182,10 +188,10 @@ TEST(ExploitabilityTest, TestLinuxEngine) {
- ExploitabilityFor("linux_write_to_outside_module_via_math.dmp"));
- ASSERT_EQ(google_breakpad::EXPLOITABILITY_INTERESTING,
- ExploitabilityFor("linux_write_to_under_4k.dmp"));
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (!defined(__i386) && !defined(__x86_64))
- }
-
--#ifndef _WIN32
-+#if !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
- TEST(ExploitabilityLinuxUtilsTest, DisassembleBytesTest) {
- ASSERT_FALSE(ExploitabilityLinuxTest::DisassembleBytes("", NULL, 5, NULL));
- uint8_t bytes[6] = {0xc7, 0x0, 0x5, 0x0, 0x0, 0x0};
-@@ -301,6 +307,7 @@ TEST(ExploitabilityLinuxUtilsTest, CalculateAddressTest) {
- context,
- &write_address));
- }
--#endif // _WIN32
-+#endif // !defined(_WIN32) && (defined(__i386) || defined(__x86_64))
-+
-
- } // namespace
-diff --git a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-index aade82c99..195aa73f3 100644
---- a/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-+++ b/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc
-@@ -77,6 +77,8 @@
- #define ELF_ARCH EM_MIPS
- #elif defined(__aarch64__)
- #define ELF_ARCH EM_AARCH64
-+#elif defined(__powerpc64__)
-+ #define ELF_ARCH EM_PPC64
- #endif
-
- #if defined(__arm__)
-@@ -87,6 +89,8 @@ typedef user_regs user_regs_struct;
- #elif defined (__mips__)
- // This file-local typedef simplifies the source code.
- typedef gregset_t user_regs_struct;
-+#elif defined(__powerpc64__)
-+typedef struct pt_regs user_regs_struct;
- #endif
-
- using google_breakpad::MDTypeHelper;
-@@ -321,6 +325,9 @@ struct CrashedProcess {
- #endif
- #if defined(__aarch64__)
- user_fpsimd_struct fpregs;
-+#endif
-+#if defined(__powerpc64__)
-+ mcontext_t mcontext;
- #endif
- uintptr_t stack_addr;
- const uint8_t* stack;
-@@ -535,6 +542,38 @@ ParseThreadRegisters(CrashedProcess::Thread* thread,
- thread->mcontext.fpc_eir = rawregs->float_save.fir;
- #endif
- }
-+#elif defined(__powerpc64__)
-+static void
-+ParseThreadRegisters(CrashedProcess::Thread* thread,
-+ const MinidumpMemoryRange& range) {
-+ const MDRawContextPPC64* rawregs = range.GetData<MDRawContextPPC64>(0);
-+
-+ for (int i = 0; i < MD_CONTEXT_PPC64_GPR_COUNT; i++)
-+ thread->mcontext.gp_regs[i] = rawregs->gpr[i];
-+
-+ thread->mcontext.gp_regs[PT_LNK] = rawregs->lr;
-+ thread->mcontext.gp_regs[PT_NIP] = rawregs->srr0;
-+ thread->mcontext.gp_regs[PT_MSR] = rawregs->srr1;
-+ thread->mcontext.gp_regs[PT_CCR] = rawregs->cr;
-+ thread->mcontext.gp_regs[PT_XER] = rawregs->xer;
-+ thread->mcontext.gp_regs[PT_CTR] = rawregs->ctr;
-+ thread->mcontext.v_regs->vrsave = rawregs->vrsave;
-+
-+ for (int i = 0; i < MD_FLOATINGSAVEAREA_PPC_FPR_COUNT; i++)
-+ thread->mcontext.fp_regs[i] = rawregs->float_save.fpregs[i];
-+
-+ thread->mcontext.fp_regs[NFPREG-1] = rawregs->float_save.fpscr;
-+
-+ for (int i = 0; i < MD_VECTORSAVEAREA_PPC_VR_COUNT; i++) {
-+ thread->mcontext.v_regs->vrregs[i][0] = rawregs->vector_save.save_vr[i].high >> 32;
-+ thread->mcontext.v_regs->vrregs[i][1] = rawregs->vector_save.save_vr[i].high;
-+ thread->mcontext.v_regs->vrregs[i][2] = rawregs->vector_save.save_vr[i].low >> 32;
-+ thread->mcontext.v_regs->vrregs[i][3] = rawregs->vector_save.save_vr[i].low;
-+ }
-+
-+ thread->mcontext.v_regs->vscr.vscr_word = rawregs->vector_save.save_vscr.low & 0xFFFFFFFF;
-+}
-+
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-@@ -623,6 +662,12 @@ ParseSystemInfo(const Options& options, CrashedProcess* crashinfo,
- # else
- # error "This mips ABI is currently not supported (n32)"
- # endif
-+#elif defined(__powerpc64__)
-+ if (sysinfo->processor_architecture != MD_CPU_ARCHITECTURE_PPC64) {
-+ fprintf(stderr,
-+ "This version of minidump-2-core only supports PPC64.\n");
-+ exit(1);
-+ }
- #else
- #error "This code has not been ported to your platform yet"
- #endif
-diff --git a/third_party/crashpad/crashpad/CONTRIBUTORS b/third_party/crashpad/crashpad/CONTRIBUTORS
-index 8724b7f32..8e29424ef 100644
---- a/third_party/crashpad/crashpad/CONTRIBUTORS
-+++ b/third_party/crashpad/crashpad/CONTRIBUTORS
-@@ -13,3 +13,4 @@ Mark Mentovai <mark@chromium.org>
- Robert Sesek <rsesek@chromium.org>
- Scott Graham <scottmg@chromium.org>
- Joshua Peraza <jperaza@chromium.org>
-+Shawn Anastasio <shawn@anastas.io>
-diff --git a/third_party/crashpad/crashpad/compat/linux/sys/user.h b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-index 6ed77a98e..1fd83469a 100644
---- a/third_party/crashpad/crashpad/compat/linux/sys/user.h
-+++ b/third_party/crashpad/crashpad/compat/linux/sys/user.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_COMPAT_LINUX_SYS_USER_H_
- #define CRASHPAD_COMPAT_LINUX_SYS_USER_H_
-
-+#include <cstddef>
- #include_next <sys/user.h>
-
- #include <features.h>
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context.h b/third_party/crashpad/crashpad/minidump/minidump_context.h
-index 3a3e603cb..3118d9e9f 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context.h
-@@ -592,6 +592,70 @@ struct MinidumpContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief ppc64-specific flags for MinidumpPPC64::context_flags
-+//! Based on minidump_cpu_ppc64.h from breakpad
-+enum MinidumpContextPPC64Flags : uint32_t {
-+ //! \brief Identifies the context as PPC64.
-+ kMinidumpContextPPC64 = 0x01000000,
-+
-+ //! \brief Indicates the validity of general purpose registers.
-+ //!
-+ //! Registers `r0`-`r31`, `nip`, `msr`, `lr`, etc. are valid.
-+ kMinidumpContextPPC64Base = kMinidumpContextPPC64 | 0x00000001,
-+
-+ //! \brief Indicates the validity of floating point registers.
-+ //!
-+ //! Registers `fp0`-`fp31`, `fpscr` are valid.
-+ kMinidumpContextPPC64Floating = kMinidumpContextPPC64 | 0x00000008,
-+
-+ //! \brief Indicates the validity of Altivec/VMX registers.
-+ //!
-+ //! Registers `v0`-`v31`, `vscr`, `vrsave`.
-+ kMinidumpContextPPC64Vector = kMinidumpContextPPC64 | 0x00000020,
-+
-+ //! \brief Indicates the validity of all registers
-+ kMinidumpContextPPC64All = kMinidumpContextPPC64Base |
-+ kMinidumpContextPPC64Floating |
-+ kMinidumpContextPPC64Vector
-+};
-+
-+//! \brief A PPC64 CPU context carried in a minidump file.
-+//! Based on minidump_cpu_ppc64.h from breakpad.
-+struct MinidumpContextPPC64 {
-+ uint64_t context_flags;
-+
-+ //! \brief General purpose registers.
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+
-+ //! \brief Floating point registers.
-+ double fpregs[32];
-+
-+ //! \brief FPU status register.
-+ double fpscr;
-+
-+ //! \brief Altivec/VMX vector registers.
-+ struct {
-+ //! \brief Vector registers are 128bits.
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad5[4];
-+
-+ //! \brief VRSAVE register.
-+ uint32_t save_vrsave;
-+
-+ //! \brief Padding included for breakpad compatibiltiy.
-+ uint32_t save_pad6[7];
-+ } vregs;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-index d7e53a493..d89eb9e01 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc
-@@ -101,6 +101,13 @@ MinidumpContextWriter::CreateFromSnapshot(const CPUContext* context_snapshot) {
- break;
- }
-
-+ case kCPUArchitecturePPC64: {
-+ context = std::make_unique<MinidumpContextPPC64Writer>();
-+ reinterpret_cast<MinidumpContextPPC64Writer*>(context.get())
-+ ->InitalizeFromSnapshot(context_snapshot->ppc64);
-+ break;
-+ }
-+
- default: {
- LOG(ERROR) << "unknown context architecture "
- << context_snapshot->architecture;
-@@ -453,4 +460,47 @@ size_t MinidumpContextMIPS64Writer::ContextSize() const {
- return sizeof(context_);
- }
-
-+MinidumpContextPPC64Writer::MinidumpContextPPC64Writer()
-+ : MinidumpContextWriter(), context_() {
-+ context_.context_flags = kMinidumpContextPPC64;
-+}
-+
-+MinidumpContextPPC64Writer::~MinidumpContextPPC64Writer() = default;
-+
-+void MinidumpContextPPC64Writer::InitalizeFromSnapshot(
-+ const CPUContextPPC64* context_snapshot) {
-+ DCHECK_EQ(state(), kStateMutable);
-+ DCHECK_EQ(context_.context_flags, kMinidumpContextPPC64);
-+
-+ context_.context_flags = kMinidumpContextPPC64All;
-+
-+ memcpy(context_.regs, context_snapshot->regs, sizeof(context_.regs));
-+ context_.nip = context_snapshot->nip;
-+ context_.msr = context_snapshot->msr;
-+ context_.ccr = context_snapshot->ccr;
-+ context_.xer = context_snapshot->xer;
-+ context_.lnk = context_snapshot->lnk;
-+ context_.ctr = context_snapshot->ctr;
-+
-+ memcpy(context_.fpregs, context_snapshot->fpregs, sizeof(context_.fpregs));
-+ context_.fpscr = context_snapshot->fpscr;
-+
-+ memcpy(context_.vregs.save_vr, context_snapshot->vregs.save_vr,
-+ sizeof(context_.vregs.save_vr));
-+ memcpy(&context_.vregs.save_vscr, &context_snapshot->vregs.save_vscr,
-+ sizeof(context_.vregs.save_vscr));
-+ context_.vregs.save_vrsave = context_snapshot->vregs.save_vrsave;
-+}
-+
-+bool MinidumpContextPPC64Writer::WriteObject(
-+ FileWriterInterface* file_writer) {
-+ DCHECK_EQ(state(), kStateWritable);
-+ return file_writer->Write(&context_, sizeof(context_));
-+}
-+
-+size_t MinidumpContextPPC64Writer::ContextSize() const {
-+ DCHECK_GE(state(), kStateFrozen);
-+ return sizeof(context_);
-+}
-+
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-index d4ab936ee..1d22fc59c 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer.h
-@@ -315,6 +315,43 @@ class MinidumpContextMIPS64Writer final : public MinidumpContextWriter {
- MinidumpContextMIPS64 context_;
- };
-
-+class MinidumpContextPPC64Writer final : public MinidumpContextWriter {
-+ public:
-+ MinidumpContextPPC64Writer();
-+ ~MinidumpContextPPC64Writer() override;
-+
-+ //! \brief Initalizes the MinidumpContextPPC64 based on \a context_snapshot.
-+ //!
-+ //! \param[in] context_snapshot The context snapshot to use as source data.
-+ //!
-+ //! \note Valid in #kStateMutable. No mutation of context() may be done before
-+ //! calling this method, and it is not normally necessary to alter
-+ //! context() after calling this method.
-+ void InitalizeFromSnapshot(const CPUContextPPC64* context_snapshot);
-+
-+ //! \brief Returns a pointer to the context structure that this object will
-+ //! write.
-+ //!
-+ //! \attention This returns a non-`const` pointer to this object’s private
-+ //! data so that a caller can populate the context structure directly.
-+ //! This is done because providing setter interfaces to each field in the
-+ //! context structure would be unwieldy and cumbersome. Care must be taken
-+ //! to populate the context structure correctly. The context structure
-+ //! must only be modified while this object is in the #kStateMutable
-+ //! state.
-+ MinidumpContextPPC64* context() { return &context_; }
-+
-+ protected:
-+ // MinidumpWritable:
-+ bool WriteObject(FileWriterInterface* file_writer) override;
-+
-+ // MinidumpContextWriter:
-+ size_t ContextSize() const override;
-+
-+ private:
-+ MinidumpContextPPC64 context_;
-+};
-+
- } // namespace crashpad
-
- #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_WRITER_H_
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-index 3216a906b..a9fcbe9d8 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc
-@@ -213,6 +213,21 @@ TEST(MinidumpContextWriter, MIPS64_FromSnapshot) {
- context, ExpectMinidumpContextMIPS64, kSeed);
- }
-
-+TEST(MinidumpContextWriter, PPC64_Zeros) {
-+ EmptyContextTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ ExpectMinidumpContextPPC64);
-+}
-+
-+TEST(MinidumpContextWriter, PPC64_FromSnapshot) {
-+ constexpr uint32_t kSeed = 64;
-+ CPUContextPPC64 context_ppc64;
-+ CPUContext context;
-+ context.ppc64 = &context_ppc64;
-+ InitializeCPUContextPPC64(&context, kSeed);
-+ FromSnapshotTest<MinidumpContextPPC64Writer, MinidumpContextPPC64>(
-+ context, ExpectMinidumpContextPPC64, kSeed);
-+}
-+
- } // namespace
- } // namespace test
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-index 0974e3ddf..b71ec5880 100644
---- a/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-+++ b/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
-@@ -135,6 +135,8 @@ std::string MinidumpMiscInfoDebugBuildString() {
- static constexpr char kCPU[] = "mips";
- #elif defined(ARCH_CPU_MIPS64EL)
- static constexpr char kCPU[] = "mips64";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kCPU[] = "ppc64";
- #else
- #error define kCPU for this CPU
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/capture_memory.cc b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-index 7a1b2763c..beda8da9e 100644
---- a/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-+++ b/third_party/crashpad/crashpad/snapshot/capture_memory.cc
-@@ -112,6 +112,11 @@ void CaptureMemory::PointedToByContext(const CPUContext& context,
- for (size_t i = 0; i < std::size(context.mipsel->regs); ++i) {
- MaybeCaptureMemoryAround(delegate, context.mipsel->regs[i]);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->nip);
-+ for (size_t i = 0; i < std::size(context.ppc64->regs); ++i) {
-+ MaybeCaptureMemoryAround(delegate, context.ppc64->regs[i]);
-+ }
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-index 811a72095..f4f83981d 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_architecture.h
-@@ -43,7 +43,10 @@ enum CPUArchitecture {
- kCPUArchitectureMIPSEL,
-
- //! \brief 64-bit MIPSEL.
-- kCPUArchitectureMIPS64EL
-+ kCPUArchitectureMIPS64EL,
-+
-+ //! \brief 64-bit PPC64.
-+ kCPUArchitecturePPC64
- };
-
- } // namespace crashpad
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.cc b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-index c75b5555e..aeade577a 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.cc
-@@ -169,6 +169,8 @@ uint64_t CPUContext::InstructionPointer() const {
- return arm->pc;
- case kCPUArchitectureARM64:
- return arm64->pc;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->nip;
- default:
- NOTREACHED();
- return ~0ull;
-@@ -185,6 +187,8 @@ uint64_t CPUContext::StackPointer() const {
- return arm->sp;
- case kCPUArchitectureARM64:
- return arm64->sp;
-+ case kCPUArchitecturePPC64:
-+ return ppc64->regs[1];
- default:
- NOTREACHED();
- return ~0ull;
-@@ -196,6 +200,7 @@ bool CPUContext::Is64Bit() const {
- case kCPUArchitectureX86_64:
- case kCPUArchitectureARM64:
- case kCPUArchitectureMIPS64EL:
-+ case kCPUArchitecturePPC64:
- return true;
- case kCPUArchitectureX86:
- case kCPUArchitectureARM:
-diff --git a/third_party/crashpad/crashpad/snapshot/cpu_context.h b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-index fb23c4679..eebede63c 100644
---- a/third_party/crashpad/crashpad/snapshot/cpu_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/cpu_context.h
-@@ -352,6 +352,24 @@ struct CPUContextMIPS64 {
- uint64_t fir;
- };
-
-+//! \brief A context structure carrying PPC64 CPU state.
-+struct CPUContextPPC64 {
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t regs[32];
-+ uint64_t ccr;
-+ uint64_t xer;
-+ uint64_t lnk;
-+ uint64_t ctr;
-+ double fpregs[32];
-+ double fpscr;
-+ struct {
-+ uint128_struct save_vr[32];
-+ uint128_struct save_vscr;
-+ uint32_t save_vrsave;
-+ } vregs;
-+};
-+
- //! \brief A context structure capable of carrying the context of any supported
- //! CPU architecture.
- struct CPUContext {
-@@ -382,6 +400,7 @@ struct CPUContext {
- CPUContextARM64* arm64;
- CPUContextMIPS* mipsel;
- CPUContextMIPS64* mips64;
-+ CPUContextPPC64* ppc64;
- };
- };
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-index 9f46a4897..aa677c4eb 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h
-@@ -15,6 +15,7 @@
- #ifndef CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
- #define CRASHPAD_SNAPSHOT_LINUX_CPU_CONTEXT_LINUX_H_
-
-+#include <cstring>
- #include "build/build_config.h"
- #include "snapshot/cpu_context.h"
- #include "snapshot/linux/signal_context.h"
-@@ -174,6 +175,78 @@ void InitializeCPUContextMIPS(
-
- #endif // ARCH_CPU_MIPS_FAMILY || DOXYGEN
-
-+#if defined(ARCH_CPU_PPC64_FAMILY) || DOXYGEN
-+
-+//! \brief Initalizes a CPUContextPPC64 structure from native context
-+//! structures on Linux.
-+//!
-+//! \param[in] thread_context The native thread context.
-+//! \param[in] float_context The native float context.
-+//! \param[in] vector_context The native vector context.
-+//! \param[out] context The CPUContextPPC64 structure to initalize.
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const ThreadContext::t64_t& thread_context,
-+ const FloatContext::f64_t& float_context,
-+ const VectorContext::v64_t& vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.gpr, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.fpregs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+template <typename Traits>
-+void InitializeCPUContextPPC64(
-+ const SignalThreadContext64 &thread_context,
-+ const SignalFloatContext64 &float_context,
-+ const SignalVectorContext64 &vector_context,
-+ typename Traits::CPUContext* context) {
-+
-+ memcpy(context->regs, thread_context.regs, sizeof(context->regs));
-+ context->nip = thread_context.nip;
-+ context->msr = thread_context.msr;
-+ context->ccr = thread_context.ccr;
-+ context->xer = thread_context.xer;
-+ context->lnk = thread_context.lnk;
-+ context->ctr = thread_context.ctr;
-+
-+ memcpy(context->fpregs, float_context.regs, sizeof(context->fpregs));
-+ context->fpscr = float_context.fpscr;
-+
-+ for (uint8_t i = 0; i < 32; i++) {
-+ context->vregs.save_vr[i] = {
-+ (((uint64_t)vector_context.vrregs[i][0]) << 32) |
-+ vector_context.vrregs[i][1],
-+ (((uint64_t)vector_context.vrregs[i][2]) << 32) |
-+ vector_context.vrregs[i][3]
-+ };
-+ }
-+ context->vregs.save_vrsave = vector_context.vrsave;
-+ context->vregs.save_vscr = {0, (uint64_t)vector_context.vscr.vscr_word};
-+}
-+
-+
-+#endif
-+
- } // namespace internal
- } // namespace crashpad
-
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-index d32bd1937..2dd538c2b 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc
-@@ -192,6 +192,8 @@ void TestAgainstTarget(PtraceConnection* connection) {
- device == 0 && inode == 0 && mapping_name == "[vdso]";
- #if defined(ARCH_CPU_X86)
- static constexpr char kPrefix[] = "linux-gate.so.";
-+#elif defined(ARCH_CPU_PPC64)
-+ static constexpr char kPrefix[] = "linux-vdso64.so.";
- #else
- static constexpr char kPrefix[] = "linux-vdso.so.";
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-index cd40b3b12..6bcf23b6f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc
-@@ -323,6 +323,69 @@ bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
- reader, context_address, context_.mips64);
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+template <typename Traits>
-+static bool ReadContext(ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address,
-+ typename Traits::CPUContext* dest_context) {
-+ const ProcessMemory* memory = reader->Memory();
-+
-+ LinuxVMAddress gp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, gp_regs);
-+
-+ typename Traits::SignalThreadContext thread_context;
-+ if (!memory->Read(gp_regs_address, sizeof(thread_context), &thread_context)) {
-+ LOG(ERROR) << "Couldn't read gp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress fp_regs_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, fp_regs);
-+
-+ typename Traits::SignalFloatContext fp_context;
-+ if (!memory->Read(fp_regs_address, sizeof(fp_context), &fp_context)) {
-+ LOG(ERROR) << "Couldn't read fp_regs!";
-+ return false;
-+ }
-+
-+ LinuxVMAddress v_regs_ptr_address = context_address +
-+ offsetof(UContext, mcontext) +
-+ offsetof(typename Traits::MContext, vmx_reserve) + 8;
-+
-+ typename Traits::SignalVectorContext v_context;
-+ if (!memory->Read(v_regs_ptr_address, sizeof(v_context), &v_context)) {
-+ LOG(ERROR) << "Couldn't read v_regs!";
-+ return false;
-+ }
-+
-+ InitializeCPUContextPPC64<ContextTraits64>(thread_context, fp_context,
-+ v_context, dest_context);
-+
-+ return true;
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits64>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+
-+ return internal::ReadContext<ContextTraits64>(
-+ reader, context_address, context_.ppc64);
-+}
-+
-+template<>
-+bool ExceptionSnapshotLinux::ReadContext<ContextTraits32>(
-+ ProcessReaderLinux* reader,
-+ LinuxVMAddress context_address) {
-+ // PPC64 is 64-bit
-+ return false;
-+}
-+
- #endif // ARCH_CPU_X86_FAMILY
-
- bool ExceptionSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-index ea0cd2106..e42df520f 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h
-@@ -84,6 +84,8 @@ class ExceptionSnapshotLinux final : public ExceptionSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #endif
- } context_union_;
- CPUContext context_;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-index c17170b43..b6a714cc6 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc
-@@ -296,7 +296,28 @@ void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
- 0);
- #undef CPU_ARCH_NAME
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+using NativeCPUContext = ucontext_t;
-+
-+void InitializeContext(NativeCPUContext* context) {
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ context->uc_mcontext.gp_regs[reg] = reg;
-+ }
-+
-+ memset(&context->uc_mcontext.fp_regs, 44,
-+ sizeof(context->uc_mcontext.fp_regs));
-+}
-
-+void ExpectContext(const CPUContext& actual, const NativeCPUContext& expected) {
-+ EXPECT_EQ(actual.architecture, kCPUArchitecturePPC64);
-+
-+ for (size_t reg = 0; reg < 32; ++reg) {
-+ EXPECT_EQ(actual.ppc64->regs[reg], expected.uc_mcontext.gp_regs[reg]);
-+ }
-+
-+ EXPECT_EQ(memcmp(actual.ppc64->fpregs, expected.uc_mcontext.fp_regs,
-+ sizeof(actual.ppc64->fpregs)), 0);
-+}
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-index ee246e8bc..9555dce04 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc
-@@ -108,6 +108,8 @@ void ProcessReaderLinux::Thread::InitializeStack(ProcessReaderLinux* reader) {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- stack_pointer = reader->Is64Bit() ? thread_info.thread_context.t64.regs[29]
- : thread_info.thread_context.t32.regs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ stack_pointer = thread_info.thread_context.t64.gpr[1];
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-index 110024680..a1f2da259 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/signal_context.h
-@@ -422,6 +422,89 @@ static_assert(offsetof(UContext<ContextTraits64>, mcontext.fpregs) ==
- "context offset mismatch");
- #endif
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+
-+struct SignalThreadContext64 {
-+ uint64_t regs[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_r3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
-+ uint64_t dscr;
-+ uint64_t fpr0[3];
-+};
-+
-+struct SignalFloatContext64 {
-+ double regs[32];
-+ double fpscr;
-+};
-+
-+struct SignalVectorContext64 {
-+ int32_t vrregs[32][4];
-+ struct {
-+ int32_t __pad[3];
-+ int32_t vscr_word;
-+ } vscr;
-+ int32_t vrsave;
-+ int32_t __pad[3];
-+} __attribute__((__aligned__(16)));
-+
-+
-+#pragma pack(pop)
-+struct MContext64 {
-+ uint64_t reserved[4];
-+ int32_t signal;
-+ int32_t __pad0;
-+ uint64_t handler;
-+ uint64_t oldmask;
-+ uint64_t pt_regs_ptr;
-+ SignalThreadContext64 gp_regs;
-+ SignalFloatContext64 fp_regs;
-+ SignalVectorContext64 *v_regs;
-+ int64_t vmx_reserve[69];
-+};
-+
-+struct ContextTraits64 : public Traits64 {
-+ using MContext = MContext64;
-+ using SignalThreadContext = SignalThreadContext64;
-+ using SignalFloatContext = SignalFloatContext64;
-+ using SignalVectorContext = SignalVectorContext64;
-+ using CPUContext = CPUContextPPC64;
-+};
-+
-+struct ContextTraits32 : public Traits32 {};
-+
-+struct UContext {
-+ uint64_t flags;
-+ uint64_t link;
-+ SignalStack<ContextTraits64> stack;
-+ Sigset<ContextTraits64> sigmask;
-+ MContext64 mcontext;
-+};
-+#pragma pack(push, 1)
-+
-+static_assert(sizeof(UContext) == sizeof(ucontext_t),
-+ "ucontext_t size mismatch");
-+static_assert(sizeof(MContext64) == sizeof(mcontext_t),
-+ "mcontext_t size mismatch");
-+static_assert(sizeof(SignalThreadContext64) == sizeof(gregset_t),
-+ "gregset_t size mismatch");
-+static_assert(sizeof(SignalFloatContext64) == sizeof(fpregset_t),
-+ "fpregset_t size mismatch");
-+static_assert(sizeof(SignalVectorContext64) == sizeof(vrregset_t),
-+ "vrregset_t size mismatch");
-+static_assert(offsetof(UContext, mcontext) ==
-+ offsetof(ucontext_t, uc_mcontext), "mcontext offset mismatch");
-+static_assert(offsetof(MContext64, gp_regs) ==
-+ offsetof(mcontext_t, gp_regs), "gp_regs offset mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-index a99da3e4b..03b973083 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc
-@@ -204,6 +204,8 @@ CPUArchitecture SystemSnapshotLinux::GetCPUArchitecture() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return process_reader_->Is64Bit() ? kCPUArchitectureMIPS64EL
- : kCPUArchitectureMIPSEL;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return kCPUArchitecturePPC64;
- #else
- #error port to your architecture
- #endif
-@@ -219,6 +221,9 @@ uint32_t SystemSnapshotLinux::CPURevision() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return 0;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return 0;
- #else
- #error port to your architecture
- #endif
-@@ -239,6 +244,9 @@ std::string SystemSnapshotLinux::CPUVendor() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return std::string();
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return std::string();
- #else
- #error port to your architecture
- #endif
-@@ -372,6 +380,9 @@ bool SystemSnapshotLinux::NXEnabled() const {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // Not implementable on MIPS
- return false;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Not yet implemented on PPC64
-+ return false;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-index b2450c206..7ba78b2ae 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/test_modules.cc
-@@ -110,6 +110,8 @@ bool WriteTestModule(const base::FilePath& module_path,
- module.ehdr.e_machine = EM_AARCH64;
- #elif defined(ARCH_CPU_MIPSEL) || defined(ARCH_CPU_MIPS64EL)
- module.ehdr.e_machine = EM_MIPS;
-+#elif defined(ARCH_CPU_PPC64)
-+ module.ehdr.e_machine = EM_PPC64;
- #endif
-
- module.ehdr.e_version = EV_CURRENT;
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-index e3e2bebdd..8ef43752e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc
-@@ -186,6 +186,14 @@ bool ThreadSnapshotLinux::Initialize(ProcessReaderLinux* process_reader,
- thread.thread_info.float_context.f32,
- context_.mipsel);
- }
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ context_.architecture = kCPUArchitecturePPC64;
-+ context_.ppc64 = &context_union_.ppc64;
-+ InitializeCPUContextPPC64<ContextTraits64>(
-+ thread.thread_info.thread_context.t64,
-+ thread.thread_info.float_context.f64,
-+ thread.thread_info.vector_context.v64,
-+ context_.ppc64);
- #else
- #error Port.
- #endif
-diff --git a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-index 44cc6f6d9..d4136461e 100644
---- a/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-+++ b/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h
-@@ -68,6 +68,8 @@ class ThreadSnapshotLinux final : public ThreadSnapshot {
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- CPUContextMIPS mipsel;
- CPUContextMIPS64 mips64;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ CPUContextPPC64 ppc64;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
---- a/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-+++ b/third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc
-@@ -236,6 +236,12 @@
- #elif defined(ARCH_CPU_BIG_ENDIAN)
- static constexpr char arch[] = "aarch64_be";
- #endif
-+#elif defined(__powerpc64__)
-+#if defined(ARCH_CPU_LITTLE_ENDIAN)
-+ static constexpr char arch[] = "ppc64le";
-+#elif defined(ARCH_CPU_BIG_ENDIAN)
-+ static constexpr char arch[] = "ppc64";
-+#endif
- #else
- #error Port
- #endif
-diff --git a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-index d3d5ebdfb..3fd730cb5 100644
---- a/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-+++ b/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc
-@@ -56,6 +56,11 @@ bool AuxiliaryVector::Read(PtraceConnection* connection) {
- if (type == AT_IGNORE) {
- continue;
- }
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ if (type == AT_IGNOREPPC) {
-+ continue;
-+ }
-+#endif
- if (!MapInsertOrReplace(&values_, type, value, nullptr)) {
- LOG(ERROR) << "duplicate auxv entry";
- return false;
-diff --git a/third_party/crashpad/crashpad/util/linux/ptracer.cc b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-index 557e0d363..08ae434b8 100644
---- a/third_party/crashpad/crashpad/util/linux/ptracer.cc
-+++ b/third_party/crashpad/crashpad/util/linux/ptracer.cc
-@@ -398,6 +398,64 @@ bool GetThreadArea64(pid_t tid,
- return true;
- }
-
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+// PPC64 has had HAVE_ARCH_TRACEHOOK set since 2.6.27 (even before x86 had it).
-+// That means we can simply use PTRACE_GETREGESET.
-+
-+template <typename Destination>
-+bool GetRegisterSet(pid_t tid, int set, Destination* dest, bool can_log) {
-+ iovec iov;
-+ iov.iov_base = reinterpret_cast<void*>(dest);
-+ iov.iov_len = sizeof(*dest);
-+ if (ptrace(PTRACE_GETREGSET, tid, reinterpret_cast<void*>(set), &iov) != 0) {
-+ PLOG_IF(ERROR, can_log) << "ptrace";
-+ return false;
-+ }
-+ if (iov.iov_len != sizeof(*dest)) {
-+ LOG_IF(ERROR, can_log) << "Unexpected registers size";
-+ return false;
-+ }
-+ return true;
-+}
-+
-+bool GetVectorRegisters64(pid_t tid,
-+ VectorContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PPC_VMX, &context->v64, can_log);
-+}
-+
-+bool GetFloatingPointRegisters64(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) {
-+ return GetRegisterSet(tid, NT_PRFPREG, &context->f64, can_log);
-+}
-+
-+bool GetThreadArea64(pid_t tid,
-+ const ThreadContext& context,
-+ LinuxVMAddress* address,
-+ bool can_log) {
-+ // PPC64 doesn't have PTRACE_GET_THREAD_AREA since the thread pointer
-+ // is stored in GPR 13.
-+ ThreadContext::t64_t tc;
-+ if (!GetRegisterSet(tid, NT_PRSTATUS, &tc, can_log)) {
-+ LOG_IF(ERROR, can_log) << "Unable to get thread pointer!";
-+ return false;
-+ }
-+
-+ *address = tc.gpr[13];
-+
-+ return true;
-+}
-+
-+// Stubs for 32-bit functions not applicable on PPC64
-+bool GetFloatingPointRegisters32(pid_t tid,
-+ FloatContext* context,
-+ bool can_log) { return false; }
-+bool GetThreadArea32(pid_t tid,
-+ const ThreadContext &context,
-+ LinuxVMAddress *address,
-+ bool can_log) { return false; }
-+
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -494,6 +552,9 @@ bool Ptracer::GetThreadInfo(pid_t tid, ThreadInfo* info) {
- if (is_64_bit_) {
- return GetGeneralPurposeRegisters64(tid, &info->thread_context, can_log_) &&
- GetFloatingPointRegisters64(tid, &info->float_context, can_log_) &&
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ GetVectorRegisters64(tid, &info->vector_context, can_log_) &&
-+#endif
- GetThreadArea64(tid,
- info->thread_context,
- &info->thread_specific_data_address,
-diff --git a/third_party/crashpad/crashpad/util/linux/thread_info.h b/third_party/crashpad/crashpad/util/linux/thread_info.h
-index 5b55c24a7..dea0d1f39 100644
---- a/third_party/crashpad/crashpad/util/linux/thread_info.h
-+++ b/third_party/crashpad/crashpad/util/linux/thread_info.h
-@@ -28,6 +28,10 @@
- #include <android/api-level.h>
- #endif
-
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+#include <sys/ucontext.h>
-+#endif
-+
- namespace crashpad {
-
- //! \brief The set of general purpose registers for an architecture family.
-@@ -79,6 +83,8 @@ union ThreadContext {
- uint32_t cp0_status;
- uint32_t cp0_cause;
- uint32_t padding1_;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // PPC64 is 64-bit
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -132,6 +138,21 @@ union ThreadContext {
- uint64_t cp0_badvaddr;
- uint64_t cp0_status;
- uint64_t cp0_cause;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects struct pt_regs in asm/ptrace.h.
-+ uint64_t gpr[32];
-+ uint64_t nip;
-+ uint64_t msr;
-+ uint64_t orig_gpr3;
-+ uint64_t ctr;
-+ uint64_t lnk;
-+ uint64_t xer;
-+ uint64_t ccr;
-+ uint64_t softe;
-+ uint64_t trap;
-+ uint64_t dar;
-+ uint64_t dsisr;
-+ uint64_t result;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -143,6 +164,8 @@ union ThreadContext {
- using NativeThreadContext = user_regs;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate NativeThreadsContext type available for MIPS
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ using NativeThreadContext = struct pt_regs;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY || ARCH_CPU_ARM64
-@@ -218,6 +241,9 @@ union FloatContext {
- } fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Crashpad's PPC support is 64-bit only, so this
-+ // 32bit-only struct is declared as empty.
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -252,6 +278,10 @@ union FloatContext {
- double fpregs[32];
- uint32_t fpcsr;
- uint32_t fpu_id;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects fpregset_t in sys/ucontext.h
-+ double fpregs[32];
-+ double fpscr;
- #else
- #error Port.
- #endif // ARCH_CPU_X86_FAMILY
-@@ -280,6 +310,8 @@ union FloatContext {
- static_assert(sizeof(f64) == sizeof(user_fpsimd_struct), "Size mismatch");
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- // No appropriate floating point context native type for available MIPS.
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ static_assert(sizeof(f64) == sizeof(fpregset_t), "Size mismatch");
- #else
- #error Port.
- #endif // ARCH_CPU_X86
-@@ -287,6 +319,26 @@ union FloatContext {
- static_assert(std::is_standard_layout<FloatContext>::value,
- "Not standard layout");
-
-+//! \brief The vector registers used for an architecture family
-+union VectorContext {
-+ struct v32_t {} v32;
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ __attribute__((__aligned__(16))) // Vector context must be doubleword aligned.
-+#endif
-+ struct v64_t {
-+#if defined(ARCH_CPU_PPC64_FAMILY)
-+ // Reflects vrregset_t in sys/ucontext.h
-+ uint32_t vrregs[32][4];
-+ struct {
-+ uint32_t __pad[3];
-+ uint32_t vscr_word;
-+ } vscr;
-+ uint32_t vrsave;
-+ uint32_t __pad[3];
-+#endif
-+ } v64;
-+};
-+
- //! \brief A collection of `ptrace`-able information about a thread.
- struct ThreadInfo {
- ThreadInfo();
-@@ -298,6 +350,9 @@ struct ThreadInfo {
- //! \brief The floating point registers for the thread.
- FloatContext float_context;
-
-+ //! \brief (Optional) The vector registers used for the thread.
-+ VectorContext vector_context;
-+
- //! \brief The thread-local storage address for the thread.
- LinuxVMAddress thread_specific_data_address;
- };
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context.h b/third_party/crashpad/crashpad/util/misc/capture_context.h
-index d21a24f19..acc325349 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context.h
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context.h
-@@ -69,6 +69,7 @@ using NativeCPUContext = ucontext_t;
- //! macOS/Linux/Fuchsia | x86_64 | `%%rdi`
- //! Linux | ARM/ARM64 | `r0`/`x0`
- //! Linux | MIPS/MIPS64 | `$a0`
-+//! Linux | PPC64 | `r3`
- //!
- //! Additionally, the value `LR` on ARM/ARM64 will be the return address of
- //! this function.
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-index 52215ee5d..b3e4a3ec7 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_linux.S
-@@ -32,7 +32,7 @@
- .balign 4, 0x0
- .type CAPTURECONTEXT_SYMBOL, %function
- .type CAPTURECONTEXT_SYMBOL2, %function
--#elif defined(__mips__)
-+#elif defined(__mips__) || defined(__powerpc64__)
- .balign 4, 0x0
- #endif
-
-@@ -423,4 +423,214 @@ CAPTURECONTEXT_SYMBOL2:
- jr $ra
-
- .set at
-+#elif defined(__powerpc64__)
-+ // Store r0-r31
-+ std 0, 0xe8(3) // context->uc_mcontext.gp_regs[0]
-+ std 1, 0xf0(3) // context->uc_mcontext.gp_regs[1]
-+ std 2, 0xf8(3) // context->uc_mcontext.gp_regs[2]
-+ // note that r3's original value was lost
-+ std 3, 0x100(3) // context->uc_mcontext.gp_regs[3]
-+ std 4, 0x108(3) // context->uc_mcontext.gp_regs[4]
-+ std 5, 0x110(3) // context->uc_mcontext.gp_regs[5]
-+ std 6, 0x118(3) // context->uc_mcontext.gp_regs[6]
-+ std 7, 0x120(3) // context->uc_mcontext.gp_regs[7]
-+ std 8, 0x128(3) // context->uc_mcontext.gp_regs[8]
-+ std 9, 0x130(3) // context->uc_mcontext.gp_regs[9]
-+ std 10, 0x138(3) // context->uc_mcontext.gp_regs[10]
-+ std 11, 0x140(3) // context->uc_mcontext.gp_regs[11]
-+ std 12, 0x148(3) // context->uc_mcontext.gp_regs[12]
-+ std 13, 0x150(3) // context->uc_mcontext.gp_regs[13]
-+ std 14, 0x158(3) // context->uc_mcontext.gp_regs[14]
-+ std 15, 0x160(3) // context->uc_mcontext.gp_regs[15]
-+ std 16, 0x168(3) // context->uc_mcontext.gp_regs[16]
-+ std 17, 0x170(3) // context->uc_mcontext.gp_regs[17]
-+ std 18, 0x178(3) // context->uc_mcontext.gp_regs[18]
-+ std 19, 0x180(3) // context->uc_mcontext.gp_regs[19]
-+ std 20, 0x188(3) // context->uc_mcontext.gp_regs[20]
-+ std 21, 0x190(3) // context->uc_mcontext.gp_regs[21]
-+ std 22, 0x198(3) // context->uc_mcontext.gp_regs[22]
-+ std 23, 0x1a0(3) // context->uc_mcontext.gp_regs[23]
-+ std 24, 0x1a8(3) // context->uc_mcontext.gp_regs[24]
-+ std 25, 0x1b0(3) // context->uc_mcontext.gp_regs[25]
-+ std 26, 0x1b8(3) // context->uc_mcontext.gp_regs[26]
-+ std 27, 0x1c0(3) // context->uc_mcontext.gp_regs[27]
-+ std 28, 0x1c8(3) // context->uc_mcontext.gp_regs[28]
-+ std 29, 0x1d0(3) // context->uc_mcontext.gp_regs[29]
-+ std 30, 0x1d8(3) // context->uc_mcontext.gp_regs[30]
-+ std 31, 0x1e0(3) // context->uc_mcontext.gp_regs[31]
-+
-+ // For NIP, we can use the value in the link register
-+ mflr 0
-+ std 0, 0x1e8(3) // context->uc_mcontext.gp_regs[PT_NIP]
-+
-+ // CTR
-+ mfctr 0
-+ std 0, 0x200(3) // context->uc_mcontext.gp_regs[PT_CTR]
-+
-+ // For LNK, we'll use the caller's LR save area (2 stack frames up).
-+ // r4 can be used as a scratch register since it has already been saved.
-+ ld 4, 0(1)
-+ ld 4, 16(4)
-+ std 4, 0x208(3) // context->uc_mcontext.gp_regs[PT_LNK]
-+
-+ // XER
-+ mfxer 0
-+ std 0, 0x210(3) // context->uc_mcontext.gp_regs[PT_XER]
-+
-+ // CCR
-+ mfcr 0
-+ std 0, 0x218(3) // context->uc_mcontext.gp_regs[PT_CCR]
-+
-+ // MSR, orig_r3, MQ, TRAP, DAR, DSISR, RESULT, DSCR,
-+ // not used or not relevant, zero them out.
-+ li 4, 0
-+ std 4, 0x1f0(3) // context->uc_mcontext.gp_regs[PT_MSR]
-+ std 4, 0x1f8(3) // context->uc_mcontext.gp_regs[PT_ORIG_R3]
-+ std 4, 0x220(3) // context->uc_mcontext.gp_regs[PT_MQ]
-+ std 4, 0x228(3) // context->uc_mcontext.gp_regs[PT_TRAP]
-+ std 4, 0x230(3) // context->uc_mcontext.gp_regs[PT_DAR]
-+ std 4, 0x238(3) // context->uc_mcontext.gp_regs[PT_DSISR]
-+ std 4, 0x240(3) // context->uc_mcontext.gp_regs[PT_RESULT]
-+ std 4, 0x248(3) // context->uc_mcontext.gp_regs[PT_DSCR]
-+
-+ // Update context->uc_mcontext.regs to point to gp_regs
-+ addi 0, 3, 0xe8
-+ std 0, 0xe0(3)
-+
-+ // Save floating point registers 0-31
-+ stfd 0, 0x268(3) // context->uc_mcontext.fp_regs[0]
-+ stfd 1, 0x270(3) // context->uc_mcontext.fp_regs[1]
-+ stfd 2, 0x278(3) // context->uc_mcontext.fp_regs[2]
-+ stfd 3, 0x280(3) // context->uc_mcontext.fp_regs[3]
-+ stfd 4, 0x288(3) // context->uc_mcontext.fp_regs[4]
-+ stfd 5, 0x290(3) // context->uc_mcontext.fp_regs[5]
-+ stfd 6, 0x298(3) // context->uc_mcontext.fp_regs[6]
-+ stfd 7, 0x2a0(3) // context->uc_mcontext.fp_regs[7]
-+ stfd 8, 0x2a8(3) // context->uc_mcontext.fp_regs[8]
-+ stfd 9, 0x2b0(3) // context->uc_mcontext.fp_regs[9]
-+ stfd 10, 0x2b8(3) // context->uc_mcontext.fp_regs[10]
-+ stfd 11, 0x2c0(3) // context->uc_mcontext.fp_regs[11]
-+ stfd 12, 0x2c8(3) // context->uc_mcontext.fp_regs[12]
-+ stfd 13, 0x2d0(3) // context->uc_mcontext.fp_regs[13]
-+ stfd 14, 0x2d8(3) // context->uc_mcontext.fp_regs[14]
-+ stfd 15, 0x2e0(3) // context->uc_mcontext.fp_regs[15]
-+ stfd 16, 0x2e8(3) // context->uc_mcontext.fp_regs[16]
-+ stfd 17, 0x2f0(3) // context->uc_mcontext.fp_regs[17]
-+ stfd 18, 0x2f8(3) // context->uc_mcontext.fp_regs[18]
-+ stfd 19, 0x300(3) // context->uc_mcontext.fp_regs[19]
-+ stfd 20, 0x308(3) // context->uc_mcontext.fp_regs[20]
-+ stfd 21, 0x310(3) // context->uc_mcontext.fp_regs[21]
-+ stfd 22, 0x318(3) // context->uc_mcontext.fp_regs[22]
-+ stfd 23, 0x320(3) // context->uc_mcontext.fp_regs[23]
-+ stfd 24, 0x328(3) // context->uc_mcontext.fp_regs[24]
-+ stfd 25, 0x330(3) // context->uc_mcontext.fp_regs[25]
-+ stfd 26, 0x338(3) // context->uc_mcontext.fp_regs[26]
-+ stfd 27, 0x340(3) // context->uc_mcontext.fp_regs[27]
-+ stfd 28, 0x348(3) // context->uc_mcontext.fp_regs[28]
-+ stfd 29, 0x350(3) // context->uc_mcontext.fp_regs[29]
-+ stfd 30, 0x358(3) // context->uc_mcontext.fp_regs[30]
-+ stfd 31, 0x360(3) // context->uc_mcontext.fp_regs[31]
-+
-+ // FPSCR
-+ mffs 0
-+ stfd 0, 0x368(3) // context->uc_mcontext.fp_regs[32]
-+
-+ // Save VMX Vector registers
-+ // Update r4 to contain the base address of vmx_reserve
-+ addi 4, 3, 0x378
-+ // Ensure that it is quadword aligned
-+ andi. 5, 4, 0xF
-+ beq 1f // No alignment is necessary
-+ // Address is doubleword aligned and not quadword aligned, add 8
-+ addi 4, 4, 8
-+
-+1:
-+ // Store VMX registers 0-31
-+ // r4 will contain the base address
-+ // r5 will contain the index
-+ li 5, 0
-+ stvx 0, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 0]
-+ addi 5, 5, 16
-+ stvx 1, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 1]
-+ addi 5, 5, 16
-+ stvx 2, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 2]
-+ addi 5, 5, 16
-+ stvx 3, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 3]
-+ addi 5, 5, 16
-+ stvx 4, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 4]
-+ addi 5, 5, 16
-+ stvx 5, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 5]
-+ addi 5, 5, 16
-+ stvx 6, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 6]
-+ addi 5, 5, 16
-+ stvx 7, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 7]
-+ addi 5, 5, 16
-+ stvx 8, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 8]
-+ addi 5, 5, 16
-+ stvx 9, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 9]
-+ addi 5, 5, 16
-+ stvx 10, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 10]
-+ addi 5, 5, 16
-+ stvx 11, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 11]
-+ addi 5, 5, 16
-+ stvx 12, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 12]
-+ addi 5, 5, 16
-+ stvx 13, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 13]
-+ addi 5, 5, 16
-+ stvx 14, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 14]
-+ addi 5, 5, 16
-+ stvx 15, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 15]
-+ addi 5, 5, 16
-+ stvx 16, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 16]
-+ addi 5, 5, 16
-+ stvx 17, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 17]
-+ addi 5, 5, 16
-+ stvx 18, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 18]
-+ addi 5, 5, 16
-+ stvx 19, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 19]
-+ addi 5, 5, 16
-+ stvx 20, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 20]
-+ addi 5, 5, 16
-+ stvx 21, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 21]
-+ addi 5, 5, 16
-+ stvx 22, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 22]
-+ addi 5, 5, 16
-+ stvx 23, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 23]
-+ addi 5, 5, 16
-+ stvx 24, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 24]
-+ addi 5, 5, 16
-+ stvx 25, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 25]
-+ addi 5, 5, 16
-+ stvx 26, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 26]
-+ addi 5, 5, 16
-+ stvx 27, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 27]
-+ addi 5, 5, 16
-+ stvx 28, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 28]
-+ addi 5, 5, 16
-+ stvx 29, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 29]
-+ addi 5, 5, 16
-+ stvx 30, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 30]
-+ addi 5, 5, 16
-+ stvx 31, 4, 5 // context->uc_mcontext.vmx_reserve[(align) + 31]
-+ addi 5, 5, 16
-+
-+ // VSCR
-+ mfvscr 0
-+ stvx 0, 4, 5
-+ addi 5, 5, 16
-+
-+ // VRSAVE
-+ mfvrsave 0
-+ stwx 0, 4, 5
-+
-+ // Update context->uc_mcontext.v_regs to point to vmx_reserve + alignment.
-+ std 4, 0x370(3)
-+
-+ // Zero out all unused fields
-+ li 4, 0
-+ std 4, 0xc8(3) // context->uc_mcontext.signal
-+ std 4, 0xd0(3) // context->uc_mcontext.handler
-+ std 4, 0xd8(3) // context->uc_mcontext.oldmask
-+
-+ blr
- #endif // __i386__
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-index cf23c2def..5f264bc92 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test.cc
-@@ -57,7 +57,7 @@ void TestCaptureContext() {
- uintptr_t pc = ProgramCounterFromContext(context_1);
-
- #if !defined(ADDRESS_SANITIZER) && !defined(ARCH_CPU_MIPS_FAMILY) && \
-- !defined(MEMORY_SANITIZER)
-+ !defined(MEMORY_SANITIZER) && !defined(ARCH_CPU_PPC64_FAMILY)
- // Sanitizers can cause enough code bloat that the “nearby” check would
- // likely fail.
- const uintptr_t kReferencePC =
-diff --git a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-index 30a2ab21d..60509f21d 100644
---- a/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-+++ b/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc
-@@ -35,6 +35,8 @@ void SanityCheckContext(const NativeCPUContext& context) {
- EXPECT_EQ(context.uc_mcontext.regs[0], FromPointerCast<uintptr_t>(&context));
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- EXPECT_EQ(context.uc_mcontext.gregs[4], FromPointerCast<uintptr_t>(&context));
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ EXPECT_EQ(context.uc_mcontext.gp_regs[3], FromPointerCast<uintptr_t>(&context));
- #endif
- }
-
-@@ -49,6 +51,8 @@ uintptr_t ProgramCounterFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.pc;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.pc;
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[PT_NIP];
- #endif
- }
-
-@@ -63,6 +67,8 @@ uintptr_t StackPointerFromContext(const NativeCPUContext& context) {
- return context.uc_mcontext.sp;
- #elif defined(ARCH_CPU_MIPS_FAMILY)
- return context.uc_mcontext.gregs[29];
-+#elif defined(ARCH_CPU_PPC64_FAMILY)
-+ return context.uc_mcontext.gp_regs[1];
- #endif
- }
-
-diff --git a/third_party/dav1d/config/linux/ppc64/config.h b/third_party/dav1d/config/linux/ppc64/config.h
-new file mode 100644
-index 000000000..9fbbf75cc
---- /dev/null
-+++ b/third_party/dav1d/config/linux/ppc64/config.h
-@@ -0,0 +1,39 @@
-+/*
-+ * Autogenerated by the Meson build system.
-+ * Do not edit, your changes will be lost.
-+ */
-+
-+#pragma once
-+
-+#define ARCH_AARCH64 0
-+
-+#define ARCH_ARM 0
-+
-+#define ARCH_PPC64LE 1
-+
-+#define ARCH_X86 0
-+
-+#define ARCH_X86_32 0
-+
-+#define ARCH_X86_64 0
-+
-+#define CONFIG_16BPC 1
-+
-+#define CONFIG_8BPC 1
-+
-+// #define CONFIG_LOG 1 -- Logging is controlled by Chromium
-+
-+#define ENDIANNESS_BIG 0
-+
-+#define HAVE_ASM 1
-+
-+#define HAVE_CLOCK_GETTIME 1
-+
-+#define HAVE_DLSYM 1
-+
-+#define HAVE_GETAUXVAL 1
-+
-+#define HAVE_POSIX_MEMALIGN 1
-+
-+#define HAVE_UNISTD_H 1
-+
-diff --git a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-index 0b4bd72f0..a0caa5e71 100644
---- a/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-+++ b/third_party/dav1d/libdav1d/src/ppc/dav1d_types.h
-@@ -51,4 +51,19 @@
- #define u16l_to_i32(v) ((i32x4) vec_mergel((u16x8) v, vec_splat_u16(0)))
- #define i16l_to_i32(v) ((i32x4) vec_unpackl((i16x8)v))
-
-+#if defined(__clang__)
-+#undef vec_splats
-+#define vec_splats(N) \
-+ _Generic((N), \
-+ unsigned char: ((u8x16)(N)), \
-+ signed char: ((i8x16)(N)), \
-+ unsigned short: ((u16x8)(N)), \
-+ signed short: ((i16x8)(N)), \
-+ unsigned int: ((u32x4)(N)), \
-+ signed int: ((i32x4)(N)), \
-+ unsigned long long: ((u64x2)(N)), \
-+ signed long long: ((i64x2)(N)) \
-+ )
-+#endif
-+
- #endif /* DAV1D_SRC_PPC_TYPES_H */
-diff --git a/third_party/eigen3/BUILD.gn b/third_party/eigen3/BUILD.gn
-index 0d4e184..f2ce484 100644
---- a/third_party/eigen3/BUILD.gn
-+++ b/third_party/eigen3/BUILD.gn
-@@ -22,4 +22,8 @@ config("eigen_includes") {
- # for this component on Windows on Arm due to compilation errors.
- defines += [ "EIGEN_DONT_VECTORIZE" ]
- }
-+
-+ if (target_cpu == "ppc64") {
-+ defines += [ "EIGEN_DONT_VECTORIZE" ]
-+ }
- }
-
-diff --git a/third_party/libaom/BUILD.gn b/third_party/libaom/BUILD.gn
-index 9b065bd..df3af02 100644
---- a/third_party/libaom/BUILD.gn
-+++ b/third_party/libaom/BUILD.gn
-@@ -40,6 +40,8 @@
- cpu_arch_full = "generic"
- } else if (current_cpu == "loong64") {
- cpu_arch_full = "generic"
-+} else if (current_cpu == "ppc64") {
-+ cpu_arch_full = "generic"
- } else {
- cpu_arch_full = current_cpu
- }
-diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h
-index e4ac22644..1c57015db 100644
---- a/third_party/lss/linux_syscall_support.h
-+++ b/third_party/lss/linux_syscall_support.h
-@@ -3947,7 +3947,7 @@ struct kernel_statfs {
- LSS_REG(2, buf);
- LSS_BODY(void*, mmap2, "0"(__r2));
- }
--#else
-+#elif !defined(__powerpc64__) /* ppc64 doesn't have mmap2 */
- #define __NR__mmap2 __NR_mmap2
- LSS_INLINE _syscall6(void*, _mmap2, void*, s,
- size_t, l, int, p,
-@@ -4058,7 +4058,7 @@ struct kernel_statfs {
- #if defined(__i386__) || \
- defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \
- (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \
-- defined(__PPC__) || \
-+ (defined(__PPC__) && !defined(__powerpc64__)) || \
- (defined(__s390__) && !defined(__s390x__))
- /* On these architectures, implement mmap() with mmap2(). */
- LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d,
-@@ -4872,11 +4872,11 @@ struct kernel_statx {
- LSS_SC_BODY(4, int, 8, d, type, protocol, sv);
- }
- #endif
-- #if defined(__NR_recvmsg)
-+ #if defined(__NR_recvmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, recvmsg, int, s, struct kernel_msghdr*, msg,
- int, flags)
- #endif
-- #if defined(__NR_sendmsg)
-+ #if defined(__NR_sendmsg) && !defined(__PPC__)
- LSS_INLINE _syscall3(ssize_t, sendmsg, int, s, const struct kernel_msghdr*,
- msg, int, flags)
- #endif
-@@ -4885,13 +4885,13 @@ struct kernel_statx {
- int, flags, const struct kernel_sockaddr*, to,
- unsigned int, tolen)
- #endif
-- #if defined(__NR_shutdown)
-+ #if defined(__NR_shutdown) && !defined(__PPC__)
- LSS_INLINE _syscall2(int, shutdown, int, s, int, how)
- #endif
-- #if defined(__NR_socket)
-+ #if defined(__NR_socket) && !defined(__PPC__)
- LSS_INLINE _syscall3(int, socket, int, domain, int, type, int, protocol)
- #endif
-- #if defined(__NR_socketpair)
-+ #if defined(__NR_socketpair) && !defined(__PPC__)
- LSS_INLINE _syscall4(int, socketpair, int, d, int, type, int, protocol,
- int*, sv)
- #endif
-diff --git a/third_party/pdfium/third_party/libpng16/pngpriv.h b/third_party/pdfium/third_party/libpng16/pngpriv.h
-index 583c26f..e03d697 100644
---- a/third_party/pdfium/third_party/libpng16/pngpriv.h
-+++ b/third_party/pdfium/third_party/libpng16/pngpriv.h
-@@ -196,11 +196,7 @@
- #endif
-
- #ifndef PNG_POWERPC_VSX_OPT
--# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
--# define PNG_POWERPC_VSX_OPT 2
--# else
--# define PNG_POWERPC_VSX_OPT 0
--# endif
-+# define PNG_POWERPC_VSX_OPT 0
- #endif
-
- #ifndef PNG_INTEL_SSE_OPT
-diff --git a/third_party/pffft/src/pffft.c b/third_party/pffft/src/pffft.c
-index bdac4d784..51e0f2cac 100644
---- a/third_party/pffft/src/pffft.c
-+++ b/third_party/pffft/src/pffft.c
-@@ -100,6 +100,7 @@
- Altivec support macros
- */
- #if !defined(PFFFT_SIMD_DISABLE) && (defined(__ppc__) || defined(__ppc64__))
-+#include <altivec.h>
- typedef vector float v4sf;
- # define SIMD_SZ 4
- # define VZERO() ((vector float) vec_splat_u8(0))
-diff --git a/third_party/sqlite/src/amalgamation/sqlite3.c b/third_party/sqlite/src/amalgamation/sqlite3.c
-index 6b4a7899d..b8c7fe414 100644
---- a/third_party/sqlite/src/amalgamation/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation/sqlite3.c
-@@ -14474,7 +14474,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/amalgamation_dev/sqlite3.c b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-index d30c9b7de..cf75a69d9 100644
---- a/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-+++ b/third_party/sqlite/src/amalgamation_dev/sqlite3.c
-@@ -14487,7 +14487,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/sqlite/src/ext/rtree/rtree.c b/third_party/sqlite/src/ext/rtree/rtree.c
-index f5b57a5e2..80a2d0ad8 100644
---- a/third_party/sqlite/src/ext/rtree/rtree.c
-+++ b/third_party/sqlite/src/ext/rtree/rtree.c
-@@ -450,7 +450,7 @@ struct RtreeMatchArg {
- #if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__arm__)
-+ defined(__arm__) || defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- #elif defined(sparc) || defined(__ppc__)
- # define SQLITE_BYTEORDER 4321
-diff --git a/third_party/sqlite/src/src/sqliteInt.h b/third_party/sqlite/src/src/sqliteInt.h
-index 245070d4f..b25164e95 100644
---- a/third_party/sqlite/src/src/sqliteInt.h
-+++ b/third_party/sqlite/src/src/sqliteInt.h
-@@ -877,7 +877,8 @@ typedef INT16_TYPE LogEst;
- # if defined(i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \
- defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \
-- defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64)
-+ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) || \
-+ defined(__powerpc64__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
- # define SQLITE_BYTEORDER 1234
- # elif defined(sparc) || defined(__ppc__) || \
- defined(__ARMEB__) || defined(__AARCH64EB__)
-diff --git a/third_party/webrtc/rtc_base/system/arch.h b/third_party/webrtc/rtc_base/system/arch.h
-index be2367b85..be4ee4233 100644
---- a/third_party/webrtc/rtc_base/system/arch.h
-+++ b/third_party/webrtc/rtc_base/system/arch.h
-@@ -79,6 +79,18 @@
- #elif defined(__EMSCRIPTEN__)
- #define WEBRTC_ARCH_32_BITS
- #define WEBRTC_ARCH_LITTLE_ENDIAN
-+#elif defined(__PPC__)
-+#define WEBRTC_ARCH_PPC_FAMILY
-+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-+#define WEBRTC_ARCH_LITTLE_ENDIAN
-+#else
-+#define WEBRTC_ARCH_BIG_ENDIAN
-+#endif
-+#if defined(__LP64__)
-+#define WEBRTC_ARCH_64_BITS
-+#else
-+#define WEBRTC_ARCH_32_BITS
-+#endif
- #else
- #error Please add support for your architecture in rtc_base/system/arch.h
- #endif
-diff --git a/v8/BUILD.gn b/v8/BUILD.gn
-index f39529a3a..e84fc449e 100644
---- a/v8/BUILD.gn
-+++ b/v8/BUILD.gn
-@@ -850,6 +850,12 @@ config("toolchain") {
- }
- if (host_byteorder == "little") {
- defines += [ "V8_TARGET_ARCH_PPC_LE" ]
-+ cflags += [
-+ # Enable usage of AltiVec, VSX, and other POWER8 and higher features
-+ "-mcpu=power8",
-+ "-maltivec",
-+ "-mvsx",
-+ ]
- } else if (host_byteorder == "big") {
- defines += [ "V8_TARGET_ARCH_PPC_BE" ]
- if (current_os == "aix") {
---- a/ui/gl/features.gni
-+++ b/ui/gl/features.gni
-@@ -33,5 +33,5 @@
- is_chromeos_ash || is_fuchsia) &&
- (target_cpu == "x86" || target_cpu == "x64" || target_cpu == "arm" ||
- target_cpu == "arm64" || target_cpu == "mipsel" ||
-- target_cpu == "mips64el" || target_cpu == "riscv64")
-+ target_cpu == "mips64el" || target_cpu == "riscv64" || target_cpu == "ppc64")
- }
-diff --git a/v8/test/BUILD.gn b/v8/test/BUILD.gn
-index fb872ad39..45fc585dd 100644
---- a/v8/test/BUILD.gn
-+++ b/v8/test/BUILD.gn
-@@ -42,7 +42,7 @@ group("gn_all") {
- "benchmarks/cpp:gn_all",
- "cctest:cctest",
- "unittests:generate-bytecode-expectations",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
- }
- }
-@@ -84,7 +84,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- "webkit:v8_webkit",
- ]
-
-@@ -109,7 +109,7 @@
- "message:v8_message",
- "mjsunit:v8_mjsunit",
- "mkgrokdump:mkgrokdump",
-- "unittests:unittests",
-+ #"unittests:unittests",
- ]
-
- if (v8_enable_webassembly) {
diff --git a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch b/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
deleted file mode 100644
index df453f491d8ce..0000000000000
--- a/srcpkgs/chromium/patches/xxx-ppc64le-swiftshader.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-+++ b/third_party/swiftshader/third_party/llvm-10.0/BUILD.gn
-@@ -574,6 +574,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCAsmInfoCOFF.cpp",
- "llvm/lib/MC/MCAsmInfoDarwin.cpp",
- "llvm/lib/MC/MCAsmInfoELF.cpp",
-+ "llvm/lib/MC/MCAsmInfoXCOFF.cpp",
- "llvm/lib/MC/MCAsmMacro.cpp",
- "llvm/lib/MC/MCAsmStreamer.cpp",
- "llvm/lib/MC/MCAssembler.cpp",
-@@ -629,6 +630,7 @@ swiftshader_llvm_source_set("swiftshader
- "llvm/lib/MC/MCWinCOFFStreamer.cpp",
- "llvm/lib/MC/MCWinEH.cpp",
- "llvm/lib/MC/MCXCOFFStreamer.cpp",
-+ "llvm/lib/MC/MCXCOFFObjectTargetWriter.cpp",
- "llvm/lib/MC/MachObjectWriter.cpp",
- "llvm/lib/MC/StringTableBuilder.cpp",
- "llvm/lib/MC/SubtargetFeature.cpp",
diff --git a/srcpkgs/chromium/template b/srcpkgs/chromium/template
index 7dea8bbe50d39..784b8a8c5d299 100644
--- a/srcpkgs/chromium/template
+++ b/srcpkgs/chromium/template
@@ -1,9 +1,9 @@
# Template file for 'chromium'
pkgname=chromium
# See https://chromiumdash.appspot.com/releases?platform=Linux for the latest version
-version=108.0.5359.124
+version=109.0.5414.74
revision=1
-archs="i686* x86_64* aarch64* armv7l* ppc64le*"
+archs="i686* x86_64* aarch64* armv7l*"
hostmakedepends="
$(vopt_if clang "clang lld llvm12")
$(vopt_if js_optimize openjdk)
@@ -28,7 +28,7 @@ maintainer="Duncaen <duncaen@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://www.chromium.org/"
distfiles="https://commondatastorage.googleapis.com/chromium-browser-official/${pkgname}-${version}.tar.xz"
-checksum=d48dfac2a61b14a5d7d2f460b09b70ef3ab88e27b82e3173938cb54eaa612a75
+checksum=eded233c26ab631be325ad49cb306c338513b6a6528197d42653e66187548e5d
lib32disabled=yes
@@ -39,10 +39,9 @@ desc_option_debug="Build with debug symbols"
desc_option_js_optimize="Optimize the JS used for Chromium's UI"
desc_option_pipewire="Enable support for screen sharing for WebRTC via PipeWire"
-
-case "$XBPS_TARGET_MACHINE" in
- ppc64*-musl) makedepends+=" libucontext-devel" ;;
-esac
+if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+ makedepends+=" musl-legacy-compat"
+fi
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" libX11-devel libxcb-devel pciutils-devel libXext-devel libglvnd-devel
@@ -135,20 +134,6 @@ do_configure() {
CFLAGS=$CFLAGS_FOR_BUILD CXXFLAGS=$CXXFLAGS_FOR_BUILD LDFLAGS=$LDFLAGS_FOR_BUILD \
tools/gn/bootstrap/bootstrap.py --skip-generate-buildfiles
- # we need to generate ppc64 stuff for libvpx as it's not shipped
- # this has to be done before unbundling, but after gn is built
- # comment out if we switch back to system libvpx again later
- case "$XBPS_TARGET_MACHINE" in
- ppc64*)
- pushd third_party/libvpx
- mkdir -p source/config/linux/ppc64
- # need PATH to find gn
- PATH="${wrksrc}/out/Release:$PATH" ./generate_gni.sh || \
- msg_error "failed to generate libvpx gni"
- popd
- ;;
- esac
-
# Use system-provided libraries.
# TODO: use_system_hunspell (upstream changes needed).
# TODO: use_system_libsrtp.
@@ -220,9 +205,6 @@ do_configure() {
'icu_use_data_file=true'
- 'use_allocator="none"'
- 'use_allocator_shim=false'
-
'enable_widevine=true'
'enable_hangout_services_extension=true'
@@ -286,11 +268,6 @@ do_configure() {
)
fi
- # this does not work on ppc64 yet
- case "$XBPS_TARGET_MACHINE" in
- ppc64*) conf+=( "enable_jxl_decoder=false" );;
- esac
-
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
conf+=( 'is_musl=true' )
fi
@@ -300,7 +277,6 @@ do_configure() {
i686*) conf+=( 'target_cpu="x86"' ) ;;
arm*) conf+=( 'target_cpu="arm"' ) ;;
aarch64*) conf+=( 'target_cpu="arm64"' ) ;;
- ppc64*) conf+=( 'target_cpu="ppc64"' ) ;;
esac
if [ "$CROSS_BUILD" ]; then
@@ -309,7 +285,6 @@ do_configure() {
i686*) conf+=( 'host_cpu="x86"' ) ;;
arm*) conf+=( 'host_cpu="arm"' ) ;;
aarch64*) conf+=( 'host_cpu="arm64"' ) ;;
- ppc64*) conf+=( 'host_cpu="ppc64"' ) ;;
esac
fi
_setup_toolchain
@@ -318,13 +293,13 @@ do_configure() {
do_build() {
_setup_toolchain
- CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver chrome_crashpad_handler
+ CCACHE_SLOPPINESS=include_file_mtime ninja -C out/Release ${makejobs} chrome chromedriver.unstripped chrome_crashpad_handler
}
do_install() {
vinstall out/Release/chrome 755 usr/lib/${pkgname} ${pkgname}
vinstall out/Release/chrome_crashpad_handler 755 usr/lib/${pkgname} chrome_crashpad_handler
- vinstall out/Release/chromedriver 755 usr/lib/${pkgname} chromedriver
+ vinstall out/Release/chromedriver.unstripped 755 usr/lib/${pkgname} chromedriver
vinstall out/Release/libEGL.so 755 usr/lib/${pkgname} libEGL.so
vinstall out/Release/libGLESv2.so 755 usr/lib/${pkgname} libGLESv2.so
vinstall out/Release/libvk_swiftshader.so 755 usr/lib/${pkgname} libvk_swiftshader.so
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Merged]: chromium: update to 109.0.5414.74.
2023-01-11 1:12 [PR PATCH] chromium: update to 109.0.5414.74 Duncaen
` (7 preceding siblings ...)
2023-01-12 20:44 ` Duncaen
@ 2023-01-12 20:45 ` Duncaen
8 siblings, 0 replies; 10+ messages in thread
From: Duncaen @ 2023-01-12 20:45 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 250 bytes --]
There's a merged pull request on the void-packages repository
chromium: update to 109.0.5414.74.
https://github.com/void-linux/void-packages/pull/41570
Description:
[ci skip]
* [x] x86_64-glibc
* [x] x86_64-musl
* [ ] aarch64-musl
* [ ] i686
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-01-12 20:45 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-11 1:12 [PR PATCH] chromium: update to 109.0.5414.74 Duncaen
2023-01-11 14:05 ` [PR PATCH] [Updated] " Duncaen
2023-01-11 14:05 ` Duncaen
2023-01-11 14:18 ` Duncaen
2023-01-11 14:53 ` Duncaen
2023-01-11 17:20 ` Duncaen
2023-01-11 17:41 ` Duncaen
2023-01-12 20:38 ` Duncaen
2023-01-12 20:44 ` Duncaen
2023-01-12 20:45 ` [PR PATCH] [Merged]: " Duncaen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).