From 49f0016002e0af5459c35276db270e1f37f3dcbd Mon Sep 17 00:00:00 2001 From: Wenlong Zhang Date: Thu, 28 Mar 2024 08:52:22 +0000 Subject: [PATCH] fix build error for loongarch64 (cherry picked from commit fa8eab48a4d21c9e227da17cb265f9b4a45d2a9b) --- ...piler-of-loongarch64-port-by-default.patch | 55 +++++++++++++++++++ mozjs102.spec | 10 +++- 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 enable-jit-compiler-of-loongarch64-port-by-default.patch diff --git a/enable-jit-compiler-of-loongarch64-port-by-default.patch b/enable-jit-compiler-of-loongarch64-port-by-default.patch new file mode 100644 index 0000000..c2384cb --- /dev/null +++ b/enable-jit-compiler-of-loongarch64-port-by-default.patch @@ -0,0 +1,55 @@ +From 4afb7390412988eb41ccaf264dea45876f0801d9 Mon Sep 17 00:00:00 2001 +From: liuyu +Date: Thu, 7 Sep 2023 19:17:52 +0800 +Subject: [PATCH] Enable JIT compiler of loong64 port by default + +--- + js/moz.configure | 2 ++ + js/src/wasm/WasmSignalHandlers.cpp | 10 +++++----- + 2 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/js/moz.configure b/js/moz.configure +index 7a241cac76..2bb7979e36 100644 +--- a/js/moz.configure ++++ b/js/moz.configure +@@ -234,6 +234,8 @@ def jit_codegen(jit_enabled, simulator, target): + return namespace(arm64=True) + elif target.cpu == "x86_64": + return namespace(x64=True) ++ elif target.cpu == "loongarch64": ++ return namespace(loong64=True) + + return namespace(**{str(target.cpu): True}) + +diff --git a/js/src/wasm/WasmSignalHandlers.cpp b/js/src/wasm/WasmSignalHandlers.cpp +index 4a45905431..074c373106 100644 +--- a/js/src/wasm/WasmSignalHandlers.cpp ++++ b/js/src/wasm/WasmSignalHandlers.cpp +@@ -158,10 +158,10 @@ using mozilla::DebugOnly; + # define R32_sig(p) ((p)->uc_mcontext.gp_regs[32]) + # endif + # if defined(__linux__) && defined(__loongarch__) +-# define EPC_sig(p) ((p)->uc_mcontext.pc) +-# define RRA_sig(p) ((p)->uc_mcontext.gregs[1]) +-# define RSP_sig(p) ((p)->uc_mcontext.gregs[3]) +-# define RFP_sig(p) ((p)->uc_mcontext.gregs[22]) ++# define EPC_sig(p) ((p)->uc_mcontext.__pc) ++# define RRA_sig(p) ((p)->uc_mcontext.__gregs[1]) ++# define R03_sig(p) ((p)->uc_mcontext.__gregs[3]) ++# define RFP_sig(p) ((p)->uc_mcontext.__gregs[22]) + # endif + # elif defined(__NetBSD__) + # define EIP_sig(p) ((p)->uc_mcontext.__gregs[_REG_EIP]) +@@ -403,7 +403,7 @@ struct macos_aarch64_context { + # elif defined(__loongarch__) + # define PC_sig(p) EPC_sig(p) + # define FP_sig(p) RFP_sig(p) +-# define SP_sig(p) RSP_sig(p) ++# define SP_sig(p) R03_sig(p) + # define LR_sig(p) RRA_sig(p) + # endif + +-- +2.20.1 + + diff --git a/mozjs102.spec b/mozjs102.spec index 5a683ea..2eef57b 100644 --- a/mozjs102.spec +++ b/mozjs102.spec @@ -24,7 +24,7 @@ Name: mozjs%{major} Version: 102.9.0 -Release: 1 +Release: 2 Summary: SpiderMonkey JavaScript library License: MPL-2.0 AND Apache-2.0 AND BSD-3-Clause AND BSD-2-Clause AND MIT AND GPL-3.0-or-later URL: https://hg.mozilla.org/releases/mozilla-esr102 @@ -62,10 +62,13 @@ Patch21: 0001-Skip-failing-tests-on-ppc64-and-s390x.patch # riscv64 sipdermonkey jit Patch22: spidermonkey-riscv64-plct.patch + # mold %if 0%{?build_mold} Patch23: D134330.diff %endif +# Enable jit compiler in loongarch64 +Patch24: enable-jit-compiler-of-loongarch64-port-by-default.patch BuildRequires: cargo BuildRequires: ccache @@ -174,7 +177,7 @@ case `uname -i` in i386 | ppc | s390 | sparc ) wordsize="32" ;; - x86_64 | ppc64 | s390x | sparc64 | riscv64 ) + x86_64 | ppc64 | s390x | sparc64 | riscv64 | loongarch64 ) wordsize="64" ;; *) @@ -250,6 +253,9 @@ ln -s libmozjs-%{major}.so.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so %{_includedir}/mozjs-%{major}/ %changelog +* Thu Mar 28 2024 Wenlong Zhang - 102.9.0-2 +- fix build error for loongarch64 + * Thu Mar 16 2023 Jingwiw - 102.9.0-1 - upgrade to 102.9.0 - add sipdermonkey jit support for riscv64