Skip to content

Commit

Permalink
Fix loongarch64 support patch in src dir
Browse files Browse the repository at this point in the history
  • Loading branch information
wjh-la committed Dec 19, 2024
1 parent 3469ba1 commit e6e9fe4
Showing 1 changed file with 46 additions and 16 deletions.
62 changes: 46 additions & 16 deletions patch/patches/loongarch64_support_src_for_cef.patch
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,28 @@ index 591afd7d1dcba..68a444ebd9fbd 100644
}

pkg_config_script = "//build/config/linux/pkg-config.py"
diff --git build/config/rust.gni build/config/rust.gni
index b7e3c8881b589..c4fe35c559561 100644
--- build/config/rust.gni
+++ build/config/rust.gni
@@ -193,6 +193,8 @@ rust_abi_target = ""
if (is_linux || is_chromeos) {
if (current_cpu == "arm64") {
rust_abi_target = "aarch64-unknown-linux-gnu"
+ } else if (current_cpu == "loong64") {
+ rust_abi_target = "loongarch64-unknown-linux-gnu"
} else if (current_cpu == "x86") {
rust_abi_target = "i686-unknown-linux-gnu"
} else if (current_cpu == "x64") {
@@ -299,6 +301,8 @@ if (current_cpu == "x86") {
rust_target_arch = "powerpc64"
} else if (current_cpu == "riscv64") {
rust_target_arch = "riscv64"
+} else if (current_cpu == "loong64") {
+ rust_target_arch = "loongarch64"
}

assert(!toolchain_has_rust || rust_target_arch != "")
diff --git build/config/sysroot.gni build/config/sysroot.gni
index 47fe4cbc840dd..d89b9b4431352 100644
--- build/config/sysroot.gni
Expand Down Expand Up @@ -424,7 +446,7 @@ index bb0e13f4d2d9c..e9ae7ce32afc4 100644
#if defined(__arm__)
PTRACE_GETVFPREGS,
diff --git sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
index 4f56b6e0d10db..c550967a4309a 100644
index 4f56b6e0d10db..8d40965583f64 100644
--- sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+++ sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
@@ -103,7 +103,7 @@ bool SyscallSets::IsUmask(int sysno) {
Expand Down Expand Up @@ -551,7 +573,15 @@ index 4f56b6e0d10db..c550967a4309a 100644
case __NR_accept:
case __NR_accept4:
case __NR_bind:
@@ -554,7 +561,7 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
@@ -548,13 +555,15 @@ bool SyscallSets::IsAllowedAddressSpaceAccess(int sysno) {
case __NR_mlock:
case __NR_munlock:
case __NR_munmap:
+#if !defined(__loongarch64)
case __NR_mseal:
+#endif
return true;
case __NR_madvise:
case __NR_mincore:
case __NR_mlockall:
#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
Expand All @@ -560,7 +590,7 @@ index 4f56b6e0d10db..c550967a4309a 100644
case __NR_mmap:
#endif
#if defined(__i386__) || defined(__arm__) || \
@@ -587,7 +594,7 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
@@ -587,7 +596,7 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
(defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
case __NR__llseek:
#endif
Expand All @@ -569,7 +599,7 @@ index 4f56b6e0d10db..c550967a4309a 100644
case __NR_poll:
#endif
case __NR_ppoll:
@@ -608,7 +615,7 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
@@ -608,7 +617,7 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
case __NR_recv:
#endif
#if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
Expand All @@ -578,7 +608,7 @@ index 4f56b6e0d10db..c550967a4309a 100644
case __NR_recvfrom: // Could specify source.
case __NR_recvmsg: // Could specify source.
#endif
@@ -623,7 +630,7 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
@@ -623,7 +632,7 @@ bool SyscallSets::IsAllowedGeneralIo(int sysno) {
case __NR_send:
#endif
#if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
Expand All @@ -587,7 +617,7 @@ index 4f56b6e0d10db..c550967a4309a 100644
case __NR_sendmsg: // Could specify destination.
case __NR_sendto: // Could specify destination.
#endif
@@ -672,7 +679,7 @@ bool SyscallSets::IsSeccomp(int sysno) {
@@ -672,7 +681,7 @@ bool SyscallSets::IsSeccomp(int sysno) {
bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
switch (sysno) {
case __NR_sched_yield:
Expand All @@ -596,7 +626,7 @@ index 4f56b6e0d10db..c550967a4309a 100644
case __NR_pause:
#endif
case __NR_nanosleep:
@@ -756,7 +763,7 @@ bool SyscallSets::IsNuma(int sysno) {
@@ -756,7 +765,7 @@ bool SyscallSets::IsNuma(int sysno) {
case __NR_getcpu:
case __NR_mbind:
#if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
Expand All @@ -605,7 +635,7 @@ index 4f56b6e0d10db..c550967a4309a 100644
case __NR_migrate_pages:
#endif
case __NR_move_pages:
@@ -804,7 +811,9 @@ bool SyscallSets::IsGlobalProcessEnvironment(int sysno) {
@@ -804,7 +813,9 @@ bool SyscallSets::IsGlobalProcessEnvironment(int sysno) {
case __NR_getrusage:
case __NR_personality: // Can change its personality as well.
case __NR_prlimit64: // Like setrlimit / getrlimit.
Expand All @@ -615,7 +645,7 @@ index 4f56b6e0d10db..c550967a4309a 100644
case __NR_times:
return true;
default:
@@ -826,7 +835,7 @@ bool SyscallSets::IsDebug(int sysno) {
@@ -826,7 +837,7 @@ bool SyscallSets::IsDebug(int sysno) {

bool SyscallSets::IsGlobalSystemStatus(int sysno) {
switch (sysno) {
Expand All @@ -624,7 +654,7 @@ index 4f56b6e0d10db..c550967a4309a 100644
case __NR__sysctl:
case __NR_sysfs:
#endif
@@ -844,7 +853,7 @@ bool SyscallSets::IsGlobalSystemStatus(int sysno) {
@@ -844,7 +855,7 @@ bool SyscallSets::IsGlobalSystemStatus(int sysno) {

bool SyscallSets::IsEventFd(int sysno) {
switch (sysno) {
Expand All @@ -633,7 +663,7 @@ index 4f56b6e0d10db..c550967a4309a 100644
case __NR_eventfd:
#endif
case __NR_eventfd2:
@@ -896,7 +905,8 @@ bool SyscallSets::IsKeyManagement(int sysno) {
@@ -896,7 +907,8 @@ bool SyscallSets::IsKeyManagement(int sysno) {
}

#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
Expand All @@ -643,7 +673,7 @@ index 4f56b6e0d10db..c550967a4309a 100644
bool SyscallSets::IsSystemVSemaphores(int sysno) {
switch (sysno) {
case __NR_semctl:
@@ -915,7 +925,7 @@ bool SyscallSets::IsSystemVSemaphores(int sysno) {
@@ -915,7 +927,7 @@ bool SyscallSets::IsSystemVSemaphores(int sysno) {
#endif

#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
Expand All @@ -652,7 +682,7 @@ index 4f56b6e0d10db..c550967a4309a 100644
(defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
// These give a lot of ambient authority and bypass the setuid sandbox.
bool SyscallSets::IsSystemVSharedMemory(int sysno) {
@@ -932,7 +942,8 @@ bool SyscallSets::IsSystemVSharedMemory(int sysno) {
@@ -932,7 +944,8 @@ bool SyscallSets::IsSystemVSharedMemory(int sysno) {
#endif

#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
Expand All @@ -662,7 +692,7 @@ index 4f56b6e0d10db..c550967a4309a 100644
bool SyscallSets::IsSystemVMessageQueue(int sysno) {
switch (sysno) {
case __NR_msgctl:
@@ -963,7 +974,8 @@ bool SyscallSets::IsSystemVIpc(int sysno) {
@@ -963,7 +976,8 @@ bool SyscallSets::IsSystemVIpc(int sysno) {

bool SyscallSets::IsAnySystemV(int sysno) {
#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
Expand All @@ -672,7 +702,7 @@ index 4f56b6e0d10db..c550967a4309a 100644
return IsSystemVMessageQueue(sysno) || IsSystemVSemaphores(sysno) ||
IsSystemVSharedMemory(sysno);
#elif defined(__i386__) || \
@@ -1000,7 +1012,7 @@ bool SyscallSets::IsAdvancedScheduler(int sysno) {
@@ -1000,7 +1014,7 @@ bool SyscallSets::IsAdvancedScheduler(int sysno) {
bool SyscallSets::IsInotify(int sysno) {
switch (sysno) {
case __NR_inotify_add_watch:
Expand All @@ -681,7 +711,7 @@ index 4f56b6e0d10db..c550967a4309a 100644
case __NR_inotify_init:
#endif
case __NR_inotify_init1:
@@ -1135,7 +1147,7 @@ bool SyscallSets::IsMisc(int sysno) {
@@ -1135,7 +1149,7 @@ bool SyscallSets::IsMisc(int sysno) {
#if defined(__x86_64__)
case __NR_tuxcall:
#endif
Expand Down

0 comments on commit e6e9fe4

Please sign in to comment.