Compare commits
10 Commits
d1ed84604e
...
f9c5e5e378
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9c5e5e378 | ||
|
|
ea84fceae5 | ||
|
|
91ccbd84df | ||
|
|
4a849011d7 | ||
|
|
75c4afbf4a | ||
|
|
eed4f002f2 | ||
|
|
1a95020043 | ||
|
|
c1bda8f9c5 | ||
|
|
59f9cbd8ec | ||
|
|
93f8baecbe |
BIN
nspr-4.29.tar.gz
BIN
nspr-4.29.tar.gz
Binary file not shown.
BIN
nspr-4.32.tar.gz
Normal file
BIN
nspr-4.32.tar.gz
Normal file
Binary file not shown.
324
nspr-Add-sw64-architecture.patch
Normal file
324
nspr-Add-sw64-architecture.patch
Normal file
@ -0,0 +1,324 @@
|
||||
From e1074e1a978fccfdb2bc50ed25bfd3864155b073 Mon Sep 17 00:00:00 2001
|
||||
From: wzx <wuzx1226@qq.com>
|
||||
Date: Wed, 23 Nov 2022 14:05:30 +0800
|
||||
Subject: [PATCH] Add sw64 architecture
|
||||
|
||||
Signed-off-by: wzx <wuzx1226@qq.com>
|
||||
---
|
||||
nspr/configure | 8 ++++
|
||||
nspr/configure.in | 6 +++
|
||||
nspr/pr/include/gencfg.c | 2 +-
|
||||
nspr/pr/include/md/_freebsd.cfg | 2 +-
|
||||
nspr/pr/include/md/_freebsd.h | 2 +
|
||||
nspr/pr/include/md/_linux.cfg | 2 +-
|
||||
nspr/pr/include/md/_linux.h | 83 ++++++++++++++++++++++++++++++++-
|
||||
nspr/pr/include/md/_netbsd.cfg | 2 +-
|
||||
nspr/pr/include/md/_netbsd.h | 4 +-
|
||||
nspr/pr/include/md/_openbsd.cfg | 2 +-
|
||||
nspr/pr/include/md/_openbsd.h | 4 +-
|
||||
nspr/pr/include/pratom.h | 2 +-
|
||||
nspr/pr/src/md/unix/unix.c | 2 +-
|
||||
13 files changed, 110 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/nspr/configure b/nspr/configure
|
||||
index 2c6d7d6..a7d9c48 100755
|
||||
--- a/nspr/configure
|
||||
+++ b/nspr/configure
|
||||
@@ -6808,6 +6808,14 @@ tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5
|
||||
fi
|
||||
CPU_ARCH_TAG=_${CPU_ARCH}
|
||||
case "${target_cpu}" in
|
||||
+ sw_64)
|
||||
+ $as_echo "#define _SW_64_ 1" >>confdefs.h
|
||||
+
|
||||
+ $as_echo "#define __sw_64 1" >>confdefs.h
|
||||
+
|
||||
+ CFLAGS="$CFLAGS -mieee"
|
||||
+ CXXFLAGS="$CXXFLAGS -mieee"
|
||||
+ ;;
|
||||
alpha)
|
||||
$as_echo "#define _ALPHA_ 1" >>confdefs.h
|
||||
|
||||
diff --git a/nspr/configure.in b/nspr/configure.in
|
||||
index d0c1769..6b74d66 100644
|
||||
--- a/nspr/configure.in
|
||||
+++ b/nspr/configure.in
|
||||
@@ -1675,6 +1675,12 @@ tools are selected during the Xcode/Developer Tools installation.])
|
||||
fi
|
||||
CPU_ARCH_TAG=_${CPU_ARCH}
|
||||
case "${target_cpu}" in
|
||||
+ sw_64)
|
||||
+ AC_DEFINE(_SW_64_)
|
||||
+ AC_DEFINE(__sw_64)
|
||||
+ CFLAGS="$CFLAGS -mieee"
|
||||
+ CXXFLAGS="$CXXFLAGS -mieee"
|
||||
+ ;;
|
||||
alpha)
|
||||
AC_DEFINE(_ALPHA_)
|
||||
AC_DEFINE(__alpha)
|
||||
diff --git a/nspr/pr/include/gencfg.c b/nspr/pr/include/gencfg.c
|
||||
index 3a67e91..34a332a 100644
|
||||
--- a/nspr/pr/include/gencfg.c
|
||||
+++ b/nspr/pr/include/gencfg.c
|
||||
@@ -17,7 +17,7 @@ error - HPUX is not defined
|
||||
#endif
|
||||
#endif
|
||||
|
||||
-#if defined(__alpha)
|
||||
+#if defined(__alpha) || defined(__sw_64)
|
||||
#if !(defined(_WIN32)) && !(defined(__linux)) && !(defined(__FreeBSD__))
|
||||
error - None of _WIN32, __linux, or __FreeBSD__ is defined
|
||||
#endif
|
||||
diff --git a/nspr/pr/include/md/_freebsd.cfg b/nspr/pr/include/md/_freebsd.cfg
|
||||
index 1d1039a..13282da 100644
|
||||
--- a/nspr/pr/include/md/_freebsd.cfg
|
||||
+++ b/nspr/pr/include/md/_freebsd.cfg
|
||||
@@ -65,7 +65,7 @@
|
||||
#define PR_ALIGN_OF_DOUBLE 4
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
|
||||
-#elif defined(__alpha__)
|
||||
+#elif defined(__alpha__) || defined(__sw_64__)
|
||||
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
diff --git a/nspr/pr/include/md/_freebsd.h b/nspr/pr/include/md/_freebsd.h
|
||||
index 118cb9f..bf4edb9 100644
|
||||
--- a/nspr/pr/include/md/_freebsd.h
|
||||
+++ b/nspr/pr/include/md/_freebsd.h
|
||||
@@ -17,6 +17,8 @@
|
||||
#define _PR_SI_SYSNAME "FREEBSD"
|
||||
#if defined(__i386__)
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
+#elif defined(__sw_64__)
|
||||
+#define _PR_SI_ARCHITECTURE "sw_64"
|
||||
#elif defined(__alpha__)
|
||||
#define _PR_SI_ARCHITECTURE "alpha"
|
||||
#elif defined(__sparc__)
|
||||
diff --git a/nspr/pr/include/md/_linux.cfg b/nspr/pr/include/md/_linux.cfg
|
||||
index 23b160f..d26e2cc 100644
|
||||
--- a/nspr/pr/include/md/_linux.cfg
|
||||
+++ b/nspr/pr/include/md/_linux.cfg
|
||||
@@ -128,7 +128,7 @@
|
||||
#define PR_BYTES_PER_WORD_LOG2 2
|
||||
#define PR_BYTES_PER_DWORD_LOG2 3
|
||||
|
||||
-#elif defined(__alpha)
|
||||
+#elif defined(__alpha) || defined(__sw_64)
|
||||
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
diff --git a/nspr/pr/include/md/_linux.h b/nspr/pr/include/md/_linux.h
|
||||
index 619b04f..b34d9d3 100644
|
||||
--- a/nspr/pr/include/md/_linux.h
|
||||
+++ b/nspr/pr/include/md/_linux.h
|
||||
@@ -23,6 +23,8 @@
|
||||
#define _PR_SI_ARCHITECTURE "ppc64"
|
||||
#elif defined(__powerpc__)
|
||||
#define _PR_SI_ARCHITECTURE "ppc"
|
||||
+#elif defined(__sw_64)
|
||||
+#define _PR_SI_ARCHITECTURE "sw_64"
|
||||
#elif defined(__alpha)
|
||||
#define _PR_SI_ARCHITECTURE "alpha"
|
||||
#elif defined(__ia64__)
|
||||
@@ -264,6 +266,83 @@ extern PRInt32 _PR_ppc_AtomicSet(PRInt32 *val, PRInt32 newval);
|
||||
})
|
||||
#endif
|
||||
|
||||
+#if defined(__sw_64)
|
||||
+#define _PR_HAVE_ATOMIC_OPS
|
||||
+#define _MD_INIT_ATOMIC()
|
||||
+#define _MD_ATOMIC_ADD(ptr, i) ({ \
|
||||
+ PRInt32 __atomic_tmp, __atomic_ret; \
|
||||
+ PRInt32 __atomic_tmp1, __atomic_tmp2; \
|
||||
+ __asm__ __volatile__( \
|
||||
+ "1: ldi %[tmp1],%[val] \n" \
|
||||
+ " ldi %[tmp2],1 \n" \
|
||||
+ " lldw %[ret], 0(%[tmp1]) \n" \
|
||||
+ " wr_f %[tmp2] \n" \
|
||||
+ " addw %[ret], %[inc], %[tmp] \n" \
|
||||
+ " addw %[ret], %[inc], %[ret] \n" \
|
||||
+ " lstw %[tmp], 0(%[tmp1]) \n" \
|
||||
+ " rd_f %[tmp] \n" \
|
||||
+ " beq %[tmp], 2f \n" \
|
||||
+ ".subsection 2 \n" \
|
||||
+ "2: br 1b \n" \
|
||||
+ ".previous" \
|
||||
+ : [ret] "=&r" (__atomic_ret), \
|
||||
+ [tmp] "=&r" (__atomic_tmp), \
|
||||
+ [tmp1] "=&r" (__atomic_tmp1), \
|
||||
+ [tmp2] "=&r" (__atomic_tmp2), \
|
||||
+ [val] "=m" (*ptr) \
|
||||
+ : [inc] "Ir" (i), "m" (*ptr)); \
|
||||
+ __atomic_ret; \
|
||||
+})
|
||||
+#define _MD_ATOMIC_INCREMENT(ptr) _MD_ATOMIC_ADD(ptr, 1)
|
||||
+#define _MD_ATOMIC_DECREMENT(ptr) ({ \
|
||||
+ PRInt32 __atomic_tmp, __atomic_ret; \
|
||||
+ PRInt32 __atomic_tmp1, __atomic_tmp2; \
|
||||
+ __asm__ __volatile__( \
|
||||
+ "1: ldi %[tmp1],%[val] \n" \
|
||||
+ " ldi %[tmp2],1 \n" \
|
||||
+ " lldw %[ret], 0(%[tmp1]) \n" \
|
||||
+ " wr_f %[tmp2] \n" \
|
||||
+ " subw %[ret], 1, %[tmp] \n" \
|
||||
+ " subw %[ret], 1, %[ret] \n" \
|
||||
+ " lstw %[tmp], 0(%[tmp1]) \n" \
|
||||
+ " rd_f %[tmp] \n" \
|
||||
+ " beq %[tmp], 2f \n" \
|
||||
+ ".subsection 2 \n" \
|
||||
+ "2: br 1b \n" \
|
||||
+ ".previous" \
|
||||
+ : [ret] "=&r" (__atomic_ret), \
|
||||
+ [tmp] "=&r" (__atomic_tmp), \
|
||||
+ [tmp1] "=&r" (__atomic_tmp1), \
|
||||
+ [tmp2] "=&r" (__atomic_tmp2), \
|
||||
+ [val] "=m" (*ptr) \
|
||||
+ : "m" (*ptr)); \
|
||||
+ __atomic_ret; \
|
||||
+})
|
||||
+#define _MD_ATOMIC_SET(ptr, n) ({ \
|
||||
+ PRInt32 __atomic_tmp, __atomic_ret; \
|
||||
+ PRInt32 __atomic_tmp1, __atomic_tmp2; \
|
||||
+ __asm__ __volatile__( \
|
||||
+ "1: ldi %[tmp1],%[val] \n" \
|
||||
+ " ldi %[tmp2],1 \n" \
|
||||
+ " lldw %[ret], 0(%[tmp1]) \n" \
|
||||
+ " wr_f %[tmp2] \n" \
|
||||
+ " mov %[newval], %[tmp] \n" \
|
||||
+ " lstw %[tmp], 0(%[tmp1]) \n" \
|
||||
+ " rd_f %[tmp] \n" \
|
||||
+ " beq %[tmp], 2f \n" \
|
||||
+ ".subsection 2 \n" \
|
||||
+ "2: br 1b \n" \
|
||||
+ ".previous" \
|
||||
+ : [ret] "=&r" (__atomic_ret), \
|
||||
+ [tmp] "=&r"(__atomic_tmp), \
|
||||
+ [tmp1] "=&r" (__atomic_tmp1), \
|
||||
+ [tmp2] "=&r" (__atomic_tmp2), \
|
||||
+ [val] "=m" (*ptr) \
|
||||
+ : [newval] "Ir" (n), "m" (*ptr)); \
|
||||
+ __atomic_ret; \
|
||||
+})
|
||||
+#endif
|
||||
+
|
||||
#if defined(__arm__) || defined(__aarch64__)
|
||||
#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
|
||||
/* Use GCC built-in functions */
|
||||
@@ -326,7 +405,7 @@ static inline PRInt32 _MD_ATOMIC_SET(PRInt32 *ptr, PRInt32 nv)
|
||||
#endif
|
||||
#undef _PR_USE_POLL
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
-#if defined(__alpha) || defined(__ia64__)
|
||||
+#if defined(__alpha) || defined(__sw_64) || defined(__ia64__)
|
||||
#define _PR_HAVE_LARGE_OFF_T
|
||||
#elif (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) \
|
||||
|| defined(ANDROID)
|
||||
@@ -383,7 +462,7 @@ extern void _MD_CleanupBeforeExit(void);
|
||||
/* aix = 64, macos = 70 */
|
||||
#define PR_NUM_GCREGS 64
|
||||
|
||||
-#elif defined(__alpha)
|
||||
+#elif defined(__alpha) || defined(__sw_64)
|
||||
/* Alpha based Linux */
|
||||
|
||||
#if defined(__GLIBC__) && __GLIBC__ >= 2
|
||||
diff --git a/nspr/pr/include/md/_netbsd.cfg b/nspr/pr/include/md/_netbsd.cfg
|
||||
index 1326556..e1dfb00 100644
|
||||
--- a/nspr/pr/include/md/_netbsd.cfg
|
||||
+++ b/nspr/pr/include/md/_netbsd.cfg
|
||||
@@ -157,7 +157,7 @@
|
||||
#define PR_ALIGN_OF_DOUBLE 8
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
|
||||
-#elif defined(__alpha__)
|
||||
+#elif defined(__alpha__) || defined(__sw_64__)
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
#define HAVE_ALIGNED_DOUBLES
|
||||
diff --git a/nspr/pr/include/md/_netbsd.h b/nspr/pr/include/md/_netbsd.h
|
||||
index 1ec0fe6..2d91868 100644
|
||||
--- a/nspr/pr/include/md/_netbsd.h
|
||||
+++ b/nspr/pr/include/md/_netbsd.h
|
||||
@@ -13,6 +13,8 @@
|
||||
#define _PR_SI_SYSNAME "NetBSD"
|
||||
#if defined(__i386__)
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
+#elif defined(__sw_64__)
|
||||
+#define _PR_SI_ARCHITECTURE "sw_64"
|
||||
#elif defined(__alpha__)
|
||||
#define _PR_SI_ARCHITECTURE "alpha"
|
||||
#elif defined(__amd64__)
|
||||
@@ -75,7 +77,7 @@
|
||||
#define JB_SP_INDEX 2
|
||||
#elif defined(__mips__)
|
||||
#define JB_SP_INDEX 4
|
||||
-#elif defined(__alpha__)
|
||||
+#elif defined(__alpha__) || defined(__sw_64__)
|
||||
#define JB_SP_INDEX 34
|
||||
#elif defined(__arm32__)
|
||||
/*
|
||||
diff --git a/nspr/pr/include/md/_openbsd.cfg b/nspr/pr/include/md/_openbsd.cfg
|
||||
index b68d6e9..f3d1f5f 100644
|
||||
--- a/nspr/pr/include/md/_openbsd.cfg
|
||||
+++ b/nspr/pr/include/md/_openbsd.cfg
|
||||
@@ -206,7 +206,7 @@
|
||||
#define PR_ALIGN_OF_DOUBLE 8
|
||||
#define PR_ALIGN_OF_POINTER 4
|
||||
|
||||
-#elif defined(__alpha__)
|
||||
+#elif defined(__alpha__) || defined(__sw_64__)
|
||||
#define IS_LITTLE_ENDIAN 1
|
||||
#undef IS_BIG_ENDIAN
|
||||
#define HAVE_ALIGNED_DOUBLES
|
||||
diff --git a/nspr/pr/include/md/_openbsd.h b/nspr/pr/include/md/_openbsd.h
|
||||
index 1949631..40bbb73 100644
|
||||
--- a/nspr/pr/include/md/_openbsd.h
|
||||
+++ b/nspr/pr/include/md/_openbsd.h
|
||||
@@ -12,6 +12,8 @@
|
||||
#define _PR_SI_SYSNAME "OPENBSD"
|
||||
#if defined(__i386__)
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
+#elif defined(__sw_64__)
|
||||
+#define _PR_SI_ARCHITECTURE "sw_64"
|
||||
#elif defined(__alpha__)
|
||||
#define _PR_SI_ARCHITECTURE "alpha"
|
||||
#elif defined(__amd64__)
|
||||
@@ -65,7 +67,7 @@
|
||||
#define JB_SP_INDEX 2
|
||||
#elif defined(__powerpc__)
|
||||
#define JB_SP_INDEX 1
|
||||
-#elif defined(__alpha__)
|
||||
+#elif defined(__alpha__) || defined(__sw_64__)
|
||||
#define JB_SP_INDEX 34
|
||||
#elif defined(__amd64__)
|
||||
#define JB_SP_INDEX 6
|
||||
diff --git a/nspr/pr/include/pratom.h b/nspr/pr/include/pratom.h
|
||||
index 11a8aae..6591dc8 100644
|
||||
--- a/nspr/pr/include/pratom.h
|
||||
+++ b/nspr/pr/include/pratom.h
|
||||
@@ -107,7 +107,7 @@ NSPR_API(PRInt32) PR_AtomicAdd(PRInt32 *ptr, PRInt32 val);
|
||||
defined(__powerpc__) || \
|
||||
(defined(__arm__) && \
|
||||
defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)) || \
|
||||
- defined(__aarch64__) || defined(__alpha) || \
|
||||
+ defined(__aarch64__) || defined(__alpha) || defined(__sw_64) ||\
|
||||
(defined(__mips__) && \
|
||||
defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)))))
|
||||
|
||||
diff --git a/nspr/pr/src/md/unix/unix.c b/nspr/pr/src/md/unix/unix.c
|
||||
index 56b58aa..c15c275 100644
|
||||
--- a/nspr/pr/src/md/unix/unix.c
|
||||
+++ b/nspr/pr/src/md/unix/unix.c
|
||||
@@ -2901,7 +2901,7 @@ from_heap:
|
||||
* to be made executable because longjmp/signal seem
|
||||
* to put machine instructions on the stack.
|
||||
*/
|
||||
-#if defined(LINUX) && defined(__alpha)
|
||||
+#if defined(LINUX) && (defined(__alpha) || defined(__sw_64))
|
||||
prot |= PROT_EXEC;
|
||||
#endif
|
||||
rv = mmap((vaddr != 0) ? vaddr : lastaddr, size, prot,
|
||||
--
|
||||
2.33.0
|
||||
|
||||
33
nspr.spec
33
nspr.spec
@ -1,16 +1,23 @@
|
||||
%global nspr_version 4.29
|
||||
%global nspr_version 4.32
|
||||
Name: nspr
|
||||
Version: 4.29.0
|
||||
Release: 2
|
||||
Version: 4.32.0
|
||||
Release: 5
|
||||
Summary: Netscape Portable Runtime
|
||||
License: MPLv2.0
|
||||
URL: http://www.mozilla.org/projects/nspr
|
||||
BuildRequires: gcc
|
||||
Source0: https://ftp.mozilla.org/pub/%{name}/releases/v%{nspr_version}/src/%{name}-%{nspr_version}.tar.gz
|
||||
Source0: http://ftp.mozilla.org/pub/%{name}/releases/v%{nspr_version}/src/%{name}-%{nspr_version}.tar.gz
|
||||
Source1: nspr-config.xml
|
||||
|
||||
Patch1: nspr-gcc-atomics.patch
|
||||
|
||||
%ifarch loongarch64
|
||||
Patch2: support-loongarch64-build.patch
|
||||
%endif
|
||||
%ifarch sw_64
|
||||
Patch3: nspr-Add-sw64-architecture.patch
|
||||
%endif
|
||||
|
||||
%description
|
||||
NetScape Portable Runtime (NSPR) provides platform independence for non-GUI
|
||||
operating system facilities. These facilities include threads, thread
|
||||
@ -35,7 +42,8 @@ cp ./nspr/config/nspr-config.in ./nspr/config/nspr-config-pc.in
|
||||
%configure \
|
||||
--includedir=%{_includedir}/nspr4 \
|
||||
--enable-64bit \
|
||||
--enable-optimize="$RPM_OPT_FLAGS"
|
||||
--enable-optimize="$RPM_OPT_FLAGS" \
|
||||
--disable-debug
|
||||
%make_build
|
||||
date +"%e %B %Y" | tr -d '\n' > date.xml
|
||||
echo -n %{version} > version.xml
|
||||
@ -83,6 +91,21 @@ install -c -m 644 nspr-config.1 $RPM_BUILD_ROOT%{_mandir}/man1/nspr-config.1
|
||||
%{_mandir}/man*/*
|
||||
|
||||
%changelog
|
||||
* Fri Feb 24 2023 Wenyu Liu<liuwenyu7@huawei.com> - 4.32.0-5
|
||||
- disable debug option
|
||||
|
||||
* Wed Nov 23 2022 wuzx<wuzx1226@qq.com> - 4.32.0-4
|
||||
- Add sw64 architecture
|
||||
|
||||
* Mon Nov 14 2022 zhaozhen <zhaozhen@loongson.cn> - 4.32.0-3
|
||||
- Support loongarch64
|
||||
|
||||
* Tue Oct 25 2022 Wenyu Liu <liuwenyu7@huawei.com> - 4.32.0-2
|
||||
- rebuild package
|
||||
|
||||
* Mon Nov 29 2021 zhouwenpei <zhouwenpei1@huawei.com> - 4.32.0-1
|
||||
- update to 4.32.0
|
||||
|
||||
* Fri Jul 30 2021 chenyanpanHW <chenyanpan@huawei.com> - 4.29.0-2
|
||||
- DESC: delete -Sgit from %autosetup, and delete BuildRequires git
|
||||
|
||||
|
||||
170
support-loongarch64-build.patch
Normal file
170
support-loongarch64-build.patch
Normal file
@ -0,0 +1,170 @@
|
||||
Description: <short summary of the patch>
|
||||
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 <nanxiongchao@loongson.cn>
|
||||
|
||||
---
|
||||
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: <vendor|upstream|other>, <url of original patch>
|
||||
Bug: <url in upstream bugtracker>
|
||||
Bug-Debian: https://bugs.debian.org/<bugnumber>
|
||||
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
|
||||
Forwarded: <no|not-needed|url proving that it has been forwarded>
|
||||
Reviewed-By: <name and email of someone who approved the patch>
|
||||
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) \
|
||||
{ \
|
||||
Loading…
x
Reference in New Issue
Block a user