Files
haikuports/dev-qt/qtwebengine/patches/qtwebengine-5.15.17-x86-fixes.patchset
2024-08-29 23:14:37 +10:00

279 lines
12 KiB
Plaintext

From 39ce9c4c5c028a79975fc9275122c9c403cf6250 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 16 Dec 2023 18:56:29 +1000
Subject: Fixes build for x86 arch
diff --git a/src/3rdparty/chromium/base/atomicops.h b/src/3rdparty/chromium/base/atomicops.h
index 5fa27a4..1122b5f 100644
--- a/src/3rdparty/chromium/base/atomicops.h
+++ b/src/3rdparty/chromium/base/atomicops.h
@@ -57,7 +57,11 @@ typedef intptr_t Atomic64;
// Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or
// Atomic64 routines below, depending on your architecture.
+#if defined(ARCH_CPU_64_BITS)
typedef intptr_t AtomicWord;
+#else
+typedef int32_t AtomicWord;
+#endif
// Atomically execute:
// result = *ptr;
diff --git a/src/3rdparty/chromium/base/memory/discardable_shared_memory.cc b/src/3rdparty/chromium/base/memory/discardable_shared_memory.cc
index 4aa6229..cdfde4f 100644
--- a/src/3rdparty/chromium/base/memory/discardable_shared_memory.cc
+++ b/src/3rdparty/chromium/base/memory/discardable_shared_memory.cc
@@ -178,7 +178,11 @@ bool DiscardableSharedMemory::CreateAndMap(size_t size) {
DCHECK(last_known_usage_.is_null());
SharedState new_state(SharedState::LOCKED, Time());
subtle::Release_Store(
+#if defined(ARCH_CPU_64_BITS)
&SharedStateFromSharedMemory(shared_memory_mapping_)->value.i,
+#else
+ (base::subtle::Atomic32*)&SharedStateFromSharedMemory(shared_memory_mapping_)->value.i,
+#endif
new_state.value.i);
return true;
}
@@ -239,7 +243,11 @@ DiscardableSharedMemory::LockResult DiscardableSharedMemory::Lock(
SharedState old_state(SharedState::UNLOCKED, last_known_usage_);
SharedState new_state(SharedState::LOCKED, Time());
SharedState result(subtle::Acquire_CompareAndSwap(
+#if defined(ARCH_CPU_64_BITS)
&SharedStateFromSharedMemory(shared_memory_mapping_)->value.i,
+#else
+ (base::subtle::Atomic32*)&SharedStateFromSharedMemory(shared_memory_mapping_)->value.i,
+#endif
old_state.value.i, new_state.value.i));
if (result.value.u != old_state.value.u) {
// Update |last_known_usage_| in case the above CAS failed because of
@@ -354,7 +362,11 @@ void DiscardableSharedMemory::Unlock(size_t offset, size_t length) {
DCHECK_EQ((new_state.GetTimestamp() - Time::UnixEpoch()).InSeconds(),
(current_time - Time::UnixEpoch()).InSeconds());
SharedState result(subtle::Release_CompareAndSwap(
+#if defined(ARCH_CPU_64_BITS)
&SharedStateFromSharedMemory(shared_memory_mapping_)->value.i,
+#else
+ (base::subtle::Atomic32*)&SharedStateFromSharedMemory(shared_memory_mapping_)->value.i,
+#endif
old_state.value.i, new_state.value.i));
DCHECK_EQ(old_state.value.u, result.value.u);
@@ -375,7 +387,11 @@ bool DiscardableSharedMemory::Purge(Time current_time) {
SharedState old_state(SharedState::UNLOCKED, last_known_usage_);
SharedState new_state(SharedState::UNLOCKED, Time());
SharedState result(subtle::Acquire_CompareAndSwap(
+#if defined(ARCH_CPU_64_BITS)
&SharedStateFromSharedMemory(shared_memory_mapping_)->value.i,
+#else
+ (base::subtle::Atomic32*)&SharedStateFromSharedMemory(shared_memory_mapping_)->value.i,
+#endif
old_state.value.i, new_state.value.i));
// Update |last_known_usage_| to |current_time| if the memory is locked. This
@@ -466,7 +482,11 @@ bool DiscardableSharedMemory::IsMemoryResident() const {
DCHECK(shared_memory_mapping_.IsValid());
SharedState result(subtle::NoBarrier_Load(
+#if defined(ARCH_CPU_64_BITS)
&SharedStateFromSharedMemory(shared_memory_mapping_)->value.i));
+#else
+ (base::subtle::Atomic32*)&SharedStateFromSharedMemory(shared_memory_mapping_)->value.i));
+#endif
return result.GetLockState() == SharedState::LOCKED ||
!result.GetTimestamp().is_null();
@@ -476,7 +496,11 @@ bool DiscardableSharedMemory::IsMemoryLocked() const {
DCHECK(shared_memory_mapping_.IsValid());
SharedState result(subtle::NoBarrier_Load(
+#if defined(ARCH_CPU_64_BITS)
&SharedStateFromSharedMemory(shared_memory_mapping_)->value.i));
+#else
+ (base::subtle::Atomic32*)&SharedStateFromSharedMemory(shared_memory_mapping_)->value.i));
+#endif
return result.GetLockState() == SharedState::LOCKED;
}
diff --git a/src/3rdparty/chromium/base/process/internal_linux.cc b/src/3rdparty/chromium/base/process/internal_linux.cc
index 41cae83..48f76d3 100644
--- a/src/3rdparty/chromium/base/process/internal_linux.cc
+++ b/src/3rdparty/chromium/base/process/internal_linux.cc
@@ -47,13 +47,17 @@ pid_t ProcDirSlotToPid(const char* d_name) {
return 0;
// Read the process's command line.
+#if defined(ARCH_CPU_64_BITS)
pid_t pid;
+#else
+ int pid;
+#endif
std::string pid_string(d_name);
if (!StringToInt(pid_string, &pid)) {
NOTREACHED();
return 0;
}
- return pid;
+ return (pid_t)pid;
}
bool ReadProcFile(const FilePath& file, std::string* buffer) {
diff --git a/src/3rdparty/chromium/base/process/internal_linux.h b/src/3rdparty/chromium/base/process/internal_linux.h
index 10fa85a..cfd5647 100644
--- a/src/3rdparty/chromium/base/process/internal_linux.h
+++ b/src/3rdparty/chromium/base/process/internal_linux.h
@@ -121,8 +121,15 @@ void ForEachProcessTask(base::ProcessHandle process, Lambda&& lambda) {
continue;
PlatformThreadId tid;
+#if defined(ARCH_CPU_64_BITS)
if (!StringToInt(tid_str, &tid))
continue;
+#else
+ int tid_int;
+ if (!StringToInt(tid_str, &tid_int))
+ continue;
+ tid = (PlatformThreadId)tid_int;
+#endif
FilePath task_path = fd_path.Append(tid_str);
lambda(tid, task_path);
diff --git a/src/3rdparty/chromium/base/process/process_handle.h b/src/3rdparty/chromium/base/process/process_handle.h
index d7e185a..4b49da5 100644
--- a/src/3rdparty/chromium/base/process/process_handle.h
+++ b/src/3rdparty/chromium/base/process/process_handle.h
@@ -36,6 +36,11 @@ typedef zx_handle_t ProcessHandle;
typedef zx_koid_t ProcessId;
const ProcessHandle kNullProcessHandle = ZX_HANDLE_INVALID;
const ProcessId kNullProcessId = ZX_KOID_INVALID;
+#elif defined(OS_HAIKU)
+typedef int32_t ProcessHandle;
+typedef int32_t ProcessId;
+const ProcessHandle kNullProcessHandle = 0;
+const ProcessId kNullProcessId = 0;
#elif defined(OS_POSIX)
// On POSIX, our ProcessHandle will just be the PID.
typedef pid_t ProcessHandle;
diff --git a/src/3rdparty/chromium/base/system/sys_info_posix.cc b/src/3rdparty/chromium/base/system/sys_info_posix.cc
index 9a58b6d..e018730 100644
--- a/src/3rdparty/chromium/base/system/sys_info_posix.cc
+++ b/src/3rdparty/chromium/base/system/sys_info_posix.cc
@@ -219,7 +219,7 @@ std::string SysInfo::OperatingSystemArchitecture() {
return std::string();
}
std::string arch(info.machine);
- if (arch == "i386" || arch == "i486" || arch == "i586" || arch == "i686") {
+ if (arch == "i386" || arch == "i486" || arch == "i586" || arch == "i686" || arch == "BePC") {
arch = "x86";
} else if (arch == "amd64") {
arch = "x86_64";
diff --git a/src/3rdparty/chromium/content/browser/zygote_host/zygote_host_impl_linux.cc b/src/3rdparty/chromium/content/browser/zygote_host/zygote_host_impl_linux.cc
index 6870307..2664266 100644
--- a/src/3rdparty/chromium/content/browser/zygote_host/zygote_host_impl_linux.cc
+++ b/src/3rdparty/chromium/content/browser/zygote_host/zygote_host_impl_linux.cc
@@ -177,7 +177,11 @@ pid_t ZygoteHostImpl::LaunchZygote(
close(fds[1]);
control_fd->reset(fds[0]);
+#if defined(ARCH_CPU_64_BITS)
pid_t pid = process.Pid();
+#else
+ int32_t pid = process.Pid();
+#endif
if (is_sandboxed_zygote && (use_namespace_sandbox_ || use_suid_sandbox_)) {
// The namespace and SUID sandbox will execute the zygote in a new
@@ -200,7 +204,11 @@ pid_t ZygoteHostImpl::LaunchZygote(
// Now receive the message that the zygote's ready to go, along with the
// main zygote process's ID.
+#if defined(ARCH_CPU_64_BITS)
pid_t real_pid;
+#else
+ int32_t real_pid;
+#endif
CHECK(ReceiveFixedMessage(fds[0], kZygoteHelloMessage,
sizeof(kZygoteHelloMessage), &real_pid));
CHECK_GT(real_pid, 1);
diff --git a/src/3rdparty/chromium/content/common/zygote/zygote_communication_linux.cc b/src/3rdparty/chromium/content/common/zygote/zygote_communication_linux.cc
index 474be46..9ec8402 100644
--- a/src/3rdparty/chromium/content/common/zygote/zygote_communication_linux.cc
+++ b/src/3rdparty/chromium/content/common/zygote/zygote_communication_linux.cc
@@ -123,7 +123,11 @@ pid_t ZygoteCommunication::ForkRequest(
// Sanity check that we've populated |fds| correctly.
DCHECK_EQ(num_fds_to_send, fds.size());
+#if defined(ARCH_CPU_64_BITS)
pid_t pid;
+#else
+ int32_t pid;
+#endif
{
base::AutoLock lock(control_lock_);
if (!SendMessage(pickle, &fds))
diff --git a/src/3rdparty/chromium/gpu/ipc/common/memory_stats_mojom_traits.h b/src/3rdparty/chromium/gpu/ipc/common/memory_stats_mojom_traits.h
index e76b61b..97a3e17 100644
--- a/src/3rdparty/chromium/gpu/ipc/common/memory_stats_mojom_traits.h
+++ b/src/3rdparty/chromium/gpu/ipc/common/memory_stats_mojom_traits.h
@@ -37,7 +37,7 @@ struct StructTraits<gpu::mojom::VideoMemoryUsageStatsDataView,
gpu::VideoMemoryUsageStats> {
static std::map<int32_t, gpu::VideoMemoryUsageStats::ProcessStats>
process_map(const gpu::VideoMemoryUsageStats& stats) {
-#if defined(OS_WIN) || defined(OS_FUCHSIA)
+#if defined(OS_WIN) || defined(OS_FUCHSIA) || defined(OS_HAIKU)
std::map<int32_t, gpu::VideoMemoryUsageStats::ProcessStats> map;
for (const auto& pair : stats.process_map)
map[static_cast<int32_t>(pair.first)] = pair.second;
@@ -53,7 +53,7 @@ struct StructTraits<gpu::mojom::VideoMemoryUsageStatsDataView,
static bool Read(gpu::mojom::VideoMemoryUsageStatsDataView data,
gpu::VideoMemoryUsageStats* out) {
-#if defined(OS_WIN) || defined(OS_FUCHSIA)
+#if defined(OS_WIN) || defined(OS_FUCHSIA) || defined(OS_HAIKU)
std::map<int32_t, gpu::VideoMemoryUsageStats::ProcessStats> process_map;
if (!data.ReadProcessMap(&process_map))
return false;
diff --git a/src/3rdparty/chromium/third_party/blink/public/platform/web_vector.h b/src/3rdparty/chromium/third_party/blink/public/platform/web_vector.h
index 2cc291d..83b2538 100644
--- a/src/3rdparty/chromium/third_party/blink/public/platform/web_vector.h
+++ b/src/3rdparty/chromium/third_party/blink/public/platform/web_vector.h
@@ -81,7 +81,7 @@ class WebVector {
// The vector can be populated using reserve() and emplace_back().
WebVector() = default;
-#if defined(ARCH_CPU_64_BITS)
+#if defined(ARCH_CPU_64_BITS) || defined(__HAIKU__)
// Create a vector with |size| default-constructed elements. We define
// a constructor with size_t otherwise we'd have a duplicate define.
explicit WebVector(size_t size) : data_(size) {}
diff --git a/src/3rdparty/chromium/v8/src/base/atomicops.h b/src/3rdparty/chromium/v8/src/base/atomicops.h
index 5d6422b..9299d4c 100644
--- a/src/3rdparty/chromium/v8/src/base/atomicops.h
+++ b/src/3rdparty/chromium/v8/src/base/atomicops.h
@@ -73,6 +73,8 @@ using Atomic64 = intptr_t;
// Atomic64 routines below, depending on your architecture.
#if defined(V8_OS_STARBOARD)
using AtomicWord = SbAtomicPtr;
+#elif defined(V8_TARGET_ARCH_IA32)
+using AtomicWord = int32_t;
#else
using AtomicWord = intptr_t;
#endif
diff --git a/src/3rdparty/gn/tools/gn/args.cc b/src/3rdparty/gn/tools/gn/args.cc
index a2f49b1..0d79586 100644
--- a/src/3rdparty/gn/tools/gn/args.cc
+++ b/src/3rdparty/gn/tools/gn/args.cc
@@ -336,7 +336,7 @@ void Args::SetSystemVarsLocked(Scope* dest) const {
// Set the host CPU architecture based on the underlying OS, not
// whatever the current bit-tedness of the GN binary is.
std::string os_arch = OperatingSystemArchitecture();
- if (os_arch == "x86")
+ if (os_arch == "x86" || os_arch == "BePC")
arch = kX86;
else if (os_arch == "x86_64")
arch = kX64;
--
2.42.1