Singed-off-by: zhaojiazhong-hf@loongson.cn
Last-Update: 2023-12-06

--- mozjs102-102.15.1.orig/js/moz.configure
+++ mozjs102-102.15.1/js/moz.configure
@@ -237,6 +237,8 @@ def jit_codegen(jit_enabled, simulator,
         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})
 
--- mozjs102-102.15.1.orig/js/src/wasm/WasmSignalHandlers.cpp
+++ mozjs102-102.15.1/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
 
