From 4a09c77ff2df4c03e0447c949ffbaf2c618edad9 Mon Sep 17 00:00:00 2001 From: Hailiang Date: Mon, 10 Mar 2025 18:45:40 +0800 Subject: [PATCH] add sw_64 support (cherry picked from commit 9ba0c065eff2e8c7a12b045ed13048250dd7a3b7) --- add-sw_64-support.patch | 227 ++++++++++++++++++++++++++++++++++++++++ mozjs102.spec | 8 +- 2 files changed, 234 insertions(+), 1 deletion(-) create mode 100644 add-sw_64-support.patch diff --git a/add-sw_64-support.patch b/add-sw_64-support.patch new file mode 100644 index 0000000..d67b65f --- /dev/null +++ b/add-sw_64-support.patch @@ -0,0 +1,227 @@ +diff -auNr firefox-102.9.0/build/autoconf/config.guess firefox-102.9.0.sw/build/autoconf/config.guess +--- firefox-102.9.0/build/autoconf/config.guess 2023-03-10 07:55:11.000000000 +0800 ++++ firefox-102.9.0.sw/build/autoconf/config.guess 2024-12-06 16:49:07.723043262 +0800 +@@ -1143,6 +1143,9 @@ + sparc:Linux:*:* | sparc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; ++ sw_64*:Linux:*:*) ++ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ++ exit ;; + tile*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; +diff -auNr firefox-102.9.0/build/autoconf/config.sub firefox-102.9.0.sw/build/autoconf/config.sub +--- firefox-102.9.0/build/autoconf/config.sub 2023-03-10 07:55:11.000000000 +0800 ++++ firefox-102.9.0.sw/build/autoconf/config.sub 2024-12-06 16:49:36.643213205 +0800 +@@ -1267,6 +1267,7 @@ + | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ + | spu \ ++ | sw_64 \ + | tahoe \ + | thumbv7* \ + | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ +diff -auNr firefox-102.9.0/build/moz.configure/init.configure firefox-102.9.0.sw/build/moz.configure/init.configure +--- firefox-102.9.0/build/moz.configure/init.configure 2023-03-10 07:59:36.000000000 +0800 ++++ firefox-102.9.0.sw/build/moz.configure/init.configure 2024-12-06 17:09:29.990869176 +0800 +@@ -530,6 +530,9 @@ + elif cpu.startswith("loongarch64"): + canonical_cpu = "loongarch64" + endianness = "little" ++ elif cpu in ("sw_64"): ++ canonical_cpu = "sw_64" ++ endianness = "little" + elif cpu == "sh4": + canonical_cpu = "sh4" + endianness = "little" +diff -auNr firefox-102.9.0/intl/icu/source/config.guess firefox-102.9.0.sw/intl/icu/source/config.guess +--- firefox-102.9.0/intl/icu/source/config.guess 2023-03-10 07:55:13.000000000 +0800 ++++ firefox-102.9.0.sw/intl/icu/source/config.guess 2024-12-06 16:52:54.634376784 +0800 +@@ -1029,6 +1029,9 @@ + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; ++ sw_64*:Linux:*:*) ++ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} ++ exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; +diff -auNr firefox-102.9.0/intl/icu/source/config.sub firefox-102.9.0.sw/intl/icu/source/config.sub +--- firefox-102.9.0/intl/icu/source/config.sub 2023-03-10 07:55:13.000000000 +0800 ++++ firefox-102.9.0.sw/intl/icu/source/config.sub 2024-12-06 16:53:08.084455832 +0800 +@@ -308,6 +308,7 @@ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ ++ | sw_64 \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ +diff -auNr firefox-102.9.0/intl/icu/source/i18n/double-conversion-utils.h firefox-102.9.0.sw/intl/icu/source/i18n/double-conversion-utils.h +--- firefox-102.9.0/intl/icu/source/i18n/double-conversion-utils.h 2023-03-10 07:59:37.000000000 +0800 ++++ firefox-102.9.0.sw/intl/icu/source/i18n/double-conversion-utils.h 2024-12-06 17:12:13.061850411 +0800 +@@ -142,6 +142,7 @@ + defined(__ARMEL__) || defined(__avr32__) || defined(_M_ARM) || defined(_M_ARM64) || \ + defined(__hppa__) || defined(__ia64__) || \ + defined(__mips__) || \ ++ defined(__sw_64__) || \ + defined(__loongarch__) || \ + defined(__nios2__) || defined(__ghs) || \ + defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \ +diff -auNr firefox-102.9.0/js/moz.configure firefox-102.9.0.sw/js/moz.configure +--- firefox-102.9.0/js/moz.configure 2024-12-06 17:23:06.325903209 +0800 ++++ firefox-102.9.0.sw/js/moz.configure 2024-12-06 17:14:02.142450768 +0800 +@@ -251,6 +251,7 @@ + set_config("JS_CODEGEN_RISCV64", jit_codegen.riscv64) + set_config("JS_CODEGEN_X86", jit_codegen.x86) + set_config("JS_CODEGEN_X64", jit_codegen.x64) ++set_config('JS_CODEGEN_SW64', jit_codegen.sw_64) + set_define("JS_CODEGEN_NONE", jit_codegen.none) + set_define("JS_CODEGEN_ARM", jit_codegen.arm) + set_define("JS_CODEGEN_ARM64", jit_codegen.arm64) +@@ -260,6 +261,7 @@ + set_define("JS_CODEGEN_RISCV64", jit_codegen.riscv64) + set_define("JS_CODEGEN_X86", jit_codegen.x86) + set_define("JS_CODEGEN_X64", jit_codegen.x64) ++set_define('JS_CODEGEN_SW64', jit_codegen.sw_64) + + # Profiling + # ======================================================= +diff -auNr firefox-102.9.0/js/src/jit/LIR.h firefox-102.9.0.sw/js/src/jit/LIR.h +--- firefox-102.9.0/js/src/jit/LIR.h 2024-12-06 17:23:06.185902165 +0800 ++++ firefox-102.9.0.sw/js/src/jit/LIR.h 2024-12-06 17:15:13.212841942 +0800 +@@ -1956,6 +1956,8 @@ + # include "jit/loong64/LIR-loong64.h" + #elif defined(JS_CODEGEN_RISCV64) + # include "jit/riscv64/LIR-riscv64.h" ++#elif defined(JS_CODEGEN_SW64) ++# include "jit/none/LIR-none.h" + #elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) + # if defined(JS_CODEGEN_MIPS32) + # include "jit/mips32/LIR-mips32.h" +diff -auNr firefox-102.9.0/memory/build/mozjemalloc.cpp firefox-102.9.0.sw/memory/build/mozjemalloc.cpp +--- firefox-102.9.0/memory/build/mozjemalloc.cpp 2023-03-10 07:59:37.000000000 +0800 ++++ firefox-102.9.0.sw/memory/build/mozjemalloc.cpp 2024-12-06 17:16:27.533251012 +0800 +@@ -204,7 +204,7 @@ + #ifndef MOZ_DEBUG + # if !defined(__ia64__) && !defined(__sparc__) && !defined(__mips__) && \ + !defined(__aarch64__) && !defined(__powerpc__) && !defined(XP_MACOSX) && \ +- !defined(__loongarch__) ++ !defined(__loongarch__) && !defined(__sw_64__) + # define MALLOC_STATIC_PAGESIZE 1 + # endif + #endif +@@ -474,6 +474,8 @@ + static const size_t gPageSize = 64_KiB; + # elif defined(__loongarch64) + static const size_t gPageSize = 16_KiB; ++#elif defined(__sw_64__) ++static const size_t gPageSize = 8_KiB; + # else + static const size_t gPageSize = 4_KiB; + # endif +diff -auNr firefox-102.9.0/mfbt/double-conversion/double-conversion/utils.h firefox-102.9.0.sw/mfbt/double-conversion/double-conversion/utils.h +--- firefox-102.9.0/mfbt/double-conversion/double-conversion/utils.h 2023-03-10 07:59:37.000000000 +0800 ++++ firefox-102.9.0.sw/mfbt/double-conversion/double-conversion/utils.h 2024-12-06 17:05:09.579103919 +0800 +@@ -116,7 +116,7 @@ + defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \ + defined(_POWER) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || \ + defined(__sparc__) || defined(__sparc) || defined(__s390__) || \ +- defined(__SH4__) || defined(__alpha__) || \ ++ defined(__SH4__) || defined(__alpha__) || defined(__sw_64__) || defined(__sw_64) || \ + defined(_MIPS_ARCH_MIPS32R2) || defined(__ARMEB__) ||\ + defined(__AARCH64EL__) || defined(__aarch64__) || defined(__AARCH64EB__) || \ + defined(__riscv) || defined(__e2k__) || \ +diff -auNr firefox-102.9.0/mfbt/tests/TestPoisonArea.cpp firefox-102.9.0.sw/mfbt/tests/TestPoisonArea.cpp +--- firefox-102.9.0/mfbt/tests/TestPoisonArea.cpp 2023-03-10 07:59:37.000000000 +0800 ++++ firefox-102.9.0.sw/mfbt/tests/TestPoisonArea.cpp 2024-12-06 17:04:53.498994916 +0800 +@@ -168,6 +168,9 @@ + #elif defined __loongarch64 + # define RETURN_INSTR 0x4c000020 /* jirl zero, ra, 0 */ + ++#elif defined __sw_64 || __sw_64__ ++#define RETURN_INSTR 0x0bfa0000 /* ret zero,(ra),0 */ ++ + #elif defined __ia64 + struct ia64_instr { + uint32_t mI[4]; +diff -auNr firefox-102.9.0/modules/freetype2/builds/unix/config.guess firefox-102.9.0.sw/modules/freetype2/builds/unix/config.guess +--- firefox-102.9.0/modules/freetype2/builds/unix/config.guess 2023-03-10 07:59:37.000000000 +0800 ++++ firefox-102.9.0.sw/modules/freetype2/builds/unix/config.guess 2024-12-06 16:50:35.843561107 +0800 +@@ -1143,6 +1143,9 @@ + sparc:Linux:*:* | sparc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; ++ sw_64*:Linux:*:*) ++ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ++ exit ;; + tile*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; +diff -auNr firefox-102.9.0/modules/freetype2/builds/unix/config.sub firefox-102.9.0.sw/modules/freetype2/builds/unix/config.sub +--- firefox-102.9.0/modules/freetype2/builds/unix/config.sub 2023-03-10 07:59:37.000000000 +0800 ++++ firefox-102.9.0.sw/modules/freetype2/builds/unix/config.sub 2024-12-06 16:50:49.893643679 +0800 +@@ -1267,6 +1267,7 @@ + | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ + | spu \ ++ | sw_64 \ + | tahoe \ + | thumbv7* \ + | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ +diff -auNr firefox-102.9.0/nsprpub/build/autoconf/config.guess firefox-102.9.0.sw/nsprpub/build/autoconf/config.guess +--- firefox-102.9.0/nsprpub/build/autoconf/config.guess 2023-03-10 07:55:17.000000000 +0800 ++++ firefox-102.9.0.sw/nsprpub/build/autoconf/config.guess 2024-12-06 16:51:25.693854088 +0800 +@@ -1088,6 +1088,9 @@ + sparc:Linux:*:* | sparc64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; ++ sw_64*:Linux:*:*) ++ GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ++ exit ;; + tile*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; +diff -auNr firefox-102.9.0/nsprpub/build/autoconf/config.sub firefox-102.9.0.sw/nsprpub/build/autoconf/config.sub +--- firefox-102.9.0/nsprpub/build/autoconf/config.sub 2023-03-10 07:55:17.000000000 +0800 ++++ firefox-102.9.0.sw/nsprpub/build/autoconf/config.sub 2024-12-06 16:51:37.293922250 +0800 +@@ -1240,6 +1240,7 @@ + | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ + | spu \ ++ | sw_64 \ + | tahoe \ + | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ + | tron \ +diff -auNr firefox-102.9.0/python/mozbuild/mozbuild/configure/constants.py firefox-102.9.0.sw/python/mozbuild/mozbuild/configure/constants.py +--- firefox-102.9.0/python/mozbuild/mozbuild/configure/constants.py 2023-03-10 07:59:37.000000000 +0800 ++++ firefox-102.9.0.sw/python/mozbuild/mozbuild/configure/constants.py 2024-12-06 17:06:24.349610772 +0800 +@@ -62,6 +62,7 @@ + "x86": 32, + "x86_64": 64, + "wasm32": 32, ++ "sw_64": 64, + } + + CPU = EnumString.subclass(*CPU_bitness.keys()) +@@ -97,6 +98,7 @@ + ("mips32", "__mips__"), + ("riscv64", "__riscv && __riscv_xlen == 64"), + ("loongarch64", "__loongarch64"), ++ ("sw_64", "__sw_64"), + ("sh4", "__sh__"), + ("wasm32", "__wasm32__"), + ) +diff -auNr firefox-102.9.0/toolkit/moz.configure firefox-102.9.0.sw/toolkit/moz.configure +--- firefox-102.9.0/toolkit/moz.configure 2023-03-10 07:59:39.000000000 +0800 ++++ firefox-102.9.0.sw/toolkit/moz.configure 2024-12-06 17:19:38.254351045 +0800 +@@ -1292,6 +1292,7 @@ + "ia64", + "mips32", + "mips64", ++ "sw_64", + ) + or target.cpu.startswith("ppc") + ): diff --git a/mozjs102.spec b/mozjs102.spec index a9d9ea9..3e95d35 100644 --- a/mozjs102.spec +++ b/mozjs102.spec @@ -23,7 +23,7 @@ Name: mozjs%{major} Version: 102.9.0 -Release: 6 +Release: 7 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 @@ -71,6 +71,9 @@ Patch23: D134330.diff # Enable jit compiler in loongarch64 Patch24: enable-jit-compiler-of-loongarch64-port-by-default.patch +# add sw_64 support +Patch26: add-sw_64-support.patch + BuildRequires: cargo BuildRequires: ccache BuildRequires: clang-devel @@ -254,6 +257,9 @@ ln -s libmozjs-%{major}.so.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so %{_includedir}/mozjs-%{major}/ %changelog +* Mon Mar 10 2025 mahailiang - 102.9.0-7 +- add sw_64 support + * Wed Jul 10 2024 liweigang - 102.9.0-6 - enable debug package -- Gitee