diff --git a/nspr.spec b/nspr.spec index 862eb9697d9eba3fb8965e407c5b51c10ff475e2..7214562f4024b53763f2bc6ce739c3919bc26567 100644 --- a/nspr.spec +++ b/nspr.spec @@ -1,7 +1,7 @@ %global nspr_version 4.32 Name: nspr Version: 4.32.0 -Release: 1 +Release: 2 Summary: Netscape Portable Runtime License: MPLv2.0 URL: http://www.mozilla.org/projects/nspr @@ -10,6 +10,7 @@ Source0: http://ftp.mozilla.org/pub/%{name}/releases/v%{nspr_version}/src Source1: nspr-config.xml Patch1: nspr-gcc-atomics.patch +Patch2: support-loongarch64-build.patch %description NetScape Portable Runtime (NSPR) provides platform independence for non-GUI @@ -83,6 +84,9 @@ install -c -m 644 nspr-config.1 $RPM_BUILD_ROOT%{_mandir}/man1/nspr-config.1 %{_mandir}/man*/* %changelog +* Thu Apr 14 2022 xu_ping - 4.32.0-2 +- Support loongarch64 + * Mon Nov 29 2021 zhouwenpei - 4.32.0-1 - update to 4.32.0 diff --git a/support-loongarch64-build.patch b/support-loongarch64-build.patch new file mode 100644 index 0000000000000000000000000000000000000000..2444e312b001c3724f3aebda521fd0602b43e6d3 --- /dev/null +++ b/support-loongarch64-build.patch @@ -0,0 +1,170 @@ +Description: + TODO: Put a short summary on the line above and replace this paragraph + with a longer explanation of this change. Complete the meta-information + with other relevant fields (see below for details). To make it easier, the + information below has been extracted from the changelog. Adjust it or drop + it. + . + nspr (2:4.20-1.lnd.1) unstable; urgency=medium + . + * New upstream release. +Author: Nan xiongchao + +--- +The information above should follow the Patch Tagging Guidelines, please +checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here +are templates for supplementary fields that you might want to add: + +Origin: , +Bug: +Bug-Debian: https://bugs.debian.org/ +Bug-Ubuntu: https://launchpad.net/bugs/ +Forwarded: +Reviewed-By: +Last-Update: 2020-11-18 + +--- nspr-4.20.orig/nspr/pr/include/md/_linux.cfg ++++ nspr-4.20/nspr/pr/include/md/_linux.cfg +@@ -496,6 +496,103 @@ + #define PR_BYTES_PER_WORD_LOG2 2 + #define PR_BYTES_PER_DWORD_LOG2 3 + ++#elif defined(__loongarch__) ++ ++/* For _ABI64 */ ++#ifdef _LOONGARCH_SZLONG ++#define IS_LITTLE_ENDIAN 1 ++#undef IS_BIG_ENDIAN ++#else ++#error "Unknown LOONGARCH endianness." ++#endif ++ ++#if _LOONGARCH_SIM == _ABILP64 ++#define IS_64 ++ ++#define PR_BYTES_PER_BYTE 1 ++#define PR_BYTES_PER_SHORT 2 ++#define PR_BYTES_PER_INT 4 ++#define PR_BYTES_PER_INT64 8 ++#define PR_BYTES_PER_LONG 8 ++#define PR_BYTES_PER_FLOAT 4 ++#define PR_BYTES_PER_DOUBLE 8 ++#define PR_BYTES_PER_WORD 8 ++#define PR_BYTES_PER_DWORD 8 ++ ++#define PR_BITS_PER_BYTE 8 ++#define PR_BITS_PER_SHORT 16 ++#define PR_BITS_PER_INT 32 ++#define PR_BITS_PER_INT64 64 ++#define PR_BITS_PER_LONG 64 ++#define PR_BITS_PER_FLOAT 32 ++#define PR_BITS_PER_DOUBLE 64 ++#define PR_BITS_PER_WORD 64 ++ ++#define PR_BITS_PER_BYTE_LOG2 3 ++#define PR_BITS_PER_SHORT_LOG2 4 ++#define PR_BITS_PER_INT_LOG2 5 ++#define PR_BITS_PER_INT64_LOG2 6 ++#define PR_BITS_PER_LONG_LOG2 6 ++#define PR_BITS_PER_FLOAT_LOG2 5 ++#define PR_BITS_PER_DOUBLE_LOG2 6 ++#define PR_BITS_PER_WORD_LOG2 6 ++ ++#define PR_ALIGN_OF_SHORT 2 ++#define PR_ALIGN_OF_INT 4 ++#define PR_ALIGN_OF_LONG 8 ++#define PR_ALIGN_OF_INT64 8 ++#define PR_ALIGN_OF_FLOAT 4 ++#define PR_ALIGN_OF_DOUBLE 8 ++#define PR_ALIGN_OF_POINTER 8 ++#define PR_ALIGN_OF_WORD 8 ++ ++#define PR_BYTES_PER_WORD_LOG2 3 ++#define PR_BYTES_PER_DWORD_LOG2 3 ++ ++#else /* _ABI64 */ ++ ++#define PR_BYTES_PER_BYTE 1 ++#define PR_BYTES_PER_SHORT 2 ++#define PR_BYTES_PER_INT 4 ++#define PR_BYTES_PER_INT64 8 ++#define PR_BYTES_PER_LONG 4 ++#define PR_BYTES_PER_FLOAT 4 ++#define PR_BYTES_PER_DOUBLE 8 ++#define PR_BYTES_PER_WORD 4 ++#define PR_BYTES_PER_DWORD 8 ++ ++#define PR_BITS_PER_BYTE 8 ++#define PR_BITS_PER_SHORT 16 ++#define PR_BITS_PER_INT 32 ++#define PR_BITS_PER_INT64 64 ++#define PR_BITS_PER_LONG 32 ++#define PR_BITS_PER_FLOAT 32 ++#define PR_BITS_PER_DOUBLE 64 ++#define PR_BITS_PER_WORD 32 ++ ++#define PR_BITS_PER_BYTE_LOG2 3 ++#define PR_BITS_PER_SHORT_LOG2 4 ++#define PR_BITS_PER_INT_LOG2 5 ++#define PR_BITS_PER_INT64_LOG2 6 ++#define PR_BITS_PER_LONG_LOG2 5 ++#define PR_BITS_PER_FLOAT_LOG2 5 ++#define PR_BITS_PER_DOUBLE_LOG2 6 ++#define PR_BITS_PER_WORD_LOG2 5 ++ ++#define PR_ALIGN_OF_SHORT 2 ++#define PR_ALIGN_OF_INT 4 ++#define PR_ALIGN_OF_LONG 4 ++#define PR_ALIGN_OF_INT64 8 ++#define PR_ALIGN_OF_FLOAT 4 ++#define PR_ALIGN_OF_DOUBLE 8 ++#define PR_ALIGN_OF_POINTER 4 ++#define PR_ALIGN_OF_WORD 4 ++ ++#define PR_BYTES_PER_WORD_LOG2 2 ++#define PR_BYTES_PER_DWORD_LOG2 3 ++ ++#endif /* _ABI64 */ ++ + #elif defined(__mips__) + + /* For _ABI64 */ +--- nspr-4.20.orig/nspr/pr/include/md/_linux.h ++++ nspr-4.20/nspr/pr/include/md/_linux.h +@@ -37,6 +37,8 @@ + #define _PR_SI_ARCHITECTURE "sparc" + #elif defined(__i386__) + #define _PR_SI_ARCHITECTURE "x86" ++#elif defined(__loongarch__) ++#define _PR_SI_ARCHITECTURE "loongarch64" + #elif defined(__mips__) + #define _PR_SI_ARCHITECTURE "mips" + #elif defined(__arm__) +@@ -442,6 +444,18 @@ extern void _MD_CleanupBeforeExit(void); + #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */ + #define PR_NUM_GCREGS 6 + ++#elif defined(__loongarch__) ++/* Linux/LOONGARCH64 */ ++#if defined(__GLIBC__) && __GLIBC__ >= 2 ++#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp ++#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[0].__fp = (val)) ++#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t)) ++#define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[0].__fp) ++#define _MD_SP_TYPE __ptr_t ++#else ++#error "Linux/LOONGARCH64 pre-glibc2 not supported yet" ++#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */ ++ + #elif defined(__mips__) + /* Linux/MIPS */ + #if defined(__GLIBC__) && __GLIBC__ >= 2 +@@ -523,7 +537,7 @@ extern void _MD_CleanupBeforeExit(void); + _MD_SET_FP(_thread, 0); \ + } + +-#elif defined(__mips__) ++#elif defined(__mips__) || defined(__loongarch__) + + #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ + { \