2 # User John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
4 # Thu Jun 18 07:11:09 2020 +0000
5 # Node ID 5de7d747a962df5f8aefc016a62d7270ac18879e
6 # Parent e4b11f027efc1f8c2710ae3f52487a8f10a8fb39
7 Bug 1318905 - build: Add riscv64 as target architecture to mozbuild r=glandium
9 Adds the basic definitions for riscv64 to mozbuild, allowing to build Spidermonkey.
11 Differential Revision: https://phabricator.services.mozilla.com/D78623
13 diff -r e4b11f027efc -r 5de7d747a962 build/moz.configure/init.configure
14 --- a/build/moz.configure/init.configure Sun May 31 17:11:57 2020 +0000
15 +++ b/build/moz.configure/init.configure Thu Jun 18 07:11:09 2020 +0000
17 elif cpu.startswith('aarch64'):
18 canonical_cpu = 'aarch64'
20 + elif cpu in ('riscv64', 'riscv64gc'):
21 + canonical_cpu = 'riscv64'
22 + endianness = 'little'
26 diff -r e4b11f027efc -r 5de7d747a962 python/mozbuild/mozbuild/configure/constants.py
27 --- a/python/mozbuild/mozbuild/configure/constants.py Sun May 31 17:11:57 2020 +0000
28 +++ b/python/mozbuild/mozbuild/configure/constants.py Thu Jun 18 07:11:09 2020 +0000
38 ('sparc', '__sparc__'),
39 ('mips64', '__mips64'),
40 ('mips32', '__mips__'),
41 + ('riscv64', '__riscv && __riscv_xlen == 64'),
45 diff -r e4b11f027efc -r 5de7d747a962 python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
46 --- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py Sun May 31 17:11:57 2020 +0000
47 +++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py Thu Jun 18 07:11:09 2020 +0000
48 @@ -1208,6 +1208,10 @@
49 'mips-unknown-linux-gnu': big_endian + {
52 + 'riscv64-unknown-linux-gnu': little_endian + {
56 'sh4-unknown-linux-gnu': little_endian + {
60 # User John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
62 # Thu Jun 18 07:11:09 2020 +0000
63 # Node ID e3d924797cb2d508ff938414168e98ccf66f07fe
64 # Parent 5de7d747a962df5f8aefc016a62d7270ac18879e
65 Bug 1318905 - js:jit: Enable AtomicOperations-feeling-lucky.h on riscv64 r=lth
67 This allows the build on riscv64 to use the atomic operations provided by GCC.
69 Differential Revision: https://phabricator.services.mozilla.com/D78624
71 diff -r 5de7d747a962 -r e3d924797cb2 js/src/jit/AtomicOperations.h
72 --- a/js/src/jit/AtomicOperations.h Thu Jun 18 07:11:09 2020 +0000
73 +++ b/js/src/jit/AtomicOperations.h Thu Jun 18 07:11:09 2020 +0000
75 #elif defined(__ppc__) || defined(__PPC__) || defined(__sparc__) || \
76 defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || \
77 defined(__PPC64LE__) || defined(__alpha__) || defined(__hppa__) || \
78 - defined(__sh__) || defined(__s390__) || defined(__s390x__)
79 + defined(__sh__) || defined(__s390__) || defined(__s390x__) || defined(__riscv)
80 # include "jit/shared/AtomicOperations-feeling-lucky.h"
82 # error "No AtomicOperations support provided for this platform"
83 diff -r 5de7d747a962 -r e3d924797cb2 js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h
84 --- a/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h Thu Jun 18 07:11:09 2020 +0000
85 +++ b/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h Thu Jun 18 07:11:09 2020 +0000
87 # define HAS_64BIT_LOCKFREE
90 +#if defined(__riscv) && __riscv_xlen == 64
91 +# define HAS_64BIT_ATOMICS
92 +# define HAS_64BIT_LOCKFREE
97 # define HAS_64BIT_ATOMICS
99 # User John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
101 # Thu Jun 18 07:11:09 2020 +0000
102 # Node ID 3f652d12b8bc0bd213020d488ecb4d3710bb11fa
103 # Parent e3d924797cb2d508ff938414168e98ccf66f07fe
104 Bug 1318905 - mfbt:tests: Define RETURN_INSTR for riscv64 in TestPoisonArea r=glandium
106 Define RETURN_INSTR for riscv64 in TestPoisonArea, i.e. the riscv64 assembly
107 opcodes for "ret ; ret".
109 Differential Revision: https://phabricator.services.mozilla.com/D78625
111 diff -r e3d924797cb2 -r 3f652d12b8bc mfbt/tests/TestPoisonArea.cpp
112 --- a/mfbt/tests/TestPoisonArea.cpp Thu Jun 18 07:11:09 2020 +0000
113 +++ b/mfbt/tests/TestPoisonArea.cpp Thu Jun 18 07:11:09 2020 +0000
115 #elif defined _ARCH_PPC || defined _ARCH_PWR || defined _ARCH_PWR2
116 # define RETURN_INSTR 0x4E800020 /* blr */
118 +#elif defined __riscv
119 +# define RETURN_INSTR 0x80828082 /* ret; ret */
121 #elif defined __sparc || defined __sparcv9
122 # define RETURN_INSTR 0x81c3e008 /* retl */