Compare commits

...

1 Commits

Author SHA1 Message Date
David Abdurachmanov 9b701e514d
Enable riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2020-04-11 17:09:32 +03:00
2 changed files with 97 additions and 1 deletions

View File

@ -0,0 +1,85 @@
diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
index c772604035..891359c5ba 100644
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -730,6 +730,9 @@ def split_triplet(triplet, allow_unknown=False):
elif cpu.startswith('aarch64'):
canonical_cpu = 'aarch64'
endianness = 'little'
+ elif cpu.startswith('riscv64'):
+ canonical_cpu = 'riscv64'
+ endianness = 'little'
elif cpu == 'sh4':
canonical_cpu = 'sh4'
endianness = 'little'
diff --git a/js/src/jit/AtomicOperations.h b/js/src/jit/AtomicOperations.h
index 0486cbad1c..d00e2769a5 100644
--- a/js/src/jit/AtomicOperations.h
+++ b/js/src/jit/AtomicOperations.h
@@ -391,7 +391,8 @@ inline bool AtomicOperations::isLockfreeJS(int32_t size) {
#elif defined(__ppc__) || defined(__PPC__) || defined(__sparc__) || \
defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || \
defined(__PPC64LE__) || defined(__alpha__) || defined(__hppa__) || \
- defined(__sh__) || defined(__s390__) || defined(__s390x__)
+ defined(__sh__) || defined(__s390__) || defined(__s390x__) || \
+ defined(__riscv)
# include "jit/shared/AtomicOperations-feeling-lucky.h"
#else
# error "No AtomicOperations support provided for this platform"
diff --git a/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h b/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h
index f002cd46c9..e4b6ff9c29 100644
--- a/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h
+++ b/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h
@@ -70,6 +70,13 @@
# endif
#endif
+#ifdef __riscv
+# if __riscv_xlen == 64
+# define HAS_64BIT_ATOMICS
+# define HAS_64BIT_LOCKFREE
+# endif
+#endif
+
#ifdef JS_CODEGEN_NONE
# ifdef JS_64BIT
# define HAS_64BIT_ATOMICS
diff --git a/mfbt/tests/TestPoisonArea.cpp b/mfbt/tests/TestPoisonArea.cpp
index 2834678ad8..381ad08df1 100644
--- a/mfbt/tests/TestPoisonArea.cpp
+++ b/mfbt/tests/TestPoisonArea.cpp
@@ -159,6 +159,14 @@
#elif defined __aarch64__ || defined _M_ARM64
# define RETURN_INSTR 0xd65f03c0 /* ret */
+#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
+#if defined(__riscv_compressed)
+#define RETURN_INSTR 0x8082 /* ret */
+#define RETURN_INSTR_TYPE uint16_t
+#else
+#define RETURN_INSTR 0x00008067 /* ret */
+#endif
+
#elif defined __ia64
struct ia64_instr {
uint32_t mI[4];
diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py
index 8b7d2261d2..8619421cac 100644
--- a/python/mozbuild/mozbuild/configure/constants.py
+++ b/python/mozbuild/mozbuild/configure/constants.py
@@ -50,6 +50,7 @@ CPU_bitness = {
'mips64': 64,
'ppc': 32,
'ppc64': 64,
+ 'riscv64': 64,
's390': 32,
's390x': 64,
'sh4': 32,
@@ -89,6 +90,7 @@ CPU_preprocessor_checks = OrderedDict((
('mips64', '__mips64'),
('mips32', '__mips__'),
('sh4', '__sh__'),
+ ('riscv64', 'defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64'),
))
assert sorted(CPU_preprocessor_checks.keys()) == sorted(CPU.POSSIBLE_VALUES)

View File

@ -28,7 +28,7 @@
Name: mozjs%{major}
Version: 68.7.0
Release: 1%{?dist}
Release: 1.0.riscv64%{?dist}
Summary: SpiderMonkey JavaScript library
License: MPLv2.0 and MPLv1.1 and BSD and GPLv2+ and GPLv3+ and LGPLv2+ and AFL and ASL 2.0
@ -64,6 +64,8 @@ Patch26: build-icu-big-endian.patch
# Support Python 3 in js tests
Patch30: jstests_python-3.patch
Patch400: firefox-68.7.0-add-riscv64.patch
BuildRequires: autoconf213
BuildRequires: cargo
BuildRequires: clang-devel
@ -133,6 +135,9 @@ pushd ../..
# Execute tests with Python 3
%patch30 -p1
# riscv
%patch400 -p1
# make sure we don't ever accidentally link against bundled security libs
rm -rf security/
popd
@ -169,6 +174,9 @@ autoconf-2.13
--disable-optimize \
--enable-pie \
--disable-jemalloc \
%ifarch riscv64
--disable-ion \
%endif
--enable-unaligned-private-values
%if 0%{?big_endian}
@ -263,6 +271,9 @@ PYTHONPATH=tests/lib %{__python3} jit-test/jit_test.py -s -t 1800 --no-progress
%{_includedir}/mozjs-%{major}/
%changelog
* Sat Apr 11 2020 David Abdurachmanov <david.abdurachmanov@sifive.com> - 68.7.0-1.0.riscv64
- Add support for RISC-V (riscv64)
* Tue Apr 07 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.7.0-1
- Update to 68.7.0