blob: 4354a9dee6f198ddded5f8d8328f513e549d2d53 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001Add RISC-V support
2
3Upstream-Status: Submitted [https://bugzilla.mozilla.org/show_bug.cgi?id=1318905]
4
5Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
6
7diff --git a/build/autoconf/config.guess b/build/autoconf/config.guess
8index d5d667d..1277a86 100755
9--- a/build/autoconf/config.guess
10+++ b/build/autoconf/config.guess
11@@ -1029,6 +1029,9 @@ EOF
12 ppcle:Linux:*:*)
13 echo powerpcle-unknown-linux-${LIBC}
14 exit ;;
15+ riscv32:Linux:*:* | riscv64:Linux:*:*)
16+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
17+ exit ;;
18 s390:Linux:*:* | s390x:Linux:*:*)
19 echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
20 exit ;;
21diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
22index 6fe6591..56e6730 100644
23--- a/build/moz.configure/init.configure
24+++ b/build/moz.configure/init.configure
25@@ -362,6 +362,9 @@ def split_triplet(triplet):
26 elif cpu.startswith('aarch64'):
27 canonical_cpu = 'aarch64'
28 endianness = 'little'
29+ elif cpu in ('riscv32', 'riscv64'):
30+ canonical_cpu = cpu
31+ endianness = 'little'
32 else:
33 die('Unknown CPU type: %s' % cpu)
34
35diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h
36index 15dd4bf..4f37218 100644
37--- a/mfbt/double-conversion/utils.h
38+++ b/mfbt/double-conversion/utils.h
39@@ -60,7 +60,8 @@
40 defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
41 defined(__SH4__) || defined(__alpha__) || \
42 defined(_MIPS_ARCH_MIPS32R2) || \
43- defined(__AARCH64EL__) || defined(__aarch64__)
44+ defined(__AARCH64EL__) || defined(__aarch64__) || \
45+ defined(__riscv)
46 #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
47 #elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
48 #if defined(_WIN32)
49diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py
50index dfc7cf8..4f8d666 100644
51--- a/python/mozbuild/mozbuild/configure/constants.py
52+++ b/python/mozbuild/mozbuild/configure/constants.py
53@@ -48,6 +48,8 @@ CPU_bitness = {
54 'mips64': 64,
55 'ppc': 32,
56 'ppc64': 64,
57+ 'riscv32': 32,
58+ 'riscv64': 64,
59 's390': 32,
60 's390x': 64,
61 'sparc': 32,
62@@ -79,6 +81,8 @@ CPU_preprocessor_checks = OrderedDict((
63 ('s390', '__s390__'),
64 ('ppc64', '__powerpc64__'),
65 ('ppc', '__powerpc__'),
66+ ('riscv32', '__riscv && __SIZEOF_POINTER__ == 4'),
67+ ('riscv64', '__riscv && __SIZEOF_POINTER__ == 8'),
68 ('Alpha', '__alpha__'),
69 ('hppa', '__hppa__'),
70 ('sparc64', '__sparc__ && __arch64__'),