blob: 70177d003dff04ec3e392ce810ec62704dfd00a0 [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001Add RISCV32/64 support
2
3Upstream-Status: Pending
4
5Signed-off-by: Andreas MΓΌller <schnitzeltony@gmail.com>
6---
7 build/moz.configure/init.configure | 6 ++++++
8 python/mozbuild/mozbuild/configure/constants.py | 2 ++
9 2 files changed, 8 insertions(+)
10
11diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
12index 0a6a33c..eeee87e 100644
13--- a/build/moz.configure/init.configure
14+++ b/build/moz.configure/init.configure
15@@ -755,6 +755,12 @@ def split_triplet(triplet, allow_msvc=False):
16 elif cpu.startswith('aarch64'):
17 canonical_cpu = 'aarch64'
18 endianness = 'little'
19+ elif cpu in ("riscv32", "riscv32gc"):
20+ canonical_cpu = "riscv32"
21+ endianness = "little"
22+ elif cpu in ("riscv64", "riscv64gc"):
23+ canonical_cpu = "riscv64"
24+ endianness = "little"
25 elif cpu == 'sh4':
26 canonical_cpu = 'sh4'
27 endianness = 'little'
28diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py
29index 7542dcd..de25be2 100644
30--- a/python/mozbuild/mozbuild/configure/constants.py
31+++ b/python/mozbuild/mozbuild/configure/constants.py
32@@ -50,6 +50,8 @@ CPU_bitness = {
33 'mips64': 64,
34 'ppc': 32,
35 'ppc64': 64,
36+ 'riscv32': 32,
37+ 'riscv64': 64,
38 's390': 32,
39 's390x': 64,
40 'sh4': 32,
41@@ -82,6 +84,8 @@ CPU_preprocessor_checks = OrderedDict((
42 ('s390', '__s390__'),
43 ('ppc64', '__powerpc64__'),
44 ('ppc', '__powerpc__'),
45+ ('riscv32', '__riscv && __SIZEOF_POINTER__ == 4'),
46+ ('riscv64', '__riscv && __SIZEOF_POINTER__ == 8'),
47 ('Alpha', '__alpha__'),
48 ('hppa', '__hppa__'),
49 ('sparc64', '__sparc__ && __arch64__'),
50--
512.31.1
52