Skip to content

Instantly share code, notes, and snippets.

@xry111
Created April 21, 2022 16:28
Show Gist options
  • Save xry111/43241d48ac7292271cd8ade8ef0a5b91 to your computer and use it in GitHub Desktop.
Save xry111/43241d48ac7292271cd8ade8ef0a5b91 to your computer and use it in GitHub Desktop.
diff --color -Naur firefox-91.8.0.orig/build/moz.configure/init.configure firefox-91.8.0.patched/build/moz.configure/init.configure
--- firefox-91.8.0.orig/build/moz.configure/init.configure 2022-03-31 03:25:29.000000000 +0800
+++ firefox-91.8.0.patched/build/moz.configure/init.configure 2022-04-21 19:24:15.397434052 +0800
@@ -753,6 +753,9 @@
elif cpu.startswith("arm"):
canonical_cpu = "arm"
endianness = "big" if cpu.startswith(("armeb", "armbe")) else "little"
+ elif cpu in ("loongarch64"):
+ canonical_cpu = "loongarch64"
+ endianness = "little"
elif cpu in ("m68k"):
canonical_cpu = "m68k"
endianness = "big"
diff --color -Naur firefox-91.8.0.orig/js/src/jit/AtomicOperations.h firefox-91.8.0.patched/js/src/jit/AtomicOperations.h
--- firefox-91.8.0.orig/js/src/jit/AtomicOperations.h 2022-03-31 03:25:41.000000000 +0800
+++ firefox-91.8.0.patched/js/src/jit/AtomicOperations.h 2022-04-21 19:33:16.004766430 +0800
@@ -382,7 +382,8 @@
defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || \
defined(__PPC64LE__) || defined(__alpha__) || defined(__hppa__) || \
defined(__sh__) || defined(__s390__) || defined(__s390x__) || \
- defined(__m68k__) || defined(__riscv) || defined(__wasi__)
+ defined(__m68k__) || defined(__riscv) || defined(__wasi__) || \
+ defined(__loongarch__)
# include "jit/shared/AtomicOperations-feeling-lucky.h"
#else
# error "No AtomicOperations support provided for this platform"
diff --color -Naur firefox-91.8.0.orig/mfbt/double-conversion/double-conversion/utils.h firefox-91.8.0.patched/mfbt/double-conversion/double-conversion/utils.h
--- firefox-91.8.0.orig/mfbt/double-conversion/double-conversion/utils.h 2022-03-31 03:26:09.000000000 +0800
+++ firefox-91.8.0.patched/mfbt/double-conversion/double-conversion/utils.h 2022-04-21 19:35:21.790953483 +0800
@@ -118,7 +118,7 @@
defined(__riscv) || defined(__e2k__) || \
defined(__or1k__) || defined(__arc__) || \
defined(__microblaze__) || defined(__XTENSA__) || \
- defined(__EMSCRIPTEN__) || defined(__wasm32__)
+ defined(__EMSCRIPTEN__) || defined(__wasm32__) || defined (__loongarch__)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
#elif defined(__mc68000__) || \
defined(__pnacl__) || defined(__native_client__)
diff --color -Naur firefox-91.8.0.orig/mfbt/tests/TestPoisonArea.cpp firefox-91.8.0.patched/mfbt/tests/TestPoisonArea.cpp
--- firefox-91.8.0.orig/mfbt/tests/TestPoisonArea.cpp 2022-03-31 03:25:49.000000000 +0800
+++ firefox-91.8.0.patched/mfbt/tests/TestPoisonArea.cpp 2022-04-21 19:50:20.629202549 +0800
@@ -175,6 +175,9 @@
# define RETURN_INSTR _return_instr
# define RETURN_INSTR_TYPE ia64_instr
+#elif defined __loongarch__
+# define RETURN_INSTR 0x4c000020 /* jirl $r0, $r1, 0 */
+
#else
# error "Need return instruction for this architecture"
#endif
diff --color -Naur firefox-91.8.0.orig/python/mozbuild/mozbuild/configure/constants.py firefox-91.8.0.patched/python/mozbuild/mozbuild/configure/constants.py
--- firefox-91.8.0.orig/python/mozbuild/mozbuild/configure/constants.py 2022-03-31 03:25:55.000000000 +0800
+++ firefox-91.8.0.patched/python/mozbuild/mozbuild/configure/constants.py 2022-04-21 19:29:55.703485672 +0800
@@ -47,6 +47,7 @@
"arm": 32,
"hppa": 32,
"ia64": 64,
+ "loongarch64": 64,
"m68k": 32,
"mips32": 32,
"mips64": 64,
@@ -91,6 +92,7 @@
("hppa", "__hppa__"),
("sparc64", "__sparc__ && __arch64__"),
("sparc", "__sparc__"),
+ ("loongarch64", "__loongarch__ && __loongarch_grlen == 64"),
("m68k", "__m68k__"),
("mips64", "__mips64"),
("mips32", "__mips__"),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment