Changeset View
Changeset View
Standalone View
Standalone View
libraries/source/spidermonkey/riscv64-generic-support.diff
- This file was added.
Bug: https://bugs.gentoo.org/781137 | |||||
Upstream: https://bugzilla.mozilla.org/show_bug.cgi?id=1318905 | |||||
Patches: | |||||
https://hg.mozilla.org/mozilla-central/rev/06d7e1b6b7e7 | |||||
https://hg.mozilla.org/mozilla-central/rev/ec48f15d085c | |||||
https://hg.mozilla.org/mozilla-central/rev/6803dda74d33 | |||||
diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure | |||||
index b887153321..5c27507606 100644 | |||||
--- a/build/moz.configure/init.configure | |||||
+++ b/build/moz.configure/init.configure | |||||
@@ -755,6 +755,9 @@ def split_triplet(triplet, allow_msvc=False): | |||||
elif cpu.startswith('aarch64'): | |||||
canonical_cpu = 'aarch64' | |||||
endianness = 'little' | |||||
+ elif cpu in ('riscv64', 'riscv64gc'): | |||||
+ canonical_cpu = 'riscv64' | |||||
+ endianness = 'little' | |||||
elif cpu == 'sh4': | |||||
canonical_cpu = 'sh4' | |||||
endianness = 'little' | |||||
diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py | |||||
index 7542dcdc63..49ef3b857d 100644 | |||||
--- a/python/mozbuild/mozbuild/configure/constants.py | |||||
+++ b/python/mozbuild/mozbuild/configure/constants.py | |||||
@@ -49,6 +49,7 @@ CPU_bitness = { | |||||
'mips64': 64, | |||||
'ppc': 32, | |||||
'ppc64': 64, | |||||
+ 'riscv64': 64, | |||||
's390': 32, | |||||
's390x': 64, | |||||
'sh4': 32, | |||||
@@ -87,6 +88,7 @@ CPU_preprocessor_checks = OrderedDict(( | |||||
('sparc', '__sparc__'), | |||||
('mips64', '__mips64'), | |||||
('mips32', '__mips__'), | |||||
+ ('riscv64', '__riscv && __riscv_xlen == 64'), | |||||
('sh4', '__sh__'), | |||||
)) | |||||
diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py | |||||
index 37c4e26f0f..5d3d5891dc 100755 | |||||
--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py | |||||
+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py | |||||
@@ -1208,6 +1208,10 @@ class LinuxCrossCompileToolchainTest(BaseToolchainTest): | |||||
'mips-unknown-linux-gnu': big_endian + { | |||||
'__mips__': 1, | |||||
}, | |||||
+ 'riscv64-unknown-linux-gnu': little_endian + { | |||||
+ '__riscv': 1, | |||||
+ '__riscv_xlen': 64, | |||||
+ }, | |||||
'sh4-unknown-linux-gnu': little_endian + { | |||||
'__sh__': 1, | |||||
}, | |||||
diff --git a/js/src/jit/AtomicOperations.h b/js/src/jit/AtomicOperations.h | |||||
index 0f45ac8b58..f48d2adce9 100644 | |||||
--- a/js/src/jit/AtomicOperations.h | |||||
+++ b/js/src/jit/AtomicOperations.h | |||||
@@ -392,6 +392,6 @@ inline bool AtomicOperations::isLockfreeJS(int32_t size) { | |||||
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..1ce40efacc 100644 | |||||
--- a/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h | |||||
+++ b/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h | |||||
@@ -63,6 +63,11 @@ | |||||
# define HAS_64BIT_LOCKFREE | |||||
#endif | |||||
+#if defined(__riscv) && __riscv_xlen == 64 | |||||
+# define HAS_64BIT_ATOMICS | |||||
+# define HAS_64BIT_LOCKFREE | |||||
+#endif | |||||
+ | |||||
#ifdef __sparc__ | |||||
# ifdef __LP64__ | |||||
# define HAS_64BIT_ATOMICS | |||||
diff --git a/mfbt/tests/TestPoisonArea.cpp b/mfbt/tests/TestPoisonArea.cpp | |||||
index fbd3364715..9d2ffa498b 100644 | |||||
--- a/mfbt/tests/TestPoisonArea.cpp | |||||
+++ b/mfbt/tests/TestPoisonArea.cpp | |||||
@@ -132,6 +132,9 @@ | |||||
#elif defined _ARCH_PPC || defined _ARCH_PWR || defined _ARCH_PWR2 | |||||
# define RETURN_INSTR 0x4E800020 /* blr */ | |||||
+#elif defined __riscv | |||||
+# define RETURN_INSTR 0x80828082 /* ret; ret */ | |||||
+ | |||||
#elif defined __sparc || defined __sparcv9 | |||||
# define RETURN_INSTR 0x81c3e008 /* retl */ | |||||
Wildfire Games · Phabricator