From 96e307c4599af8c23027c6efc8b8728ca7858902 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 15 Oct 2019 13:19:43 +0200 Subject: [PATCH] New package: qt5-webengine-5.14.2 --- srcpkgs/qt5-webengine-devel | 2 +- srcpkgs/qt5-webengine/files/resolv_compat.h | 29 + ...te-instead-of-_libc_fpstate-on-linux.patch | 42 + ...reg.h-to-get-__WORDSIZE-on-musl-libc.patch | 26 + .../patches/0003-musl-dispatch-to-musl.patch | 103 + .../patches/0004-musl-no-mallinfo.patch | 40 + .../patches/0005-musl-off_t.patch | 10 + .../patches/0006-musl-pread-pwrite.patch | 18 + .../patches/0007-musl-replace-pvalloc.patch | 14 + .../patches/0008-musl-resolve.patch | 26 + .../patches/0009-musl-siginfo_t.patch | 18 + .../patches/0010-musl-stackstart.patch | 20 + .../patches/0011-musl-sandbox.patch | 71 + ...0012-musl-chromium-default-stacksize.patch | 15 + .../0014-musl-cross-no-asm_ptrace_h.patch | 30 + .../qt5-webengine/patches/0015-yasm-nls.patch | 13 + .../patches/0016-qt-musl-execinfo.patch | 94 + .../0017-qt-musl-thread-stacksize.patch | 26 + .../patches/0018-sandbox-membarrier.patch | 60 + .../patches/0019-gn-cross-sysroot.patch | 24 + .../patches/0020-msgvec-push_back.patch | 14 + .../patches/0021-sandbox-sched_getparam.patch | 24 + .../0022-canonicalize-file-name-musl.patch | 11 + .../patches/0090-chromium-ppc64le.patch | 4048 +++++++++++++++++ srcpkgs/qt5-webengine/template | 160 + 25 files changed, 4937 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/qt5-webengine/files/resolv_compat.h create mode 100644 srcpkgs/qt5-webengine/patches/0001-Use-_fpstate-instead-of-_libc_fpstate-on-linux.patch create mode 100644 srcpkgs/qt5-webengine/patches/0002-include-sys-reg.h-to-get-__WORDSIZE-on-musl-libc.patch create mode 100644 srcpkgs/qt5-webengine/patches/0003-musl-dispatch-to-musl.patch create mode 100644 srcpkgs/qt5-webengine/patches/0004-musl-no-mallinfo.patch create mode 100644 srcpkgs/qt5-webengine/patches/0005-musl-off_t.patch create mode 100644 srcpkgs/qt5-webengine/patches/0006-musl-pread-pwrite.patch create mode 100644 srcpkgs/qt5-webengine/patches/0007-musl-replace-pvalloc.patch create mode 100644 srcpkgs/qt5-webengine/patches/0008-musl-resolve.patch create mode 100644 srcpkgs/qt5-webengine/patches/0009-musl-siginfo_t.patch create mode 100644 srcpkgs/qt5-webengine/patches/0010-musl-stackstart.patch create mode 100644 srcpkgs/qt5-webengine/patches/0011-musl-sandbox.patch create mode 100644 srcpkgs/qt5-webengine/patches/0012-musl-chromium-default-stacksize.patch create mode 100644 srcpkgs/qt5-webengine/patches/0014-musl-cross-no-asm_ptrace_h.patch create mode 100644 srcpkgs/qt5-webengine/patches/0015-yasm-nls.patch create mode 100644 srcpkgs/qt5-webengine/patches/0016-qt-musl-execinfo.patch create mode 100644 srcpkgs/qt5-webengine/patches/0017-qt-musl-thread-stacksize.patch create mode 100644 srcpkgs/qt5-webengine/patches/0018-sandbox-membarrier.patch create mode 100644 srcpkgs/qt5-webengine/patches/0019-gn-cross-sysroot.patch create mode 100644 srcpkgs/qt5-webengine/patches/0020-msgvec-push_back.patch create mode 100644 srcpkgs/qt5-webengine/patches/0021-sandbox-sched_getparam.patch create mode 100644 srcpkgs/qt5-webengine/patches/0022-canonicalize-file-name-musl.patch create mode 100644 srcpkgs/qt5-webengine/patches/0090-chromium-ppc64le.patch create mode 100644 srcpkgs/qt5-webengine/template diff --git a/srcpkgs/qt5-webengine-devel b/srcpkgs/qt5-webengine-devel index 75793eb666..1bfdef1108 120000 --- a/srcpkgs/qt5-webengine-devel +++ b/srcpkgs/qt5-webengine-devel @@ -1 +1 @@ -qt5 \ No newline at end of file +qt5-webengine \ No newline at end of file diff --git a/srcpkgs/qt5-webengine/files/resolv_compat.h b/srcpkgs/qt5-webengine/files/resolv_compat.h new file mode 100644 index 0000000000..4f0e852a19 --- /dev/null +++ b/srcpkgs/qt5-webengine/files/resolv_compat.h @@ -0,0 +1,29 @@ +#if !defined(__GLIBC__) +/*************************************************************************** + * resolv_compat.h + * + * Mimick GLIBC's res_ninit() and res_nclose() for musl libc + * Note: res_init() is actually deprecated according to + * http://docs.oracle.com/cd/E36784_01/html/E36875/res-nclose-3resolv.html + **************************************************************************/ +#include + +static inline int res_ninit(res_state statp) +{ + int rc = res_init(); + if (statp != &_res) { + memcpy(statp, &_res, sizeof(*statp)); + } + return rc; +} + +static inline int res_nclose(res_state statp) +{ + if (!statp) + return -1; + if (statp != &_res) { + memset(statp, 0, sizeof(*statp)); + } + return 0; +} +#endif diff --git a/srcpkgs/qt5-webengine/patches/0001-Use-_fpstate-instead-of-_libc_fpstate-on-linux.patch b/srcpkgs/qt5-webengine/patches/0001-Use-_fpstate-instead-of-_libc_fpstate-on-linux.patch new file mode 100644 index 0000000000..3e787d1374 --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0001-Use-_fpstate-instead-of-_libc_fpstate-on-linux.patch @@ -0,0 +1,42 @@ +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h 2018-06-15 09:47:20.000000000 +0200 ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h 2018-09-07 22:21:28.521763716 +0200 +@@ -50,7 +50,7 @@ + // info: the collection of register structures. + #if defined(__i386__) || defined(__x86_64) + static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc, +- const struct _libc_fpstate* fp); ++ const struct _fpstate* fp); + #elif defined(__aarch64__) + static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc, + const struct fpsimd_context* fpregs); +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc 2018-06-15 09:47:20.000000000 +0200 ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc 2018-09-07 22:21:45.766762688 +0200 +@@ -49,7 +49,7 @@ + } + + void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc, +- const struct _libc_fpstate* fp) { ++ const struct _fpstate* fp) { + const greg_t* regs = uc->uc_mcontext.gregs; + + out->context_flags = MD_CONTEXT_X86_FULL | +@@ -97,7 +97,7 @@ + } + + void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc, +- const struct _libc_fpstate* fpregs) { ++ const struct _fpstate* fpregs) { + const greg_t* regs = uc->uc_mcontext.gregs; + + out->context_flags = MD_CONTEXT_AMD64_FULL; +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h 2018-06-15 09:47:20.000000000 +0200 ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h 2018-09-07 23:36:32.049495285 +0200 +@@ -48,7 +48,7 @@ + #if defined(__aarch64__) + typedef struct fpsimd_context fpstate_t; + #elif !defined(__ARM_EABI__) && !defined(__mips__) +-typedef struct _libc_fpstate fpstate_t; ++typedef struct _fpstate fpstate_t; + #endif + + // These entries store a list of memory regions that the client wants included diff --git a/srcpkgs/qt5-webengine/patches/0002-include-sys-reg.h-to-get-__WORDSIZE-on-musl-libc.patch b/srcpkgs/qt5-webengine/patches/0002-include-sys-reg.h-to-get-__WORDSIZE-on-musl-libc.patch new file mode 100644 index 0000000000..da4160b21b --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0002-include-sys-reg.h-to-get-__WORDSIZE-on-musl-libc.patch @@ -0,0 +1,26 @@ +From 9001c54d6b974449174a8cee8f3f5d78a9bd6c9e Mon Sep 17 00:00:00 2001 +From: Felix Janda +Date: Sun, 1 Feb 2015 14:26:52 +0100 +Subject: [PATCH 3/6] include to get __WORDSIZE on musl libc + +--- + qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/common/linux/elf_core_dump.h b/src/common/linux/elf_core_dump.h +index d03c7a8..02eb391 100644 +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h +@@ -36,6 +36,9 @@ + #include + #include + #include ++#ifndef __GLIBC__ ++#include ++#endif + + #include "common/memory_range.h" + +-- +2.0.5 + diff --git a/srcpkgs/qt5-webengine/patches/0003-musl-dispatch-to-musl.patch b/srcpkgs/qt5-webengine/patches/0003-musl-dispatch-to-musl.patch new file mode 100644 index 0000000000..de32a3dab9 --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0003-musl-dispatch-to-musl.patch @@ -0,0 +1,103 @@ +--- qtwebengine/src/3rdparty/chromium/base/allocator/allocator_shim_default_dispatch_to_glibc.cc +--- qtwebengine/src/3rdparty/chromium/base/allocator/allocator_shim_default_dispatch_to_glibc.cc +@@ -6,6 +6,7 @@ + + #include + ++#if defined(__GLIBC__) + // This translation unit defines a default dispatch for the allocator shim which + // routes allocations to libc functions. + // The code here is strongly inspired from tcmalloc's libc_override_glibc.h. +@@ -73,3 +74,92 @@ const AllocatorDispatch AllocatorDispatch::default_dispatch = { + nullptr, /* free_definite_size_function */ + nullptr, /* next */ + }; ++ ++#else // defined(__GLIBC__) ++ ++#include ++ ++extern "C" { ++// Declare function pointers to the memory functions ++typedef void* (*t_libc_malloc)(size_t size); ++typedef void* (*t_libc_calloc)(size_t n, size_t size); ++typedef void* (*t_libc_realloc)(void* address, size_t size); ++typedef void* (*t_libc_memalign)(size_t alignment, size_t size); ++typedef void (*t_libc_free)(void* ptr); ++typedef size_t (*t_libc_malloc_usable_size)(void* ptr); ++ ++// Static instances of pointers to libc.so dl symbols ++static t_libc_malloc libc_malloc = NULL; ++static t_libc_calloc libc_calloc = NULL; ++static t_libc_realloc libc_realloc = NULL; ++static t_libc_memalign libc_memalign = NULL; ++static t_libc_free libc_free = NULL; ++static t_libc_malloc_usable_size libc_malloc_usable_size = NULL; ++ ++// resolve the symbols in libc.so ++void musl_libc_memory_init(void) ++{ ++ libc_malloc = (t_libc_malloc) dlsym(RTLD_NEXT, "malloc"); ++ libc_calloc = (t_libc_calloc) dlsym(RTLD_NEXT, "calloc"); ++ libc_realloc = (t_libc_realloc) dlsym(RTLD_NEXT, "realloc"); ++ libc_memalign = (t_libc_memalign) dlsym(RTLD_NEXT, "memalign"); ++ libc_free = (t_libc_free) dlsym(RTLD_NEXT, "free"); ++ libc_malloc_usable_size = (t_libc_malloc_usable_size) dlsym(RTLD_NEXT, "malloc_usable_size"); ++} ++} // extern "C" ++ ++namespace { ++ ++using base::allocator::AllocatorDispatch; ++ ++void* MuslMalloc(const AllocatorDispatch*, size_t size, void* context) { ++ if (!libc_malloc) ++ musl_libc_memory_init(); ++ return (*libc_malloc)(size); ++} ++ ++void* MuslCalloc(const AllocatorDispatch*, size_t n, size_t size, void* context) { ++ if (!libc_calloc) ++ musl_libc_memory_init(); ++ return (*libc_calloc)(n, size); ++} ++ ++void* MuslRealloc(const AllocatorDispatch*, void* address, size_t size, void* context) { ++ if (!libc_realloc) ++ musl_libc_memory_init(); ++ return (*libc_realloc)(address, size); ++} ++ ++void* MuslMemalign(const AllocatorDispatch*, size_t alignment, size_t size, void* context) { ++ if (!libc_memalign) ++ musl_libc_memory_init(); ++ return (*libc_memalign)(alignment, size); ++} ++ ++void MuslFree(const AllocatorDispatch*, void* address, void* context) { ++ if (!libc_free) ++ musl_libc_memory_init(); ++ (*libc_free)(address); ++} ++ ++size_t MuslGetSizeEstimate(const AllocatorDispatch*, void* address, void* context) { ++ // TODO(siggi, primiano): malloc_usable_size may need redirection in the ++ // presence of interposing shims that divert allocations. ++ if (!libc_malloc_usable_size) ++ musl_libc_memory_init(); ++ return (*libc_malloc_usable_size)(address); ++} ++ ++} // namespace ++ ++const AllocatorDispatch AllocatorDispatch::default_dispatch = { ++ &MuslMalloc, /* alloc_function */ ++ &MuslCalloc, /* alloc_zero_initialized_function */ ++ &MuslMemalign, /* alloc_aligned_function */ ++ &MuslRealloc, /* realloc_function */ ++ &MuslFree, /* free_function */ ++ &MuslGetSizeEstimate, /* get_size_estimate_function */ ++ nullptr, /* next */ ++}; ++ ++#endif diff --git a/srcpkgs/qt5-webengine/patches/0004-musl-no-mallinfo.patch b/srcpkgs/qt5-webengine/patches/0004-musl-no-mallinfo.patch new file mode 100644 index 0000000000..c332b92b69 --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0004-musl-no-mallinfo.patch @@ -0,0 +1,40 @@ +--- qtwebengine/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc 2017-11-28 14:06:53.000000000 +0100 ++++ qtwebengine/src/3rdparty/chromium/base/trace_event/malloc_dump_provider.cc 2018-01-27 20:13:26.960932805 +0100 +@@ -243,7 +243,7 @@ + allocated_objects_count = main_heap_info.block_count; + #elif defined(OS_FUCHSIA) + // TODO(fuchsia): Port, see https://crbug.com/706592. +-#else ++#elif defined(__GLIBC__) + struct mallinfo info = mallinfo(); + DCHECK_GE(info.arena + info.hblkhd, info.uordblks); + +@@ -255,6 +255,8 @@ + + // Total allocated space is given by |uordblks|. + allocated_objects_size = info.uordblks; ++#else ++// musl libc does not support mallinfo() + #endif + + MemoryAllocatorDump* outer_dump = pmd->CreateAllocatorDump("malloc"); +--- qtwebengine/src/3rdparty/chromium/base/process/process_metrics_posix.cc 2017-11-28 14:06:53.000000000 +0100 ++++ qtwebengine/src/3rdparty/chromium/base/process/process_metrics_posix.cc 2018-01-27 20:48:11.571040348 +0100 +@@ -100,14 +100,14 @@ + malloc_statistics_t stats = {0}; + malloc_zone_statistics(nullptr, &stats); + return stats.size_in_use; +-#elif defined(OS_LINUX) || defined(OS_ANDROID) ++#elif (defined(OS_LINUX) && defined(__GLIBC__)) || defined(OS_ANDROID) + struct mallinfo minfo = mallinfo(); + #if defined(USE_TCMALLOC) + return minfo.uordblks; + #else + return minfo.hblkhd + minfo.arena; + #endif +-#elif defined(OS_FUCHSIA) ++#else //if defined(OS_FUCHSIA) // also musl doesn't do this. + // TODO(fuchsia): Not currently exposed. https://crbug.com/735087. + return 0; + #endif + diff --git a/srcpkgs/qt5-webengine/patches/0005-musl-off_t.patch b/srcpkgs/qt5-webengine/patches/0005-musl-off_t.patch new file mode 100644 index 0000000000..52db3b9ebf --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0005-musl-off_t.patch @@ -0,0 +1,10 @@ +--- qtwebengine/src/3rdparty/chromium/third_party/ots/include/opentype-sanitiser.h 2016-05-26 14:58:54.000000000 +0200 ++++ qtwebengine/src/3rdparty/chromium/third_party/ots/include/opentype-sanitiser.h 2016-10-01 14:31:30.885000000 +0200 +@@ -21,6 +21,7 @@ + #define htons(x) _byteswap_ushort (x) + #else + #include ++#include + #include + #endif + diff --git a/srcpkgs/qt5-webengine/patches/0006-musl-pread-pwrite.patch b/srcpkgs/qt5-webengine/patches/0006-musl-pread-pwrite.patch new file mode 100644 index 0000000000..00017bba01 --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0006-musl-pread-pwrite.patch @@ -0,0 +1,18 @@ +--- qtwebengine/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h 2018-09-07 21:25:26.639964100 +0200 ++++ qtwebengine/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h 2018-09-07 21:25:11.611964995 +0200 +@@ -1794,6 +1794,15 @@ + /* End of s390/s390x definitions */ + #endif + ++#ifndef __GLIBC__ ++ /* For Musl libc pread/pread is the same as pread64/pwrite64 */ ++#ifndef __NR_pread ++#define __NR_pread __NR_pread64 ++#endif ++#ifndef __NR_pwrite ++#define __NR_pwrite __NR_pwrite64 ++#endif ++#endif /* ifndef __GLIBC__ */ + + /* After forking, we must make sure to only call system calls. */ + #if defined(__BOUNDED_POINTERS__) diff --git a/srcpkgs/qt5-webengine/patches/0007-musl-replace-pvalloc.patch b/srcpkgs/qt5-webengine/patches/0007-musl-replace-pvalloc.patch new file mode 100644 index 0000000000..d5caf3836d --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0007-musl-replace-pvalloc.patch @@ -0,0 +1,14 @@ +--- qtwebengine/src/core/api/qtbug-61521.cpp 2017-11-29 09:42:29.000000000 +0100 ++++ qtwebengine/src/core/api/qtbug-61521.cpp 2018-01-28 06:49:29.454175725 +0100 +@@ -111,7 +111,11 @@ + } + + SHIM_HIDDEN void* ShimPvalloc(size_t size) { ++#if defined(__GLIBC__) + return pvalloc(size); ++#else ++ return valloc((size+4095)&~4095); ++#endif + } + + SHIM_HIDDEN int ShimPosixMemalign(void** r, size_t a, size_t s) { diff --git a/srcpkgs/qt5-webengine/patches/0008-musl-resolve.patch b/srcpkgs/qt5-webengine/patches/0008-musl-resolve.patch new file mode 100644 index 0000000000..edfceb79f3 --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0008-musl-resolve.patch @@ -0,0 +1,26 @@ +--- qtwebengine/src/3rdparty/chromium/net/dns/dns_reloader.cc 2016-11-07 15:46:18.000000000 +0100 ++++ qtwebengine/src/3rdparty/chromium/net/dns/dns_reloader.cc 2016-12-20 03:33:11.749059656 +0100 +@@ -9,6 +9,10 @@ + + #include + ++#if !defined(__GLIBC__) ++#include "resolv_compat.h" ++#endif ++ + #include "base/lazy_instance.h" + #include "base/logging.h" + #include "base/macros.h" +--- qtwebengine/src/3rdparty/chromium/net/dns/dns_config_service_posix.cc 2016-11-07 15:46:18.000000000 +0100 ++++ qtwebengine/src/3rdparty/chromium/net/dns/dns_config_service_posix.cc 2016-12-20 03:40:07.671953098 +0100 +@@ -6,6 +6,10 @@ + + #include + ++#if !defined(__GLIBC__) ++#include "resolv_compat.h" ++#endif ++ + #include "base/bind.h" + #include "base/files/file.h" + #include "base/files/file_path.h" diff --git a/srcpkgs/qt5-webengine/patches/0009-musl-siginfo_t.patch b/srcpkgs/qt5-webengine/patches/0009-musl-siginfo_t.patch new file mode 100644 index 0000000000..fe760be166 --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0009-musl-siginfo_t.patch @@ -0,0 +1,18 @@ +There's a subtle difference in the internal name of siginfo_t fields +between glibc and musl. The structure itself is equivalent, so it +should suffice to add a macro to rename the field. + +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/trap.cc 2015-02-17 05:57:43.000000000 +0100 ++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/trap.cc 2015-06-03 08:20:25.032716427 +0200 +@@ -22,6 +22,11 @@ + #include "sandbox/linux/services/android_ucontext.h" + #endif + ++// musl libc defines siginfo_t __si_fields instead of _sifields ++#if !defined(__GLIBC__) ++#define _sifields __si_fields ++#endif ++ + namespace { + + const int kCapacityIncrement = 20; diff --git a/srcpkgs/qt5-webengine/patches/0010-musl-stackstart.patch b/srcpkgs/qt5-webengine/patches/0010-musl-stackstart.patch new file mode 100644 index 0000000000..57136bc2bc --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0010-musl-stackstart.patch @@ -0,0 +1,20 @@ +--- qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc 2018-01-27 23:08:43.586475349 +0100 ++++ qtwebengine/src/3rdparty/chromium/third_party/blink/renderer/platform/wtf/stack_util.cc 2018-01-27 23:18:22.274505203 +0100 +@@ -28,7 +28,7 @@ + // FIXME: On Mac OSX and Linux, this method cannot estimate stack size + // correctly for the main thread. + +-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ ++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ + defined(OS_FUCHSIA) + // pthread_getattr_np() can fail if the thread is not invoked by + // pthread_create() (e.g., the main thread of webkit_unit_tests). +@@ -96,7 +96,7 @@ + } + + void* GetStackStart() { +-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ ++#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \ + defined(OS_FUCHSIA) + pthread_attr_t attr; + int error; diff --git a/srcpkgs/qt5-webengine/patches/0011-musl-sandbox.patch b/srcpkgs/qt5-webengine/patches/0011-musl-sandbox.patch new file mode 100644 index 0000000000..d3de1e4118 --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0011-musl-sandbox.patch @@ -0,0 +1,71 @@ +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2018-06-15 09:47:20.000000000 +0200 ++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc 2018-09-13 19:53:53.453780253 +0200 +@@ -129,7 +129,7 @@ + // CLONE_VM, nor CLONE_THREAD, which includes all fork() implementations. + ResultExpr RestrictCloneToThreadsAndEPERMFork() { + const Arg flags(0); +- ++#if defined(__GLIBC__) + // TODO(mdempsky): Extend DSL to support (flags & ~mask1) == mask2. + const uint64_t kAndroidCloneMask = CLONE_VM | CLONE_FS | CLONE_FILES | + CLONE_SIGHAND | CLONE_THREAD | +@@ -148,6 +148,17 @@ + return If(IsAndroid() ? android_test : glibc_test, Allow()) + .ElseIf((flags & (CLONE_VM | CLONE_THREAD)) == 0, Error(EPERM)) + .Else(CrashSIGSYSClone()); ++#else ++ const int required = CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND | ++ CLONE_THREAD | CLONE_SYSVSEM; ++ const int safe = CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID | ++ CLONE_DETACHED; ++ const BoolExpr thread_clone_ok = (flags&~safe)==required; ++ ++ return If(thread_clone_ok, Allow()) ++ .ElseIf((flags & (CLONE_VM | CLONE_THREAD)) == 0, Error(EPERM)) ++ .Else(CrashSIGSYSClone()); ++#endif + } + + ResultExpr RestrictPrctl() { +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc 2018-06-15 09:47:20.000000000 +0200 ++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc 2018-09-13 19:56:31.779773940 +0200 +@@ -375,6 +375,9 @@ + #if defined(__i386__) + case __NR_waitpid: + #endif ++#if !defined(__GLIBC__) ++ case __NR_set_tid_address: ++#endif + return true; + case __NR_clone: // Should be parameter-restricted. + case __NR_setns: // Privileged. +@@ -387,7 +390,9 @@ + #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) + case __NR_set_thread_area: + #endif ++#if defined(__GLIBC__) + case __NR_set_tid_address: ++#endif + case __NR_unshare: + #if !defined(__mips__) && !defined(__aarch64__) + case __NR_vfork: +@@ -496,6 +501,9 @@ + case __NR_mlock: + case __NR_munlock: + case __NR_munmap: ++#if !defined(__GLIBC__) ++ case __NR_mremap: ++#endif + return true; + case __NR_madvise: + case __NR_mincore: +@@ -511,7 +519,9 @@ + case __NR_modify_ldt: + #endif + case __NR_mprotect: ++#if defined(__GLIBC__) + case __NR_mremap: ++#endif + case __NR_msync: + case __NR_munlockall: + case __NR_readahead: diff --git a/srcpkgs/qt5-webengine/patches/0012-musl-chromium-default-stacksize.patch b/srcpkgs/qt5-webengine/patches/0012-musl-chromium-default-stacksize.patch new file mode 100644 index 0000000000..7bf5a22fba --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0012-musl-chromium-default-stacksize.patch @@ -0,0 +1,15 @@ +--- qtwebengine/src/3rdparty/chromium/base/threading/platform_thread_linux.cc.orig 2018-09-19 18:05:15.523923703 +0200 ++++ qtwebengine/src/3rdparty/chromium/base/threading/platform_thread_linux.cc 2018-09-19 18:08:05.150932454 +0200 +@@ -173,7 +173,12 @@ + + size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) { + #if !defined(THREAD_SANITIZER) ++#if defined(__GLIBC__) + return 0; ++#else // defined(__GLIBC__) ++ // For Musl libc try with a default stack size of 2 MiB ++ return 2 * 1024 * 1024; ++#endif // !defined(__GLIBC__) + #else + // ThreadSanitizer bloats the stack heavily. Evidence has been that the + // default stack size isn't enough for some browser tests. diff --git a/srcpkgs/qt5-webengine/patches/0014-musl-cross-no-asm_ptrace_h.patch b/srcpkgs/qt5-webengine/patches/0014-musl-cross-no-asm_ptrace_h.patch new file mode 100644 index 0000000000..140742f72c --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0014-musl-cross-no-asm_ptrace_h.patch @@ -0,0 +1,30 @@ +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc 2018-08-27 10:21:31.000000000 +0200 ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc 2018-11-22 00:41:58.522477559 +0100 +@@ -38,7 +38,12 @@ + + #include "client/linux/minidump_writer/linux_ptrace_dumper.h" + ++#if defined(__GLIBC__) + #include ++#else ++/* For arm*-musl this definition is missing */ ++#define ARM_sp uregs[13] ++#endif + #include + #include + #include +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc 2018-08-27 10:21:31.000000000 +0200 ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc 2018-11-22 00:49:39.533492245 +0100 +@@ -32,7 +32,12 @@ + + #include "client/linux/minidump_writer/linux_core_dumper.h" + ++#if defined(__GLIBC__) + #include ++#else ++/* For arm*-musl this definition is missing */ ++#define ARM_sp uregs[13] ++#endif + #include + #include + #include diff --git a/srcpkgs/qt5-webengine/patches/0015-yasm-nls.patch b/srcpkgs/qt5-webengine/patches/0015-yasm-nls.patch new file mode 100644 index 0000000000..22ac042076 --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0015-yasm-nls.patch @@ -0,0 +1,13 @@ +diff --git src/3rdparty/chromium/third_party/yasm/source/config/linux/config.h src/3rdparty/chromium/third_party/yasm/source/config/linux/config.h +index 9e36539..f588083 100644 +--- qtwebengine/src/3rdparty/chromium//third_party/yasm/source/config/linux/config.h +--- qtwebengine/src/3rdparty/chromium//third_party/yasm/source/config/linux/config.h +@@ -5,7 +5,7 @@ + #define CPP_PROG "gcc -E" + + /* */ +-#define ENABLE_NLS 1 ++/* #undef ENABLE_NLS 1 */ + + /* Define to 1 if you have the `abort' function. */ + #define HAVE_ABORT 1 diff --git a/srcpkgs/qt5-webengine/patches/0016-qt-musl-execinfo.patch b/srcpkgs/qt5-webengine/patches/0016-qt-musl-execinfo.patch new file mode 100644 index 0000000000..c1cdb53721 --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0016-qt-musl-execinfo.patch @@ -0,0 +1,94 @@ +--- qtwebengine/src/3rdparty/chromium//base/debug/stack_trace_posix.cc.orig 2019-04-09 09:31:16.000000000 +0200 ++++ qtwebengine/src/3rdparty/chromium//base/debug/stack_trace_posix.cc 2019-05-06 23:16:13.245502467 +0200 +@@ -27,7 +27,7 @@ + #if !defined(USE_SYMBOLIZE) + #include + #endif +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + #include + #endif + +@@ -86,7 +86,7 @@ + // Note: code in this function is NOT async-signal safe (std::string uses + // malloc internally). + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + std::string::size_type search_from = 0; + while (search_from < text->size()) { + // Look for the start of a mangled symbol, from search_from. +@@ -121,7 +121,7 @@ + search_from = mangled_start + 2; + } + } +-#endif // !defined(__UCLIBC__) && !defined(_AIX) ++#endif // !defined(__GLIBC__) && !defined(_AIX) + } + #endif // !defined(USE_SYMBOLIZE) + +@@ -133,7 +133,7 @@ + virtual ~BacktraceOutputHandler() = default; + }; + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + void OutputPointer(void* pointer, BacktraceOutputHandler* handler) { + // This should be more than enough to store a 64-bit number in hex: + // 16 hex digits + 1 for null-terminator. +@@ -216,7 +216,7 @@ + } + #endif // defined(USE_SYMBOLIZE) + } +-#endif // !defined(__UCLIBC__) && !defined(_AIX) ++#endif // !defined(__GLIBC__) && !defined(_AIX) + + void PrintToStderr(const char* output) { + // NOTE: This code MUST be async-signal safe (it's used by in-process +@@ -812,7 +812,7 @@ + // NOTE: This code MUST be async-signal safe (it's used by in-process + // stack dumping signal handler). NO malloc or stdio is allowed here. + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + // Though the backtrace API man page does not list any possible negative + // return values, we take no chance. + return base::saturated_cast(backtrace(trace, count)); +@@ -825,13 +825,13 @@ + // NOTE: This code MUST be async-signal safe (it's used by in-process + // stack dumping signal handler). NO malloc or stdio is allowed here. + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + PrintBacktraceOutputHandler handler; + ProcessBacktrace(trace_, count_, prefix_string, &handler); + #endif + } + +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + void StackTrace::OutputToStreamWithPrefix(std::ostream* os, + const char* prefix_string) const { + StreamBacktraceOutputHandler handler(os); +--- qtwebengine/src/3rdparty/chromium/base/debug/stack_trace.cc 2019-04-09 09:31:16.000000000 +0200 ++++ - 2019-05-06 23:18:14.923566992 +0200 +@@ -233,7 +233,7 @@ + } + std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const { + std::stringstream stream; +-#if !defined(__UCLIBC__) && !defined(_AIX) ++#if defined(__GLIBC__) && !defined(_AIX) + OutputToStreamWithPrefix(&stream, prefix_string); + #endif + return stream.str(); +--- qtwebengine/src/3rdparty/chromium//base/logging.cc 2017-11-28 14:06:53.000000000 +0100 +--- qtwebengine/src/3rdparty/chromium//base/logging.cc 2018-01-27 22:46:34.970406807 +0100 +@@ -546,7 +546,7 @@ + + LogMessage::~LogMessage() { + size_t stack_start = stream_.tellp(); +-#if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && !defined(__UCLIBC__) && \ ++#if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && defined(__GLIBC__) && \ + !defined(OS_AIX) + if (severity_ == LOG_FATAL && !base::debug::BeingDebugged()) { + // Include a stack trace on a fatal, unless a debugger is attached. diff --git a/srcpkgs/qt5-webengine/patches/0017-qt-musl-thread-stacksize.patch b/srcpkgs/qt5-webengine/patches/0017-qt-musl-thread-stacksize.patch new file mode 100644 index 0000000000..496753bef3 --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0017-qt-musl-thread-stacksize.patch @@ -0,0 +1,26 @@ +diff --git a/src/3rdparty/chromium/ppapi/utility/threading/simple_thread.cc b/src/3rdparty/chromium/ppapi/utility/threading/simple_thread.cc +index 02bf49b..05ee182 100644 +--- qtwebengine/src/3rdparty/chromium/ppapi/utility/threading/simple_thread.cc ++++ qtwebengine/src/3rdparty/chromium/ppapi/utility/threading/simple_thread.cc +@@ -13,7 +13,7 @@ namespace pp { + namespace { + + // Use 2MB default stack size for Native Client, otherwise use system default. +-#if defined(__native_client__) ++#if defined(__native_client__) || !defined(__GLIBC__) + const size_t kDefaultStackSize = 2 * 1024 * 1024; + #else + const size_t kDefaultStackSize = 0; +diff --git a/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc b/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc +index cf7f3ec..e06a5ce 100644 +--- qtwebengine/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc ++++ qtwebengine/src/3rdparty/chromium/v8/src/base/platform/platform-posix.cc +@@ -761,7 +761,7 @@ void Thread::Start() { + #if V8_OS_MACOSX + // Default on Mac OS X is 512kB -- bump up to 1MB + stack_size = 1 * 1024 * 1024; +-#elif V8_OS_AIX ++#elif V8_OS_AIX || !defined(__GLIBC__) + // Default on AIX is 96kB -- bump up to 2MB + stack_size = 2 * 1024 * 1024; + #endif diff --git a/srcpkgs/qt5-webengine/patches/0018-sandbox-membarrier.patch b/srcpkgs/qt5-webengine/patches/0018-sandbox-membarrier.patch new file mode 100644 index 0000000000..b73971f243 --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0018-sandbox-membarrier.patch @@ -0,0 +1,60 @@ +--- qtwebengine/src/3rdparty/chromium//sandbox/linux/system_headers/arm64_linux_syscalls.h ++++ qtwebengine/src/3rdparty/chromium//sandbox/linux/system_headers/arm64_linux_syscalls.h +@@ -1063,4 +1063,8 @@ + #define __NR_memfd_create 279 + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier 283 ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_ARM64_LINUX_SYSCALLS_H_ + +--- qtwebengine/src/3rdparty/chromium//sandbox/linux/system_headers/arm_linux_syscalls.h ++++ qtwebengine/src/3rdparty/chromium//sandbox/linux/system_headers/arm_linux_syscalls.h +@@ -1385,6 +1385,10 @@ + #define __NR_memfd_create (__NR_SYSCALL_BASE+385) + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier (__NR_SYSCALL_BASE+389) ++#endif ++ + // ARM private syscalls. + #if !defined(__ARM_NR_BASE) + #define __ARM_NR_BASE (__NR_SYSCALL_BASE + 0xF0000) + +--- qtwebengine/src/3rdparty/chromium//sandbox/linux/system_headers/x86_32_linux_syscalls.h ++++ qtwebengine/src/3rdparty/chromium//sandbox/linux/system_headers/x86_32_linux_syscalls.h +@@ -1422,5 +1422,9 @@ + #define __NR_memfd_create 356 + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier 375 ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_32_LINUX_SYSCALLS_H_ + +--- qtwebengine/src/3rdparty/chromium//sandbox/linux/system_headers/x86_64_linux_syscalls.h ++++ qtwebengine/src/3rdparty/chromium//sandbox/linux/system_headers/x86_64_linux_syscalls.h +@@ -1290,5 +1290,9 @@ + #define __NR_memfd_create 319 + #endif + ++#if !defined(__NR_membarrier) ++#define __NR_membarrier 324 ++#endif ++ + #endif // SANDBOX_LINUX_SYSTEM_HEADERS_X86_64_LINUX_SYSCALLS_H_ + +--- qtwebengine/src/3rdparty/chromium//sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc ++++ qtwebengine/src/3rdparty/chromium//sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc +@@ -370,6 +370,7 @@ + switch (sysno) { + case __NR_exit: + case __NR_exit_group: ++ case __NR_membarrier: + case __NR_wait4: + case __NR_waitid: + #if defined(__i386__) diff --git a/srcpkgs/qt5-webengine/patches/0019-gn-cross-sysroot.patch b/srcpkgs/qt5-webengine/patches/0019-gn-cross-sysroot.patch new file mode 100644 index 0000000000..ee6689a418 --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0019-gn-cross-sysroot.patch @@ -0,0 +1,24 @@ +There is no reason to run this script and running it fails on architectures +chromium does not officially support (such as ppc64). + +--- qtwebengine/src/3rdparty/chromium/build/config/posix/BUILD.gn ++++ qtwebengine/src/3rdparty/chromium/build/config/posix/BUILD.gn +@@ -102,12 +102,12 @@ config("runtime_library") { + # when turning the sysroot on or off. (defines are passed via the command + # line, and build system rebuilds things when their commandline + # changes). Nothing should ever read this define. +- sysroot_hash = +- exec_script("//build/linux/sysroot_scripts/install-sysroot.py", +- [ "--print-hash=$current_cpu" ], +- "trim string", +- [ "//build/linux/sysroot_scripts/sysroots.json" ]) +- defines += [ "CR_SYSROOT_HASH=$sysroot_hash" ] ++ #sysroot_hash = ++ # exec_script("//build/linux/sysroot_scripts/install-sysroot.py", ++ # [ "--print-hash=$current_cpu" ], ++ # "trim string", ++ # [ "//build/linux/sysroot_scripts/sysroots.json" ]) ++ #defines += [ "CR_SYSROOT_HASH=$sysroot_hash" ] + } + asmflags += sysroot_flags + diff --git a/srcpkgs/qt5-webengine/patches/0020-msgvec-push_back.patch b/srcpkgs/qt5-webengine/patches/0020-msgvec-push_back.patch new file mode 100644 index 0000000000..75481a2889 --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0020-msgvec-push_back.patch @@ -0,0 +1,14 @@ +--- qtwebengine-everywhere-src-5.14.0-beta2/src/3rdparty/chromium/net/socket/udp_socket_posix.cc 2019-10-08 08:27:43.000000000 +0200 ++++ - 2019-11-11 22:41:46.699068889 +0100 +@@ -1191,7 +1191,11 @@ + msg_iov->push_back({const_cast(buffer->data()), buffer->length()}); + msgvec->reserve(buffers.size()); + for (size_t j = 0; j < buffers.size(); j++) ++#if defined(__GLIBC__) + msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, nullptr, 0, 0}, 0}); ++#else ++ msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, 0, 0, 0}, 0}); ++#endif + int result = HANDLE_EINTR(Sendmmsg(fd, &msgvec[0], buffers.size(), 0)); + SendResult send_result(0, 0, std::move(buffers)); + if (result < 0) { diff --git a/srcpkgs/qt5-webengine/patches/0021-sandbox-sched_getparam.patch b/srcpkgs/qt5-webengine/patches/0021-sandbox-sched_getparam.patch new file mode 100644 index 0000000000..a91e85eca3 --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0021-sandbox-sched_getparam.patch @@ -0,0 +1,24 @@ +Allow SYS_sched_getparam and SYS_sched_getscheduler +musl uses them for pthread_getschedparam() + +source: https://git.alpinelinux.org/aports/commit/community/chromium?id=54af9f8ac24f52d382c5758e2445bf0206eff40e + +--- a/src/3rdparty/chromium/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc 2019-10-08 08:27:43.000000000 +0200 ++++ - 2019-11-11 22:33:51.865153684 +0100 +@@ -88,10 +88,16 @@ + case __NR_sysinfo: + case __NR_times: + case __NR_uname: ++#if !defined(__GLIBC__) ++ case __NR_sched_getparam: ++ case __NR_sched_getscheduler: ++#endif + return Allow(); + case __NR_sched_getaffinity: ++#if defined(__GLIBC__) + case __NR_sched_getparam: + case __NR_sched_getscheduler: ++#endif + case __NR_sched_setscheduler: + return sandbox::RestrictSchedTarget(GetPolicyPid(), sysno); + case __NR_prlimit64: diff --git a/srcpkgs/qt5-webengine/patches/0022-canonicalize-file-name-musl.patch b/srcpkgs/qt5-webengine/patches/0022-canonicalize-file-name-musl.patch new file mode 100644 index 0000000000..893ed2d41b --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0022-canonicalize-file-name-musl.patch @@ -0,0 +1,11 @@ +--- qtwebengine/src/3rdparty/chromium/third_party/nasm/nasmlib/realpath.c 2019-09-23 14:24:20.000000000 +0200 ++++ - 2019-10-11 06:27:28.450329986 +0200 +@@ -57,7 +57,7 @@ + */ + char *nasm_realpath(const char *rel_path) + { +- char *rp = canonicalize_file_name(rel_path); ++ char *rp = realpath(rel_path, NULL); + return rp ? rp : nasm_strdup(rel_path); + } + diff --git a/srcpkgs/qt5-webengine/patches/0090-chromium-ppc64le.patch b/srcpkgs/qt5-webengine/patches/0090-chromium-ppc64le.patch new file mode 100644 index 0000000000..21796909b7 --- /dev/null +++ b/srcpkgs/qt5-webengine/patches/0090-chromium-ppc64le.patch @@ -0,0 +1,4048 @@ +This is a base patch that adds support for ppc64le glibc. Big endian and musl +support is added in extra patches afterwards. + +Ping q66 if you're updating qt5 and the patch does not apply anymore. + +Source: https://wiki.raptorcs.com/w/index.php?title=Porting/Chromium +Upstream: Currently being submitted + +--- qtwebengine/src/3rdparty/chromium/build/download_nacl_toolchains.py ++++ qtwebengine/src/3rdparty/chromium/build/download_nacl_toolchains.py +@@ -11,6 +11,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') +--- qtwebengine/src/3rdparty/chromium/sandbox/features.gni ++++ qtwebengine/src/3rdparty/chromium/sandbox/features.gni +@@ -12,6 +12,6 @@ use_seccomp_bpf = + (is_linux || is_android) && + (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm" || + current_cpu == "arm64" || current_cpu == "mipsel" || +- current_cpu == "mips64el") ++ current_cpu == "mips64el" || current_cpu == "ppc64") + + use_seccomp_bpf = use_seccomp_bpf || is_nacl_nonsfi +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/BUILD.gn ++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/BUILD.gn +@@ -416,6 +416,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", +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/bpf_dsl/linux_syscall_ranges.h ++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/bpf_dsl/linux_syscall_ranges.h +@@ -55,6 +55,13 @@ + #define MAX_PUBLIC_SYSCALL 279u + #define MAX_SYSCALL MAX_PUBLIC_SYSCALL + ++#elif defined(__powerpc64__) ++ ++#include ++#define MIN_SYSCALL 0u ++#define MAX_PUBLIC_SYSCALL 386u ++#define MAX_SYSCALL MAX_PUBLIC_SYSCALL ++ + #else + #error "Unsupported architecture" + #endif +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/bpf_dsl/seccomp_macros.h ++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/bpf_dsl/seccomp_macros.h +@@ -16,6 +16,9 @@ + #if defined(__mips__) + // sys/user.h in eglibc misses size_t definition + #include ++#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 ++ ++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 + +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc ++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc +@@ -87,7 +87,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__) +@@ -190,7 +191,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 +@@ -208,7 +209,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, +@@ -248,7 +249,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 +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc ++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc +@@ -35,7 +35,8 @@ + #include + #include + #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(__arm__) && \ +- !defined(__aarch64__) && !defined(PTRACE_GET_THREAD_AREA) ++ !defined(__aarch64__) && !defined(__powerpc64__) && \ ++ !defined(PTRACE_GET_THREAD_AREA) + // 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 +@@ -44,6 +44,11 @@ + #endif + #endif // !OS_NACL_NONSFI + ++// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h ++#ifdef __powerpc64__ ++#include ++#endif ++ + #if defined(OS_ANDROID) + + #if !defined(F_DUPFD_CLOEXEC) +@@ -106,6 +111,15 @@ inline bool IsArchitectureMips() { + #endif + } + ++inline bool IsArchitecturePPC64() { ++#if defined(__powerpc64__) ++ return true; ++#else ++ return false; ++#endif ++} ++ ++ + // Ubuntu's version of glibc has a race condition in sem_post that can cause + // it to call futex(2) with bogus op arguments. To workaround this, we need + // to allow those futex(2) calls to fail with EINVAL, instead of crashing the +@@ -247,7 +261,8 @@ ResultExpr RestrictFcntlCommands() { + // operator. + // Glibc overrides the kernel's O_LARGEFILE value. Account for this. + uint64_t kOLargeFileFlag = O_LARGEFILE; +- if (IsArchitectureX86_64() || IsArchitectureI386() || IsArchitectureMips()) ++ if (IsArchitectureX86_64() || IsArchitectureI386() || IsArchitectureMips() \ ++ || IsArchitecturePPC64()) + kOLargeFileFlag = 0100000; + + const Arg cmd(1); +@@ -270,7 +285,7 @@ ResultExpr RestrictFcntlCommands() { + .Default(CrashSIGSYS()); + } + +-#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 +@@ -421,7 +422,7 @@ ResultExpr RestrictPrlimit(pid_t target_pid) { + ResultExpr RestrictPtrace() { + const Arg request(0); + return Switch(request).CASES(( +-#if !defined(__aarch64__) ++#if !defined(__aarch64__) && !defined(__powerpc64__) + PTRACE_GETREGS, + PTRACE_GETFPREGS, + PTRACE_GET_THREAD_AREA, +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h ++++ qtwebengine/src/3rdparty/chromium/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(); +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc ++++ qtwebengine/src/3rdparty/chromium/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; +@@ -45,7 +46,8 @@ bool SyscallSets::IsAllowedGettime(int sysno) { + #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: +@@ -111,7 +113,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)) +@@ -130,7 +132,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 +@@ -154,7 +156,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. +@@ -173,7 +176,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__) +@@ -186,7 +190,8 @@ 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. +@@ -198,6 +203,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; +@@ -223,7 +230,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; +@@ -264,7 +272,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 +@@ -314,7 +322,8 @@ bool SyscallSets::IsAllowedSignalHandling(int sysno) { + case __NR_rt_sigprocmask: + case __NR_rt_sigreturn: + #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_sigaction: + case __NR_sigprocmask: + case __NR_sigreturn: +@@ -331,7 +340,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 +@@ -355,7 +365,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; +@@ -389,7 +399,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { + case __NR_membarrier: + case __NR_wait4: + case __NR_waitid: +-#if defined(__i386__) ++#if defined(__i386__) || defined(__powerpc64__) + case __NR_waitpid: + #endif + #if !defined(__GLIBC__) +@@ -411,7 +421,7 @@ bool SyscallSets::IsAllowedProcessStartOrDeath(int sysno) { + case __NR_set_tid_address: + #endif + case __NR_unshare: +-#if !defined(__mips__) && !defined(__aarch64__) ++#if !defined(__mips__) && !defined(__aarch64__) || defined(__powerpc64__) + case __NR_vfork: + #endif + default: +@@ -460,7 +470,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; +@@ -470,7 +480,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: +@@ -485,7 +495,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) { +@@ -499,7 +510,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: +@@ -527,7 +539,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__) || \ +@@ -559,7 +571,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__) +@@ -571,26 +584,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 +@@ -647,7 +662,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: +@@ -659,7 +675,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: +@@ -675,7 +692,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: +@@ -708,7 +726,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: +@@ -724,7 +743,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: +@@ -753,14 +772,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: +@@ -794,7 +814,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 +@@ -888,7 +908,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) { +@@ -908,7 +929,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 + } +@@ -961,7 +983,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: +@@ -1020,18 +1043,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: +@@ -1039,20 +1066,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; +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h ++++ qtwebengine/src/3rdparty/chromium/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 + +@@ -87,7 +88,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 +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/syscall.cc ++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/syscall.cc +@@ -16,7 +16,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 +@@ -308,12 +308,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]); + } +@@ -427,6 +471,8 @@ intptr_t Syscall::Call(int nr, + ret = inout; + } + ++#elif defined(__powerpc64__) ++ intptr_t ret = SyscallAsm(nr, args); + #else + #error "Unimplemented architecture" + #endif +@@ -443,8 +489,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(ret_val); + } +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/trap.cc ++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/seccomp-bpf/trap.cc +@@ -230,6 +230,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(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. +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/services/credentials.cc ++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/services/credentials.cc +@@ -79,7 +79,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 +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/syscall_broker/broker_process.cc ++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/syscall_broker/broker_process.cc +@@ -151,7 +151,7 @@ bool BrokerProcess::IsSyscallAllowed(int sysno) const { + #if defined(__NR_fstatat) + case __NR_fstatat: + #endif +-#if defined(__x86_64__) || defined(__aarch64__) ++#if defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) + case __NR_newfstatat: + #endif + return !fast_check_in_client_ || allowed_command_set_.test(COMMAND_STAT); +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_seccomp.h ++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_seccomp.h +@@ -29,6 +29,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 +@@ -54,6 +57,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 +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_signal.h ++++ qtwebengine/src/3rdparty/chromium/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 +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_syscalls.h ++++ qtwebengine/src/3rdparty/chromium/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_ + +--- qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_ucontext.h ++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/linux_ucontext.h +@@ -11,6 +11,8 @@ + #include "sandbox/linux/system_headers/arm_linux_ucontext.h" + #elif defined(__i386__) + #include "sandbox/linux/system_headers/i386_linux_ucontext.h" ++#elif defined(__powerpc64__) ++#include "sandbox/linux/system_headers/ppc64_linux_ucontext.h" + #else + #error "No support for your architecture in PNaCl header" + #endif +new file mode 100644 +--- /dev/null ++++ qtwebengine/src/3rdparty/chromium/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 ++ ++//TODO: is it necessary to redefine syscall numbers for PPC64? ++ ++#endif // SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_SYSCALLS_H_ +new file mode 100644 +--- /dev/null ++++ qtwebengine/src/3rdparty/chromium/sandbox/linux/system_headers/ppc64_linux_ucontext.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_UCONTEXT_H_ ++#define SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_UCONTEXT_H_ ++ ++#include ++ ++//TODO: is it necessary to redefine ucontext on PPC64? ++ ++#endif // SANDBOX_LINUX_SYSTEM_HEADERS_PPC64_LINUX_UCONTEXT_H_ +--- qtwebengine/src/3rdparty/chromium/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc ++++ qtwebengine/src/3rdparty/chromium/services/service_manager/sandbox/linux/bpf_renderer_policy_linux.cc +@@ -15,6 +15,11 @@ + #include "sandbox/linux/system_headers/linux_syscalls.h" + #include "services/service_manager/sandbox/linux/sandbox_linux.h" + ++// On PPC64, TCGETS is defined in terms of struct termios, so we must include termios.h ++#ifdef __powerpc64__ ++#include ++#endif ++ + // TODO(vignatti): replace the local definitions below with #include + // once kernel version 4.6 becomes widely used. + #include +--- qtwebengine/src/3rdparty/chromium/third_party/angle/src/libANGLE/Constants.h ++++ qtwebengine/src/3rdparty/chromium/third_party/angle/src/libANGLE/Constants.h +@@ -9,6 +9,7 @@ + #ifndef LIBANGLE_CONSTANTS_H_ + #define LIBANGLE_CONSTANTS_H_ + ++#include + #include "common/platform.h" + + namespace gl +--- qtwebengine/src/3rdparty/chromium/third_party/boringssl/BUILD.gn ++++ qtwebengine/src/3rdparty/chromium/third_party/boringssl/BUILD.gn +@@ -100,6 +100,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" ] + } +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/raw_context_cpu.h ++++ qtwebengine/src/3rdparty/chromium/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 +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.cc ++++ qtwebengine/src/3rdparty/chromium/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 +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/thread_info.h +@@ -68,6 +68,10 @@ struct ThreadInfo { + // Use the structures defined in + struct user_regs_struct regs; + struct user_fpsimd_struct fpregs; ++#elif defined(__powerpc64__) ++ // Use the structures defined in . ++ mcontext_t mcontext; ++ vrregset_t vregs; + #elif defined(__mips__) + // Use the structure defined in . + 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 +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.cc ++++ qtwebengine/src/3rdparty/chromium/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 +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h +@@ -54,6 +54,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 +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.cc +@@ -467,9 +467,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) { +@@ -707,11 +714,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. +@@ -732,6 +747,9 @@ bool ExceptionHandler::WriteMinidump() { + #elif defined(__mips__) + context.siginfo.si_addr = + reinterpret_cast(context.context.uc_mcontext.pc); ++#elif defined(__powerpc64__) ++ context.siginfo.si_addr = ++ reinterpret_cast(context.context.uc_mcontext.gp_regs[PT_NIP]); + #else + #error "This code has not been ported to your platform yet." + #endif +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler.h ++++ qtwebengine/src/3rdparty/chromium/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. +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc ++++ qtwebengine/src/3rdparty/chromium/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); + +@@ -576,6 +576,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 +@@ -771,10 +773,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(); +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer.cc ++++ qtwebengine/src/3rdparty/chromium/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_; +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/microdump_writer/microdump_writer_unittest.cc +@@ -278,10 +278,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 " +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_core_dumper.cc +@@ -116,6 +116,9 @@ bool LinuxCoreDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) { + #elif defined(__mips__) + stack_pointer = + reinterpret_cast(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]); ++#elif defined(__powerpc64__) ++ stack_pointer = ++ reinterpret_cast(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]); + #else + #error "This code hasn't been ported to your platform yet." + #endif +@@ -200,7 +203,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]; +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.cc +@@ -798,7 +798,9 @@ bool LinuxDumper::GetStackInfo(const void** stack, size_t* stack_len, + reinterpret_cast(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) +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper.h +@@ -60,7 +60,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 + +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc ++++ qtwebengine/src/3rdparty/chromium/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 +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc +@@ -154,19 +154,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; +@@ -303,6 +311,9 @@ bool LinuxPtraceDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) { + #elif defined(__mips__) + stack_pointer = + reinterpret_cast(info->mcontext.gregs[MD_CONTEXT_MIPS_REG_SP]); ++#elif defined(__powerpc64__) ++ stack_pointer = ++ reinterpret_cast(info->mcontext.gp_regs[MD_CONTEXT_PPC64_REG_SP]); + #else + #error "This code hasn't been ported to your platform yet." + #endif +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc +@@ -457,6 +457,9 @@ TEST(LinuxPtraceDumperTest, VerifyStackReadWithMultipleThreads) { + #elif defined(__mips__) + pid_t* process_tid_location = + reinterpret_cast(one_thread.mcontext.gregs[1]); ++#elif defined(__powerpc64__) ++ pid_t* process_tid_location = ++ reinterpret_cast(one_thread.mcontext.gp_regs[8]); + #else + #error This test has not been ported to this platform. + #endif +@@ -553,6 +556,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 +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.cc ++++ qtwebengine/src/3rdparty/chromium/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_); +@@ -891,7 +895,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"; +@@ -911,7 +915,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 +@@ -1327,7 +1333,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_; +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer.h +@@ -47,6 +47,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 struct _fpstate fpstate_t; + #endif +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/linux/minidump_writer/minidump_writer_unittest.cc +@@ -710,6 +710,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 +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file.cc ++++ qtwebengine/src/3rdparty/chromium/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 +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/linux/memory_mapped_file_unittest.cc ++++ qtwebengine/src/3rdparty/chromium/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(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; + } +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/memory_allocator_unittest.cc ++++ qtwebengine/src/3rdparty/chromium/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(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(allocator.Alloc(i)); + ASSERT_FALSE(p == NULL); +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/processor/exploitability_linux.cc ++++ qtwebengine/src/3rdparty/chromium/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. +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/processor/exploitability_unittest.cc ++++ qtwebengine/src/3rdparty/chromium/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 +--- qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/tools/linux/md2core/minidump-2-core.cc +@@ -76,6 +76,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__) +@@ -86,6 +88,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; +@@ -320,6 +324,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; +@@ -534,6 +541,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(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 +@@ -622,6 +661,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 +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/CONTRIBUTORS ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/CONTRIBUTORS +@@ -13,3 +13,4 @@ Mark Mentovai + Robert Sesek + Scott Graham + Joshua Peraza ++Shawn Anastasio +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/compat/linux/sys/user.h ++++ qtwebengine/src/3rdparty/chromium/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 + #include_next + + #include +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_context.h ++++ qtwebengine/src/3rdparty/chromium/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_ +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer.cc ++++ qtwebengine/src/3rdparty/chromium/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(); ++ reinterpret_cast(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 +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer.h ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer.h +@@ -315,6 +315,45 @@ class MinidumpContextMIPS64Writer final : public MinidumpContextWriter { + DISALLOW_COPY_AND_ASSIGN(MinidumpContextMIPS64Writer); + }; + ++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_; ++ ++ DISALLOW_COPY_AND_ASSIGN(MinidumpContextPPC64Writer); ++}; ++ + } // namespace crashpad + + #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_WRITER_H_ +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_context_writer_test.cc ++++ qtwebengine/src/3rdparty/chromium/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( ++ ExpectMinidumpContextPPC64); ++} ++ ++TEST(MinidumpContextWriter, PPC64_FromSnapshot) { ++ constexpr uint32_t kSeed = 64; ++ CPUContextPPC64 context_ppc64; ++ CPUContext context; ++ context.ppc64 = &context_ppc64; ++ InitializeCPUContextPPC64(&context, kSeed); ++ FromSnapshotTest( ++ context, ExpectMinidumpContextPPC64, kSeed); ++} ++ + } // namespace + } // namespace test + } // namespace crashpad +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc +@@ -126,6 +126,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 +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/capture_memory.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/capture_memory.cc +@@ -111,6 +111,11 @@ void CaptureMemory::PointedToByContext(const CPUContext& context, + for (size_t i = 0; i < base::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 < base::size(context.ppc64->regs); ++i) { ++ MaybeCaptureMemoryAround(delegate, context.ppc64->regs[i]); ++ } + #else + #error Port. + #endif +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/cpu_architecture.h ++++ qtwebengine/src/3rdparty/chromium/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 +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/cpu_context.cc ++++ qtwebengine/src/3rdparty/chromium/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: +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/cpu_context.h ++++ qtwebengine/src/3rdparty/chromium/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; + }; + }; + +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/cpu_context_linux.h ++++ qtwebengine/src/3rdparty/chromium/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 + #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 ++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 ++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 + +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/debug_rendezvous_test.cc +@@ -159,9 +159,11 @@ void TestAgainstTarget(PtraceConnection* connection) { + const bool is_vdso_mapping = + device == 0 && inode == 0 && mapping_name == "[vdso]"; + static constexpr char kPrefix[] = "linux-vdso.so."; ++ static constexpr char kPrefix64[] = "linux-vdso64.so."; + return is_vdso_mapping == + (module_name.empty() || +- module_name.compare(0, strlen(kPrefix), kPrefix) == 0); ++ module_name.compare(0, strlen(kPrefix), kPrefix) == 0 || ++ module_name.compare(0, strlen(kPrefix64), kPrefix64) == 0); + }, + module_mapping->name, + module_mapping->device, +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.cc +@@ -323,6 +323,69 @@ bool ExceptionSnapshotLinux::ReadContext( + reader, context_address, context_.mips64); + } + ++#elif defined(ARCH_CPU_PPC64_FAMILY) ++ ++template ++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(thread_context, fp_context, ++ v_context, dest_context); ++ ++ return true; ++} ++ ++template<> ++bool ExceptionSnapshotLinux::ReadContext( ++ ProcessReaderLinux* reader, ++ LinuxVMAddress context_address) { ++ context_.architecture = kCPUArchitecturePPC64; ++ context_.ppc64 = &context_union_.ppc64; ++ ++ return internal::ReadContext( ++ reader, context_address, context_.ppc64); ++} ++ ++template<> ++bool ExceptionSnapshotLinux::ReadContext( ++ ProcessReaderLinux* reader, ++ LinuxVMAddress context_address) { ++ // PPC64 is 64-bit ++ return false; ++} ++ + #endif // ARCH_CPU_X86_FAMILY + + bool ExceptionSnapshotLinux::Initialize(ProcessReaderLinux* process_reader, +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux.h ++++ qtwebengine/src/3rdparty/chromium/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_; +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/exception_snapshot_linux_test.cc ++++ qtwebengine/src/3rdparty/chromium/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 +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux.cc ++++ qtwebengine/src/3rdparty/chromium/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 +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux_test.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/process_reader_linux_test.cc +@@ -591,6 +591,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; +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/signal_context.h ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/signal_context.h +@@ -422,6 +422,89 @@ static_assert(offsetof(UContext, 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 stack; ++ Sigset 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(_libc_vrstate), ++ "vrstate 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 +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/system_snapshot_linux.cc +@@ -203,6 +203,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 +@@ -218,6 +220,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 +@@ -238,6 +243,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 +@@ -371,6 +379,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 +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.cc ++++ qtwebengine/src/3rdparty/chromium/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( ++ thread.thread_info.thread_context.t64, ++ thread.thread_info.float_context.f64, ++ thread.thread_info.vector_context.v64, ++ context_.ppc64); + #else + #error Port. + #endif +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/snapshot/linux/thread_snapshot_linux.h ++++ qtwebengine/src/3rdparty/chromium/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 +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/auxiliary_vector.cc ++++ qtwebengine/src/3rdparty/chromium/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; +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/ptrace_broker.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/ptrace_broker.cc +@@ -93,8 +93,8 @@ int PtraceBroker::Run() { + } + + bool PtraceBroker::AllocateAttachments() { +- constexpr size_t page_size = 4096; +- constexpr size_t alloc_size = ++ static size_t page_size = getpagesize(); ++ size_t alloc_size = + (sizeof(ScopedPtraceAttach) + page_size - 1) & ~(page_size - 1); + void* alloc = sbrk(alloc_size); + if (reinterpret_cast(alloc) == -1) { +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/ptracer.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/ptracer.cc +@@ -394,6 +394,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 ++bool GetRegisterSet(pid_t tid, int set, Destination* dest, bool can_log) { ++ iovec iov; ++ iov.iov_base = reinterpret_cast(dest); ++ iov.iov_len = sizeof(*dest); ++ if (ptrace(PTRACE_GETREGSET, tid, reinterpret_cast(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 +@@ -486,6 +544,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, +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/thread_info.h ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/linux/thread_info.h +@@ -28,6 +28,10 @@ + #include + #endif + ++#if defined(ARCH_CPU_PPC64_FAMILY) ++#include ++#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::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; + }; +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context.h ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context.h +@@ -66,6 +66,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. +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context_linux.S ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context_linux.S +@@ -28,7 +28,7 @@ + .globl CAPTURECONTEXT_SYMBOL2 + #if defined(__i386__) || defined(__x86_64__) + .balign 16, 0x90 +-#elif defined(__arm__) || defined(__aarch64__) || defined(__mips__) ++#elif defined(__arm__) || defined(__aarch64__) || defined(__mips__) || defined(__powerpc64__) + .balign 4, 0x0 + #endif + +@@ -419,4 +419,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__ +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context_test.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context_test.cc +@@ -56,7 +56,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 = +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/misc/capture_context_test_util_linux.cc +@@ -36,6 +36,8 @@ void SanityCheckContext(const NativeCPUContext& context) { + EXPECT_EQ(context.uc_mcontext.regs[0], FromPointerCast(&context)); + #elif defined(ARCH_CPU_MIPS_FAMILY) + EXPECT_EQ(context.uc_mcontext.gregs[4], FromPointerCast(&context)); ++#elif defined(ARCH_CPU_PPC64_FAMILY) ++ EXPECT_EQ(context.uc_mcontext.gp_regs[3], FromPointerCast(&context)); + #endif + } + +@@ -50,6 +52,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 + } + +@@ -64,6 +68,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 + } + +--- qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/signals_test.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/util/posix/signals_test.cc +@@ -46,12 +46,12 @@ bool CanCauseSignal(int sig) { + return sig == SIGABRT || + sig == SIGALRM || + sig == SIGBUS || +-#if !defined(ARCH_CPU_ARM64) ++#if !defined(ARCH_CPU_ARM64) && !defined(ARCH_CPU_PPC64) + sig == SIGFPE || +-#endif // !defined(ARCH_CPU_ARM64) ++#endif // !defined(ARCH_CPU_ARM64) && !defined(ARCH_CPU_PPC64) + #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL) + sig == SIGILL || +-#endif // defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL ++#endif // defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL) + sig == SIGPIPE || + sig == SIGSEGV || + #if defined(OS_MACOSX) +@@ -117,9 +117,11 @@ void CauseSignal(int sig) { + break; + } + +-#if !defined(ARCH_CPU_ARM64) ++#if !defined(ARCH_CPU_ARM64) && !defined(ARCH_CPU_PPC64) + // ARM64 has hardware integer division instructions that don’t generate a + // trap for divide-by-zero, so this doesn’t produce SIGFPE. ++ // ++ // PPC64 fixed-point division by zero also doesn't produce a SIGFPE. + case SIGFPE: { + // Optimization makes this tricky, so get zero from a system call likely + // to succeed, and try to do something with the result. +@@ -137,7 +139,7 @@ void CauseSignal(int sig) { + fstat(quotient, &stat_buf); + break; + } +-#endif // ARCH_CPU_ARM64 ++#endif // !defined(ARCH_CPU_ARM64) && !defined(ARCH_CPU_PPC64) + + #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARMEL) + case SIGILL: { +--- qtwebengine/src/3rdparty/chromium/third_party/libpng/BUILD.gn ++++ qtwebengine/src/3rdparty/chromium/third_party/libpng/BUILD.gn +@@ -93,6 +93,11 @@ source_set("libpng_sources") { + "mips/filter_msa_intrinsics.c", + "mips/mips_init.c", + ] ++ } else if (current_cpu == "ppc64") { ++ sources += [ ++ "powerpc/filter_vsx_intrinsics.c", ++ "powerpc/powerpc_init.c", ++ ] + } + + configs -= [ "//build/config/compiler:chromium_code" ] +new file mode 100644 +--- /dev/null ++++ qtwebengine/src/3rdparty/chromium/third_party/libpng/powerpc/filter_vsx_intrinsics.c +@@ -0,0 +1,767 @@ ++/* filter_vsx_intrinsics.c - PowerPC optimised filter functions ++ * ++ * Copyright (c) 2017 Glenn Randers-Pehrson ++ * Written by Vadim Barkov, 2017. ++ * Last changed in libpng 1.6.29 [March 16, 2017] ++ * ++ * This code is released under the libpng license. ++ * For conditions of distribution and use, see the disclaimer ++ * and license in png.h ++ */ ++#include ++#include ++#include "../pngpriv.h" ++ ++#ifdef PNG_READ_SUPPORTED ++ ++/* This code requires -maltivec and -mvsx on the command line: */ ++#if PNG_POWERPC_VSX_IMPLEMENTATION == 1 /* intrinsics code from pngpriv.h */ ++ ++#include ++ ++#if PNG_POWERPC_VSX_OPT > 0 ++ ++#ifndef __VSX__ ++# error "This code requires VSX support (POWER7 and later). Please provide -mvsx compiler flag." ++#endif ++ ++#define vec_ld_unaligned(vec,data) vec = vec_vsx_ld(0,data) ++#define vec_st_unaligned(vec,data) vec_vsx_st(vec,0,data) ++ ++ ++/* Functions in this file look at most 3 pixels (a,b,c) to predict the 4th (d). ++ * They're positioned like this: ++ * prev: c b ++ * row: a d ++ * The Sub filter predicts d=a, Avg d=(a+b)/2, and Paeth predicts d to be ++ * whichever of a, b, or c is closest to p=a+b-c. ++ * ( this is taken from ../intel/filter_sse2_intrinsics.c ) ++ */ ++ ++#define vsx_declare_common_vars(row_info,row,prev_row,offset) \ ++ png_byte i;\ ++ png_bytep rp = row + offset;\ ++ png_const_bytep pp = prev_row;\ ++ png_size_t unaligned_top = 16 - (((png_size_t)rp % 16));\ ++ png_size_t istop;\ ++ if(unaligned_top == 16)\ ++ unaligned_top = 0;\ ++ istop = row_info->rowbytes;\ ++ if((unaligned_top < istop))\ ++ istop -= unaligned_top;\ ++ else{\ ++ unaligned_top = istop;\ ++ istop = 0;\ ++ } ++ ++void png_read_filter_row_up_vsx(png_row_infop row_info, png_bytep row, ++ png_const_bytep prev_row) ++{ ++ vector unsigned char rp_vec; ++ vector unsigned char pp_vec; ++ vsx_declare_common_vars(row_info,row,prev_row,0) ++ ++ /* Altivec operations require 16-byte aligned data ++ * but input can be unaligned. So we calculate ++ * unaligned part as usual. ++ */ ++ for (i = 0; i < unaligned_top; i++) ++ { ++ *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); ++ rp++; ++ } ++ ++ /* Using SIMD while we can */ ++ while( istop >= 16 ) ++ { ++ rp_vec = vec_ld(0,rp); ++ vec_ld_unaligned(pp_vec,pp); ++ ++ rp_vec = vec_add(rp_vec,pp_vec); ++ ++ vec_st(rp_vec,0,rp); ++ ++ pp += 16; ++ rp += 16; ++ istop -= 16; ++ } ++ ++ if(istop > 0) ++ { ++ /* If byte count of row is not divisible by 16 ++ * we will process remaining part as usual ++ */ ++ for (i = 0; i < istop; i++) ++ { ++ *rp = (png_byte)(((int)(*rp) + (int)(*pp++)) & 0xff); ++ rp++; ++ } ++} ++ ++} ++ ++static const vector unsigned char VSX_LEFTSHIFTED1_4 = {16,16,16,16, 0, 1, 2, 3,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_LEFTSHIFTED2_4 = {16,16,16,16,16,16,16,16, 4, 5, 6, 7,16,16,16,16}; ++static const vector unsigned char VSX_LEFTSHIFTED3_4 = {16,16,16,16,16,16,16,16,16,16,16,16, 8, 9,10,11}; ++ ++static const vector unsigned char VSX_LEFTSHIFTED1_3 = {16,16,16, 0, 1, 2,16,16,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_LEFTSHIFTED2_3 = {16,16,16,16,16,16, 3, 4, 5,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_LEFTSHIFTED3_3 = {16,16,16,16,16,16,16,16,16, 6, 7, 8,16,16,16,16}; ++static const vector unsigned char VSX_LEFTSHIFTED4_3 = {16,16,16,16,16,16,16,16,16,16,16,16, 9,10,11,16}; ++ ++static const vector unsigned char VSX_NOT_SHIFTED1_4 = {16,16,16,16, 4, 5, 6, 7,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_NOT_SHIFTED2_4 = {16,16,16,16,16,16,16,16, 8, 9,10,11,16,16,16,16}; ++static const vector unsigned char VSX_NOT_SHIFTED3_4 = {16,16,16,16,16,16,16,16,16,16,16,16,12,13,14,15}; ++ ++static const vector unsigned char VSX_NOT_SHIFTED1_3 = {16,16,16, 3, 4, 5,16,16,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_NOT_SHIFTED2_3 = {16,16,16,16,16,16, 6, 7, 8,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_NOT_SHIFTED3_3 = {16,16,16,16,16,16,16,16,16, 9,10,11,16,16,16,16}; ++static const vector unsigned char VSX_NOT_SHIFTED4_3 = {16,16,16,16,16,16,16,16,16,16,16,16,12,13,14,16}; ++ ++static const vector unsigned char VSX_CHAR_ZERO = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; ++#ifdef __LITTLE_ENDIAN__ ++ ++static const vector unsigned char VSX_CHAR_TO_SHORT1_4 = { 4,16, 5,16, 6,16, 7,16,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_CHAR_TO_SHORT2_4 = { 8,16, 9,16,10,16,11,16,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_CHAR_TO_SHORT3_4 = {12,16,13,16,14,16,15,16,16,16,16,16,16,16,16,16}; ++ ++static const vector unsigned char VSX_SHORT_TO_CHAR1_4 = {16,16,16,16, 0, 2, 4, 6,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_SHORT_TO_CHAR2_4 = {16,16,16,16,16,16,16,16, 0, 2, 4, 6,16,16,16,16}; ++static const vector unsigned char VSX_SHORT_TO_CHAR3_4 = {16,16,16,16,16,16,16,16,16,16,16,16, 0, 2, 4, 6}; ++ ++static const vector unsigned char VSX_CHAR_TO_SHORT1_3 = { 3,16, 4,16, 5,16,16,16,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_CHAR_TO_SHORT2_3 = { 6,16, 7,16, 8,16,16,16,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_CHAR_TO_SHORT3_3 = { 9,16,10,16,11,16,16,16,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_CHAR_TO_SHORT4_3 = {12,16,13,16,14,16,16,16,16,16,16,16,16,16,16,16}; ++ ++static const vector unsigned char VSX_SHORT_TO_CHAR1_3 = {16,16,16, 0, 2, 4,16,16,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_SHORT_TO_CHAR2_3 = {16,16,16,16,16,16, 0, 2, 4,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_SHORT_TO_CHAR3_3 = {16,16,16,16,16,16,16,16,16, 0, 2, 4,16,16,16,16}; ++static const vector unsigned char VSX_SHORT_TO_CHAR4_3 = {16,16,16,16,16,16,16,16,16,16,16,16, 0, 2, 4,16}; ++ ++#elif defined(__BIG_ENDIAN__) ++ ++static const vector unsigned char VSX_CHAR_TO_SHORT1_4 = {16, 4,16, 5,16, 6,16, 7,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_CHAR_TO_SHORT2_4 = {16, 8,16, 9,16,10,16,11,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_CHAR_TO_SHORT3_4 = {16,12,16,13,16,14,16,15,16,16,16,16,16,16,16,16}; ++ ++static const vector unsigned char VSX_SHORT_TO_CHAR1_4 = {16,16,16,16, 1, 3, 5, 7,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_SHORT_TO_CHAR2_4 = {16,16,16,16,16,16,16,16, 1, 3, 5, 7,16,16,16,16}; ++static const vector unsigned char VSX_SHORT_TO_CHAR3_4 = {16,16,16,16,16,16,16,16,16,16,16,16, 1, 3, 5, 7}; ++ ++static const vector unsigned char VSX_CHAR_TO_SHORT1_3 = {16, 3,16, 4,16, 5,16,16,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_CHAR_TO_SHORT2_3 = {16, 6,16, 7,16, 8,16,16,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_CHAR_TO_SHORT3_3 = {16, 9,16,10,16,11,16,16,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_CHAR_TO_SHORT4_3 = {16,12,16,13,16,14,16,16,16,16,16,16,16,16,16,16}; ++ ++static const vector unsigned char VSX_SHORT_TO_CHAR1_3 = {16,16,16, 1, 3, 5,16,16,16,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_SHORT_TO_CHAR2_3 = {16,16,16,16,16,16, 1, 3, 5,16,16,16,16,16,16,16}; ++static const vector unsigned char VSX_SHORT_TO_CHAR3_3 = {16,16,16,16,16,16,16,16,16, 1, 3, 5,16,16,16,16}; ++static const vector unsigned char VSX_SHORT_TO_CHAR4_3 = {16,16,16,16,16,16,16,16,16,16,16,16, 1, 3, 5,16}; ++ ++#endif ++ ++#define vsx_char_to_short(vec,offset,bpp) (vector unsigned short)vec_perm((vec),VSX_CHAR_ZERO,VSX_CHAR_TO_SHORT##offset##_##bpp) ++#define vsx_short_to_char(vec,offset,bpp) vec_perm(((vector unsigned char)(vec)),VSX_CHAR_ZERO,VSX_SHORT_TO_CHAR##offset##_##bpp) ++ ++#ifdef PNG_USE_ABS ++# define vsx_abs(number) abs(number) ++#else ++# define vsx_abs(number) (number > 0) ? (number) : -(number) ++#endif ++ ++void png_read_filter_row_sub4_vsx(png_row_infop row_info, png_bytep row, ++ png_const_bytep prev_row) ++{ ++ const png_byte bpp = 4; ++ ++ vector unsigned char rp_vec; ++ vector unsigned char part_vec; ++ ++ vsx_declare_common_vars(row_info,row,prev_row,bpp) ++ ++ PNG_UNUSED(pp) ++ ++ /* Altivec operations require 16-byte aligned data ++ * but input can be unaligned. So we calculate ++ * unaligned part as usual. ++ */ ++ for (i = 0; i < unaligned_top; i++) ++ { ++ *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff); ++ rp++; ++ } ++ ++ /* Using SIMD while we can */ ++ while( istop >= 16 ) ++ { ++ for(i=0;i < bpp ; i++) ++ { ++ *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff); ++ rp++; ++ } ++ rp -= bpp; ++ ++ rp_vec = vec_ld(0,rp); ++ part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED1_4); ++ rp_vec = vec_add(rp_vec,part_vec); ++ ++ part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED2_4); ++ rp_vec = vec_add(rp_vec,part_vec); ++ ++ part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED3_4); ++ rp_vec = vec_add(rp_vec,part_vec); ++ ++ vec_st(rp_vec,0,rp); ++ ++ rp += 16; ++ istop -= 16; ++ } ++ ++ if(istop > 0) ++ for (i = 0; i < istop % 16; i++) ++ { ++ *rp = (png_byte)(((int)(*rp) + (int)(*(rp - bpp))) & 0xff); ++ rp++; ++ } ++ ++} ++ ++void png_read_filter_row_sub3_vsx(png_row_infop row_info, png_bytep row, ++ png_const_bytep prev_row) ++{ ++ const png_byte bpp = 3; ++ ++ vector unsigned char rp_vec; ++ vector unsigned char part_vec; ++ ++ vsx_declare_common_vars(row_info,row,prev_row,bpp) ++ ++ PNG_UNUSED(pp) ++ ++ /* Altivec operations require 16-byte aligned data ++ * but input can be unaligned. So we calculate ++ * unaligned part as usual. ++ */ ++ for (i = 0; i < unaligned_top; i++) ++ { ++ *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff); ++ rp++; ++ } ++ ++ /* Using SIMD while we can */ ++ while( istop >= 16 ) ++ { ++ for(i=0;i < bpp ; i++) ++ { ++ *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff); ++ rp++; ++ } ++ rp -= bpp; ++ ++ rp_vec = vec_ld(0,rp); ++ part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED1_3); ++ rp_vec = vec_add(rp_vec,part_vec); ++ ++ part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED2_3); ++ rp_vec = vec_add(rp_vec,part_vec); ++ ++ part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED3_3); ++ rp_vec = vec_add(rp_vec,part_vec); ++ ++ part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED4_3); ++ rp_vec = vec_add(rp_vec,part_vec); ++ ++ vec_st(rp_vec,0,rp); ++ rp += 15; ++ istop -= 16; ++ ++ /* Since 16 % bpp = 16 % 3 = 1, last element of array must ++ * be proceeded manually ++ */ ++ *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff); ++ rp++; ++ } ++ ++ if(istop > 0) ++ for (i = 0; i < istop % 16; i++) ++ { ++ *rp = (png_byte)(((int)(*rp) + (int)(*(rp-bpp))) & 0xff); ++ rp++; ++ } ++} ++ ++void png_read_filter_row_avg4_vsx(png_row_infop row_info, png_bytep row, ++ png_const_bytep prev_row) ++{ ++ const png_byte bpp = 4; ++ ++ vector unsigned char rp_vec; ++ vector unsigned char pp_vec; ++ vector unsigned char pp_part_vec; ++ vector unsigned char rp_part_vec; ++ vector unsigned char avg_vec; ++ ++ vsx_declare_common_vars(row_info,row,prev_row,bpp) ++ rp -= bpp; ++ if(istop >= bpp) ++ istop -= bpp; ++ ++ for (i = 0; i < bpp; i++) ++ { ++ *rp = (png_byte)(((int)(*rp) + ++ ((int)(*pp++) / 2 )) & 0xff); ++ ++ rp++; ++ } ++ ++ /* Altivec operations require 16-byte aligned data ++ * but input can be unaligned. So we calculate ++ * unaligned part as usual. ++ */ ++ for (i = 0; i < unaligned_top; i++) ++ { ++ *rp = (png_byte)(((int)(*rp) + ++ (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff); ++ ++ rp++; ++ } ++ ++ /* Using SIMD while we can */ ++ while( istop >= 16 ) ++ { ++ for(i=0;i < bpp ; i++) ++ { ++ *rp = (png_byte)(((int)(*rp) + ++ (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff); ++ ++ rp++; ++ } ++ rp -= bpp; ++ pp -= bpp; ++ ++ vec_ld_unaligned(pp_vec,pp); ++ rp_vec = vec_ld(0,rp); ++ ++ rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED1_4); ++ pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED1_4); ++ avg_vec = vec_avg(rp_part_vec,pp_part_vec); ++ avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1))); ++ rp_vec = vec_add(rp_vec,avg_vec); ++ ++ rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED2_4); ++ pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED2_4); ++ avg_vec = vec_avg(rp_part_vec,pp_part_vec); ++ avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1))); ++ rp_vec = vec_add(rp_vec,avg_vec); ++ ++ rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED3_4); ++ pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED3_4); ++ avg_vec = vec_avg(rp_part_vec,pp_part_vec); ++ avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1))); ++ rp_vec = vec_add(rp_vec,avg_vec); ++ ++ vec_st(rp_vec,0,rp); ++ ++ rp += 16; ++ pp += 16; ++ istop -= 16; ++ } ++ ++ if(istop > 0) ++ for (i = 0; i < istop % 16; i++) ++ { ++ *rp = (png_byte)(((int)(*rp) + ++ (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff); ++ ++ rp++; ++ } ++} ++ ++void png_read_filter_row_avg3_vsx(png_row_infop row_info, png_bytep row, ++ png_const_bytep prev_row) ++{ ++ const png_byte bpp = 3; ++ ++ vector unsigned char rp_vec; ++ vector unsigned char pp_vec; ++ vector unsigned char pp_part_vec; ++ vector unsigned char rp_part_vec; ++ vector unsigned char avg_vec; ++ ++ vsx_declare_common_vars(row_info,row,prev_row,bpp) ++ rp -= bpp; ++ if(istop >= bpp) ++ istop -= bpp; ++ ++ for (i = 0; i < bpp; i++) ++ { ++ *rp = (png_byte)(((int)(*rp) + ++ ((int)(*pp++) / 2 )) & 0xff); ++ ++ rp++; ++ } ++ ++ /* Altivec operations require 16-byte aligned data ++ * but input can be unaligned. So we calculate ++ * unaligned part as usual. ++ */ ++ for (i = 0; i < unaligned_top; i++) ++ { ++ *rp = (png_byte)(((int)(*rp) + ++ (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff); ++ ++ rp++; ++ } ++ ++ /* Using SIMD while we can */ ++ while( istop >= 16 ) ++ { ++ for(i=0;i < bpp ; i++) ++ { ++ *rp = (png_byte)(((int)(*rp) + ++ (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff); ++ ++ rp++; ++ } ++ rp -= bpp; ++ pp -= bpp; ++ ++ vec_ld_unaligned(pp_vec,pp); ++ rp_vec = vec_ld(0,rp); ++ ++ rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED1_3); ++ pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED1_3); ++ avg_vec = vec_avg(rp_part_vec,pp_part_vec); ++ avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1))); ++ rp_vec = vec_add(rp_vec,avg_vec); ++ ++ rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED2_3); ++ pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED2_3); ++ avg_vec = vec_avg(rp_part_vec,pp_part_vec); ++ avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1))); ++ rp_vec = vec_add(rp_vec,avg_vec); ++ ++ rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED3_3); ++ pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED3_3); ++ avg_vec = vec_avg(rp_part_vec,pp_part_vec); ++ avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1))); ++ rp_vec = vec_add(rp_vec,avg_vec); ++ ++ rp_part_vec = vec_perm(rp_vec,VSX_CHAR_ZERO,VSX_LEFTSHIFTED4_3); ++ pp_part_vec = vec_perm(pp_vec,VSX_CHAR_ZERO,VSX_NOT_SHIFTED4_3); ++ avg_vec = vec_avg(rp_part_vec,pp_part_vec); ++ avg_vec = vec_sub(avg_vec, vec_and(vec_xor(rp_part_vec,pp_part_vec),vec_splat_u8(1))); ++ rp_vec = vec_add(rp_vec,avg_vec); ++ ++ vec_st(rp_vec,0,rp); ++ ++ rp += 15; ++ pp += 15; ++ istop -= 16; ++ ++ /* Since 16 % bpp = 16 % 3 = 1, last element of array must ++ * be proceeded manually ++ */ ++ *rp = (png_byte)(((int)(*rp) + ++ (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff); ++ rp++; ++ } ++ ++ if(istop > 0) ++ for (i = 0; i < istop % 16; i++) ++ { ++ *rp = (png_byte)(((int)(*rp) + ++ (int)(*pp++ + *(rp-bpp)) / 2 ) & 0xff); ++ ++ rp++; ++ } ++} ++ ++/* Bytewise c ? t : e. */ ++#define if_then_else(c,t,e) vec_sel(e,t,c) ++ ++#define vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) {\ ++ c = *(pp - bpp);\ ++ a = *(rp - bpp);\ ++ b = *pp++;\ ++ p = b - c;\ ++ pc = a - c;\ ++ pa = vsx_abs(p);\ ++ pb = vsx_abs(pc);\ ++ pc = vsx_abs(p + pc);\ ++ if (pb < pa) pa = pb, a = b;\ ++ if (pc < pa) a = c;\ ++ a += *rp;\ ++ *rp++ = (png_byte)a;\ ++ } ++ ++void png_read_filter_row_paeth4_vsx(png_row_infop row_info, png_bytep row, ++ png_const_bytep prev_row) ++{ ++ const png_byte bpp = 4; ++ ++ int a, b, c, pa, pb, pc, p; ++ vector unsigned char rp_vec; ++ vector unsigned char pp_vec; ++ vector unsigned short a_vec,b_vec,c_vec,nearest_vec; ++ vector signed short pa_vec,pb_vec,pc_vec,smallest_vec; ++ ++ vsx_declare_common_vars(row_info,row,prev_row,bpp) ++ rp -= bpp; ++ if(istop >= bpp) ++ istop -= bpp; ++ ++ /* Process the first pixel in the row completely (this is the same as 'up' ++ * because there is only one candidate predictor for the first row). ++ */ ++ for(i = 0; i < bpp ; i++) ++ { ++ *rp = (png_byte)( *rp + *pp); ++ rp++; ++ pp++; ++ } ++ ++ for(i = 0; i < unaligned_top ; i++) ++ { ++ vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) ++ } ++ ++ while( istop >= 16) ++ { ++ for(i = 0; i < bpp ; i++) ++ { ++ vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) ++ } ++ ++ rp -= bpp; ++ pp -= bpp; ++ rp_vec = vec_ld(0,rp); ++ vec_ld_unaligned(pp_vec,pp); ++ ++ a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED1_4),1,4); ++ b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED1_4),1,4); ++ c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED1_4),1,4); ++ pa_vec = (vector signed short) vec_sub(b_vec,c_vec); ++ pb_vec = (vector signed short) vec_sub(a_vec , c_vec); ++ pc_vec = vec_add(pa_vec,pb_vec); ++ pa_vec = vec_abs(pa_vec); ++ pb_vec = vec_abs(pb_vec); ++ pc_vec = vec_abs(pc_vec); ++ smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec)); ++ nearest_vec = if_then_else( ++ vec_cmpeq(pa_vec,smallest_vec), ++ a_vec, ++ if_then_else( ++ vec_cmpeq(pb_vec,smallest_vec), ++ b_vec, ++ c_vec ++ ) ++ ); ++ rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,1,4))); ++ ++ a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED2_4),2,4); ++ b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED2_4),2,4); ++ c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED2_4),2,4); ++ pa_vec = (vector signed short) vec_sub(b_vec,c_vec); ++ pb_vec = (vector signed short) vec_sub(a_vec , c_vec); ++ pc_vec = vec_add(pa_vec,pb_vec); ++ pa_vec = vec_abs(pa_vec); ++ pb_vec = vec_abs(pb_vec); ++ pc_vec = vec_abs(pc_vec); ++ smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec)); ++ nearest_vec = if_then_else( ++ vec_cmpeq(pa_vec,smallest_vec), ++ a_vec, ++ if_then_else( ++ vec_cmpeq(pb_vec,smallest_vec), ++ b_vec, ++ c_vec ++ ) ++ ); ++ rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,2,4))); ++ ++ a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED3_4),3,4); ++ b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED3_4),3,4); ++ c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED3_4),3,4); ++ pa_vec = (vector signed short) vec_sub(b_vec,c_vec); ++ pb_vec = (vector signed short) vec_sub(a_vec , c_vec); ++ pc_vec = vec_add(pa_vec,pb_vec); ++ pa_vec = vec_abs(pa_vec); ++ pb_vec = vec_abs(pb_vec); ++ pc_vec = vec_abs(pc_vec); ++ smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec)); ++ nearest_vec = if_then_else( ++ vec_cmpeq(pa_vec,smallest_vec), ++ a_vec, ++ if_then_else( ++ vec_cmpeq(pb_vec,smallest_vec), ++ b_vec, ++ c_vec ++ ) ++ ); ++ rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,3,4))); ++ ++ vec_st(rp_vec,0,rp); ++ ++ rp += 16; ++ pp += 16; ++ istop -= 16; ++ } ++ ++ if(istop > 0) ++ for (i = 0; i < istop % 16; i++) ++ { ++ vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) ++ } ++} ++ ++void png_read_filter_row_paeth3_vsx(png_row_infop row_info, png_bytep row, ++ png_const_bytep prev_row) ++{ ++ const png_byte bpp = 3; ++ ++ int a, b, c, pa, pb, pc, p; ++ vector unsigned char rp_vec; ++ vector unsigned char pp_vec; ++ vector unsigned short a_vec,b_vec,c_vec,nearest_vec; ++ vector signed short pa_vec,pb_vec,pc_vec,smallest_vec; ++ ++ vsx_declare_common_vars(row_info,row,prev_row,bpp) ++ rp -= bpp; ++ if(istop >= bpp) ++ istop -= bpp; ++ ++ /* Process the first pixel in the row completely (this is the same as 'up' ++ * because there is only one candidate predictor for the first row). ++ */ ++ for(i = 0; i < bpp ; i++) ++ { ++ *rp = (png_byte)( *rp + *pp); ++ rp++; ++ pp++; ++ } ++ ++ for(i = 0; i < unaligned_top ; i++) ++ { ++ vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) ++ } ++ ++ while( istop >= 16) ++ { ++ for(i = 0; i < bpp ; i++) ++ { ++ vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) ++ } ++ ++ rp -= bpp; ++ pp -= bpp; ++ rp_vec = vec_ld(0,rp); ++ vec_ld_unaligned(pp_vec,pp); ++ ++ a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED1_3),1,3); ++ b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED1_3),1,3); ++ c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED1_3),1,3); ++ pa_vec = (vector signed short) vec_sub(b_vec,c_vec); ++ pb_vec = (vector signed short) vec_sub(a_vec , c_vec); ++ pc_vec = vec_add(pa_vec,pb_vec); ++ pa_vec = vec_abs(pa_vec); ++ pb_vec = vec_abs(pb_vec); ++ pc_vec = vec_abs(pc_vec); ++ smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec)); ++ nearest_vec = if_then_else( ++ vec_cmpeq(pa_vec,smallest_vec), ++ a_vec, ++ if_then_else( ++ vec_cmpeq(pb_vec,smallest_vec), ++ b_vec, ++ c_vec ++ ) ++ ); ++ rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,1,3))); ++ ++ a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED2_3),2,3); ++ b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED2_3),2,3); ++ c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED2_3),2,3); ++ pa_vec = (vector signed short) vec_sub(b_vec,c_vec); ++ pb_vec = (vector signed short) vec_sub(a_vec , c_vec); ++ pc_vec = vec_add(pa_vec,pb_vec); ++ pa_vec = vec_abs(pa_vec); ++ pb_vec = vec_abs(pb_vec); ++ pc_vec = vec_abs(pc_vec); ++ smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec)); ++ nearest_vec = if_then_else( ++ vec_cmpeq(pa_vec,smallest_vec), ++ a_vec, ++ if_then_else( ++ vec_cmpeq(pb_vec,smallest_vec), ++ b_vec, ++ c_vec ++ ) ++ ); ++ rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,2,3))); ++ ++ a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED3_3),3,3); ++ b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED3_3),3,3); ++ c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED3_3),3,3); ++ pa_vec = (vector signed short) vec_sub(b_vec,c_vec); ++ pb_vec = (vector signed short) vec_sub(a_vec , c_vec); ++ pc_vec = vec_add(pa_vec,pb_vec); ++ pa_vec = vec_abs(pa_vec); ++ pb_vec = vec_abs(pb_vec); ++ pc_vec = vec_abs(pc_vec); ++ smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec)); ++ nearest_vec = if_then_else( ++ vec_cmpeq(pa_vec,smallest_vec), ++ a_vec, ++ if_then_else( ++ vec_cmpeq(pb_vec,smallest_vec), ++ b_vec, ++ c_vec ++ ) ++ ); ++ rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,3,3))); ++ ++ a_vec = vsx_char_to_short(vec_perm(rp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED4_3),4,3); ++ b_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_NOT_SHIFTED4_3),4,3); ++ c_vec = vsx_char_to_short(vec_perm(pp_vec , VSX_CHAR_ZERO , VSX_LEFTSHIFTED4_3),4,3); ++ pa_vec = (vector signed short) vec_sub(b_vec,c_vec); ++ pb_vec = (vector signed short) vec_sub(a_vec , c_vec); ++ pc_vec = vec_add(pa_vec,pb_vec); ++ pa_vec = vec_abs(pa_vec); ++ pb_vec = vec_abs(pb_vec); ++ pc_vec = vec_abs(pc_vec); ++ smallest_vec = vec_min(pc_vec, vec_min(pa_vec,pb_vec)); ++ nearest_vec = if_then_else( ++ vec_cmpeq(pa_vec,smallest_vec), ++ a_vec, ++ if_then_else( ++ vec_cmpeq(pb_vec,smallest_vec), ++ b_vec, ++ c_vec ++ ) ++ ); ++ rp_vec = vec_add(rp_vec,(vsx_short_to_char(nearest_vec,4,3))); ++ ++ vec_st(rp_vec,0,rp); ++ ++ rp += 15; ++ pp += 15; ++ istop -= 16; ++ ++ /* Since 16 % bpp = 16 % 3 = 1, last element of array must ++ * be proceeded manually ++ */ ++ vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) ++ } ++ ++ if(istop > 0) ++ for (i = 0; i < istop % 16; i++) ++ { ++ vsx_paeth_process(rp,pp,a,b,c,pa,pb,pc,bpp) ++ } ++} ++ ++#endif /* PNG_POWERPC_VSX_OPT > 0 */ ++#endif /* PNG_POWERPC_VSX_IMPLEMENTATION == 1 (intrinsics) */ ++#endif /* READ */ +new file mode 100644 +--- /dev/null ++++ qtwebengine/src/3rdparty/chromium/third_party/libpng/powerpc/powerpc_init.c +@@ -0,0 +1,125 @@ ++ ++/* powerpc_init.c - POWERPC optimised filter functions ++ * ++ * Copyright (c) 2017 Glenn Randers-Pehrson ++ * Written by Vadim Barkov, 2017. ++ * Last changed in libpng 1.6.29 [March 16, 2017] ++ * ++ * This code is released under the libpng license. ++ * For conditions of distribution and use, see the disclaimer ++ * and license in png.h ++ */ ++/* Below, after checking __linux__, various non-C90 POSIX 1003.1 functions are ++ * called. ++ */ ++#define _POSIX_SOURCE 1 ++ ++#include ++#include "../pngpriv.h" ++ ++#ifdef PNG_READ_SUPPORTED ++ ++#if PNG_POWERPC_VSX_OPT > 0 ++#ifdef PNG_POWERPC_VSX_CHECK_SUPPORTED /* Do run-time checks */ ++/* WARNING: it is strongly recommended that you do not build libpng with ++ * run-time checks for CPU features if at all possible. In the case of the PowerPC ++ * VSX instructions there is no processor-specific way of detecting the ++ * presence of the required support, therefore run-time detection is extremely ++ * OS specific. ++ * ++ * You may set the macro PNG_POWERPC_VSX_FILE to the file name of file containing ++ * a fragment of C source code which defines the png_have_vsx function. There ++ * are a number of implementations in contrib/powerpc-vsx, but the only one that ++ * has partial support is contrib/powerpc-vsx/linux.c - a generic Linux ++ * implementation which reads /proc/cpufino. ++ */ ++#ifndef PNG_POWERPC_VSX_FILE ++# ifdef __linux__ ++# define PNG_POWERPC_VSX_FILE "contrib/powerpc-vsx/linux_aux.c" ++# endif ++#endif ++ ++#ifdef PNG_POWERPC_VSX_FILE ++ ++#include /* for sig_atomic_t */ ++static int png_have_vsx(png_structp png_ptr); ++#include PNG_POWERPC_VSX_FILE ++ ++#else /* PNG_POWERPC_VSX_FILE */ ++# error "PNG_POWERPC_VSX_FILE undefined: no support for run-time POWERPC VSX checks" ++#endif /* PNG_POWERPC_VSX_FILE */ ++#endif /* PNG_POWERPC_VSX_CHECK_SUPPORTED */ ++ ++void ++png_init_filter_functions_vsx(png_structp pp, unsigned int bpp) ++{ ++ /* The switch statement is compiled in for POWERPC_VSX_API, the call to ++ * png_have_vsx is compiled in for POWERPC_VSX_CHECK. If both are defined ++ * the check is only performed if the API has not set the PowerPC option on ++ * or off explicitly. In this case the check controls what happens. ++ */ ++ ++#ifdef PNG_POWERPC_VSX_API_SUPPORTED ++ switch ((pp->options >> PNG_POWERPC_VSX) & 3) ++ { ++ case PNG_OPTION_UNSET: ++ /* Allow the run-time check to execute if it has been enabled - ++ * thus both API and CHECK can be turned on. If it isn't supported ++ * this case will fall through to the 'default' below, which just ++ * returns. ++ */ ++#endif /* PNG_POWERPC_VSX_API_SUPPORTED */ ++#ifdef PNG_POWERPC_VSX_CHECK_SUPPORTED ++ { ++ static volatile sig_atomic_t no_vsx = -1; /* not checked */ ++ ++ if (no_vsx < 0) ++ no_vsx = !png_have_vsx(pp); ++ ++ if (no_vsx) ++ return; ++ } ++#ifdef PNG_POWERPC_VSX_API_SUPPORTED ++ break; ++#endif ++#endif /* PNG_POWERPC_VSX_CHECK_SUPPORTED */ ++ ++#ifdef PNG_POWERPC_VSX_API_SUPPORTED ++ default: /* OFF or INVALID */ ++ return; ++ ++ case PNG_OPTION_ON: ++ /* Option turned on */ ++ break; ++ } ++#endif ++ ++ /* IMPORTANT: any new internal functions used here must be declared using ++ * PNG_INTERNAL_FUNCTION in ../pngpriv.h. This is required so that the ++ * 'prefix' option to configure works: ++ * ++ * ./configure --with-libpng-prefix=foobar_ ++ * ++ * Verify you have got this right by running the above command, doing a build ++ * and examining pngprefix.h; it must contain a #define for every external ++ * function you add. (Notice that this happens automatically for the ++ * initialization function.) ++ */ ++ pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up_vsx; ++ ++ if (bpp == 3) ++ { ++ pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_vsx; ++ pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_vsx; ++ pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth3_vsx; ++ } ++ ++ else if (bpp == 4) ++ { ++ pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_vsx; ++ pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_vsx; ++ pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth4_vsx; ++ } ++} ++#endif /* PNG_POWERPC_VSX_OPT > 0 */ ++#endif /* READ */ +--- qtwebengine/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h ++++ qtwebengine/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h +@@ -3914,7 +3914,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, +@@ -4045,7 +4045,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, +--- qtwebengine/src/3rdparty/chromium/third_party/node/node.py ++++ qtwebengine/src/3rdparty/chromium/third_party/node/node.py +@@ -10,11 +10,12 @@ import sys + + + def GetBinaryPath(): +- return os_path.join(os_path.dirname(__file__), *{ +- 'Darwin': ('mac', 'node-darwin-x64', 'bin', 'node'), +- 'Linux': ('linux', 'node-linux-x64', 'bin', 'node'), +- 'Windows': ('win', 'node.exe'), +- }[platform.system()]) ++ return "/usr/bin/node" ++ #return os_path.join(os_path.dirname(__file__), *{ ++ # 'Darwin': ('mac', 'node-darwin-x64', 'bin', 'node'), ++ # 'Linux': ('linux', 'node-linux-x64', 'bin', 'node'), ++ # 'Windows': ('win', 'node.exe'), ++ #}[platform.system()]) + + + def RunNode(cmd_parts, stdout=None): +--- qtwebengine/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_constants.h ++++ qtwebengine/src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/page_allocator_constants.h +@@ -11,7 +11,7 @@ + + namespace pdfium { + namespace base { +-#if defined(OS_WIN) ++#if defined(OS_WIN) || defined(ARCH_CPU_PPC64) + static constexpr size_t kPageAllocationGranularityShift = 16; // 64KB + #elif defined(_MIPS_ARCH_LOONGSON) + static constexpr size_t kPageAllocationGranularityShift = 14; // 16KB +@@ -27,6 +27,10 @@ static constexpr size_t kPageAllocationGranularityBaseMask = + + #if defined(_MIPS_ARCH_LOONGSON) + static constexpr size_t kSystemPageSize = 16384; ++#elif defined(ARCH_CPU_PPC64) ++// TODO: modern ppc64 can do 4k and 64k page sizes ++// for now, 64k is assumed ++static constexpr size_t kSystemPageSize = 65536; + #else + static constexpr size_t kSystemPageSize = 4096; + #endif +--- qtwebengine/src/3rdparty/chromium/third_party/sqlite/amalgamation/sqlite3.c ++++ qtwebengine/src/3rdparty/chromium/third_party/sqlite/amalgamation/sqlite3.c +@@ -13937,7 +13937,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__) +--- qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/differ_block.cc ++++ qtwebengine/src/3rdparty/chromium/third_party/webrtc/modules/desktop_capture/differ_block.cc +@@ -30,11 +30,7 @@ bool VectorDifference(const uint8_t* image1, const uint8_t* image2) { + static bool (*diff_proc)(const uint8_t*, const uint8_t*) = nullptr; + + if (!diff_proc) { +-#if defined(WEBRTC_ARCH_ARM_FAMILY) || defined(WEBRTC_ARCH_MIPS_FAMILY) +- // For ARM and MIPS processors, always use C version. +- // TODO(hclam): Implement a NEON version. +- diff_proc = &VectorDifference_C; +-#else ++#if defined(WEBRTC_ARCH_X86_FAMILY) + bool have_sse2 = WebRtc_GetCPUInfo(kSSE2) != 0; + // For x86 processors, check if SSE2 is supported. + if (have_sse2 && kBlockSize == 32) { +@@ -44,6 +40,10 @@ bool VectorDifference(const uint8_t* image1, const uint8_t* image2) { + } else { + diff_proc = &VectorDifference_C; + } ++#else ++ // For other processors, always use C version. ++ // TODO(hclam): Implement a NEON version. ++ diff_proc = &VectorDifference_C; + #endif + } + +--- qtwebengine/src/3rdparty/chromium/third_party/webrtc/rtc_base/system/arch.h ++++ qtwebengine/src/3rdparty/chromium/third_party/webrtc/rtc_base/system/arch.h +@@ -47,6 +47,18 @@ + #elif defined(__pnacl__) + #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 typedefs.h + #endif +--- qtwebengine/src/3rdparty/chromium/v8/BUILD.gn ++++ qtwebengine/src/3rdparty/chromium/v8/BUILD.gn +@@ -544,6 +544,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") { +--- qtwebengine/src/3rdparty/chromium/v8/test/BUILD.gn ++++ qtwebengine/src/3rdparty/chromium/v8/test/BUILD.gn +@@ -17,7 +17,7 @@ group("gn_all") { + "mozilla:v8_mozilla", + "preparser:v8_preparser", + "test262:v8_test262", + "wasm-js:v8_wasm_js", +- "wasm-spec-tests:v8_wasm_spec_tests", ++ #"wasm-spec-tests:v8_wasm_spec_tests", + "webkit:v8_webkit", + ] +@@ -80,9 +80,9 @@ group("v8_bot_default") { + "mjsunit:v8_mjsunit", + "mkgrokdump:mkgrokdump", + "preparser:v8_preparser", +- "unittests:unittests", ++ #"unittests:unittests", + "wasm-api-tests:wasm_api_tests", + "wasm-js:v8_wasm_js", +- "wasm-spec-tests:v8_wasm_spec_tests", ++ #"wasm-spec-tests:v8_wasm_spec_tests", + "webkit:v8_webkit", + ] +@@ -104,9 +104,9 @@ group("v8_default") { + "mkgrokdump:mkgrokdump", + "preparser:v8_preparser", +- "unittests:unittests", +- "wasm-api-tests:wasm_api_tests", +- "wasm-js:v8_wasm_js", +- "wasm-spec-tests:v8_wasm_spec_tests", ++ #"unittests:unittests", ++ #"wasm-api-tests:wasm_api_tests", ++ #"wasm-js:v8_wasm_js", ++ #"wasm-spec-tests:v8_wasm_spec_tests", + ] + } + diff --git a/srcpkgs/qt5-webengine/template b/srcpkgs/qt5-webengine/template new file mode 100644 index 0000000000..3faa5fb2bc --- /dev/null +++ b/srcpkgs/qt5-webengine/template @@ -0,0 +1,160 @@ +# Template file for 'qt5-webengine' +pkgname=qt5-webengine +version=5.14.2 +revision=1 +wrksrc="qtwebengine-everywhere-src-${version}" +archs="x86_64* i686* armv[67]* ppc64* aarch64*" +build_style=qmake +configure_args="-- + -webengine-icu -webengine-ffmpeg -webengine-opus -webengine-webp + -webengine-pepper-plugins -webengine-printing-and-pdf -webengine-proprietary-codecs + -webengine-pulseaudio -webengine-spellchecker -webengine-webrtc -webengine-geolocation + $(vopt_if snapshot '' '-no')-webengine-v8-snapshot -webengine-kerberos" +# Rely on auto detection (fails if forced for cross builds) -webengine-alsa +hostmakedepends="qt5-qmake gperf ninja qt5-host-tools flex pkg-config + which perl python protobuf" +makedepends="qt5-webchannel-devel qt5-location-devel qt5-tools-devel + qt5-declarative-devel libevent-devel snappy-devel icu-devel ffmpeg-devel + libwebp-devel opus-devel cups-devel nss-devel minizip-devel libxslt-devel + libvpx-devel re2-devel libXtst-devel libXcursor-devel libXcomposite-devel + jsoncpp-devel harfbuzz-devel lcms2-devel protobuf-devel pulseaudio-devel + libXrandr-devel MesaLib-devel mit-krb5-devel" +short_desc="Cross-platform application and UI framework (QT5) - WebEngine component" +maintainer="John " +license="GPL-3.0-or-later, LGPL-3.0-or-later" +homepage="https://qt.io/" +distfiles="http://download.qt.io/official_releases/qt/${version%.*}/${version}/submodules/qtwebengine-everywhere-src-${version}.tar.xz" +checksum=e169d6a75d8c397e04f843bc1b9585950fb9a001255cd18d6293f66fa8a6c947 +patch_args="-Np1" + +build_options="snapshot" +build_options_default="snapshot" + +if [ "$CROSS_BUILD" ]; then + hostmakedepends+=" nss-devel libevent-devel qt5-location-devel + qt5-declarative-devel" +fi + +if [ "$XBPS_TARGET_LIBC" = "musl" ]; then + makedepends+=" musl-legacy-compat" +fi + +if [ "$XBPS_LIBC" = "musl" ]; then + hostmakedepends+=" musl-legacy-compat" +fi + +if [ "$XBPS_WORDSIZE" -eq 32 ]; then + nodebug=yes # prevent OOM +fi + +if [ ! "$XBPS_WORDSIZE" = "$XBPS_TARGET_WORDSIZE" ]; then + broken="webengine can be built only if word size matches" +fi + +if [ "$XBPS_NO_ATOMIC8" ]; then + hostmakedepends+=" libatomic-devel" +fi +if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then + makedepends+=" libatomic-devel" +fi + +case "$XBPS_TARGET_MACHINE" in + armv7l*) broken="ERROR at //skia/BUILD.gn:707:11: Undefined identifier.";; + # configs -= [ "//build/config/compiler:compiler_arm_fpu" ] + armv6l*) broken="ERROR at //build/toolchain/gcc_toolchain.gni:102:3: Duplicate definition.";; +esac + +_bootstrap_gn() { + # Bootstrap gn (generate ninja) + echo "Bootstrapping 'gn'" + cd ${wrksrc}/src/3rdparty/gn + CFLAGS="$CFLAGS_host" CXXFLAGS="$CXXFLAGS_host" LDFLAGS="$LDFLAGS_host" \ + PKGCONFIG=/usr/bin/pkgconfig PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/share/pkgconfig" \ + python2 build/gen.py --no-last-commit-position --out-path \ + ${wrksrc}/src/3rdparty/gn/out/Release --cc "$CC_host" \ + --cxx "$CXX_host" --ld "$CXX_host" --ar "$AR_host" + ninja -C out/Release gn + cd ${wrksrc} +} + +_cleanup_wrksrc_leak() { + if [ -d "${PKGDESTDIR}/usr/lib/cmake" ]; then + # Replace references to ${wrksrc} in cmake files + vsed -i ${PKGDESTDIR}/usr/lib/cmake/*/*.cmake \ + -e "s;${wrksrc}/host;/usr/lib/qt5;g" \ + -e "s;devices/void-${XBPS_CROSS_TRIPLET}-g++;linux-g++;g" + fi + if [ -d "${PKGDESTDIR}/usr/lib/pkgconfig" ]; then + # Replace references to ${wrksrc} in pkgconfig files + vsed -i ${PKGDESTDIR}/usr/lib/pkgconfig/*.pc \ + -e "s;${wrksrc}/host;/usr/lib/qt5;g" \ + -e "s;devices/void-${XBPS_CROSS_TRIPLET}-g++;linux-g++;g" + fi + # Remove QMAKE_PRL_BUILD_DIR from hint files for static libraries + # and replace references to ${wrksrc} + find ${PKGDESTDIR} -iname "*.prl" -exec sed -i "{}" \ + -e "/^QMAKE_PRL_BUILD_DIR/d" \ + -e "s;-L${wrksrc}/qtbase/lib;-L/usr/lib;g" \; + # Replace ${wrksrc} in project include files + find ${PKGDESTDIR} -iname "*.pri" -exec sed -i "{}" \ + -e "s;${wrksrc}/qtbase;/usr/lib/qt5;g" \; +} + +pre_configure() { + export PATH=${PATH/\/builddir\/.xbps-qt5-webengine\/wrappers:/} + cp ${FILESDIR}/resolv_compat.h ${wrksrc}/src/3rdparty/chromium/net/dns + case "$XBPS_TARGET_MACHINE" in + armv5*|armv6*) # Disable "yield" assembler instruction + vsed -i src/3rdparty/chromium/base/allocator/partition_allocator/spin_lock.cc \ + src/3rdparty/chromium/third_party/pdfium/third_party/base/allocator/partition_allocator/spin_lock.cc \ + -e 's;"yield";"nop";' + ;; + esac + case "$XBPS_TARGET_MACHINE" in + *-musl) export CXXFLAGS+=" -D_POSIX_THREAD_ATTR_STACKSIZE=2097152";; + esac + case "$XBPS_TARGET_MACHINE" in + mips*) # sgidefs.h is in /usr/include/asm + for f in \ + qtwebengine/src/3rdparty/chromium/third_party/lss/linux_syscall_support.h \ + qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/android/include/asm-mips/fpregdef.h \ + qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/android/include/asm-mips/regdef.h \ + qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/common/android/include/asm-mips/asm.h \ + qtwebengine/src/3rdparty/chromium/third_party/tcmalloc/vendor/src/base/linux_syscall_support.h \ + qtwebengine/src/3rdparty/chromium/third_party/tcmalloc/chromium/src/base/linux_syscall_support.h \ + qtscript/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h; do + vsed -i $f -e "s;;;" + done + # Assume that RGBA order is correct for big endian CPUs + vsed -i qtwebengine/src/3rdparty/chromium/skia/config/SkUserConfig.h \ + -e '/#error Read the comment at this location/d' + ;; + esac + + if [ "$CROSS_BUILD" ]; then + _bootstrap_gn + fi +} + +pre_build() { + export NINJAJOBS=${makejobs} +} + +qt5-webengine-devel_package() { + depends="${sourcepkg}>=${version}_${revision}" + short_desc+=" - development files" + pkg_install() { + vmove usr/include + vmove usr/lib/cmake + vmove usr/lib/pkgconfig + vmove usr/lib/qt5/mkspecs + #TODO: FIX!!! + if [ -z "$CROSS_BUILD" ]; then + vmove usr/lib/qt5/plugins/designer + fi + vmove "usr/lib/*.so" + vmove "usr/lib/*.prl" + vmove "usr/lib/*.la" + _cleanup_wrksrc_leak + } +}