at 23.11-beta 123 lines 5.0 kB view raw
1# HG changeset patch 2# User John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> 3# Date 1592464269 0 4# Thu Jun 18 07:11:09 2020 +0000 5# Node ID 5de7d747a962df5f8aefc016a62d7270ac18879e 6# Parent e4b11f027efc1f8c2710ae3f52487a8f10a8fb39 7Bug 1318905 - build: Add riscv64 as target architecture to mozbuild r=glandium 8 9Adds the basic definitions for riscv64 to mozbuild, allowing to build Spidermonkey. 10 11Differential Revision: https://phabricator.services.mozilla.com/D78623 12 13diff -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 16@@ -741,6 +741,9 @@ 17 elif cpu.startswith('aarch64'): 18 canonical_cpu = 'aarch64' 19 endianness = 'little' 20+ elif cpu in ('riscv64', 'riscv64gc'): 21+ canonical_cpu = 'riscv64' 22+ endianness = 'little' 23 elif cpu == 'sh4': 24 canonical_cpu = 'sh4' 25 endianness = 'little' 26diff -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 29@@ -49,6 +49,7 @@ 30 'mips64': 64, 31 'ppc': 32, 32 'ppc64': 64, 33+ 'riscv64': 64, 34 's390': 32, 35 's390x': 64, 36 'sh4': 32, 37@@ -87,6 +88,7 @@ 38 ('sparc', '__sparc__'), 39 ('mips64', '__mips64'), 40 ('mips32', '__mips__'), 41+ ('riscv64', '__riscv && __riscv_xlen == 64'), 42 ('sh4', '__sh__'), 43 )) 44 45diff -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 + { 50 '__mips__': 1, 51 }, 52+ 'riscv64-unknown-linux-gnu': little_endian + { 53+ '__riscv': 1, 54+ '__riscv_xlen': 64, 55+ }, 56 'sh4-unknown-linux-gnu': little_endian + { 57 '__sh__': 1, 58 }, 59# HG changeset patch 60# User John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> 61# Date 1592464269 0 62# Thu Jun 18 07:11:09 2020 +0000 63# Node ID e3d924797cb2d508ff938414168e98ccf66f07fe 64# Parent 5de7d747a962df5f8aefc016a62d7270ac18879e 65Bug 1318905 - js:jit: Enable AtomicOperations-feeling-lucky.h on riscv64 r=lth 66 67This allows the build on riscv64 to use the atomic operations provided by GCC. 68 69Differential Revision: https://phabricator.services.mozilla.com/D78624 70 71diff -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 74@@ -391,7 +391,7 @@ 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" 81 #else 82 # error "No AtomicOperations support provided for this platform" 83diff -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 86@@ -63,6 +63,11 @@ 87 # define HAS_64BIT_LOCKFREE 88 #endif 89 90+#if defined(__riscv) && __riscv_xlen == 64 91+# define HAS_64BIT_ATOMICS 92+# define HAS_64BIT_LOCKFREE 93+#endif 94+ 95 #ifdef __sparc__ 96 # ifdef __LP64__ 97 # define HAS_64BIT_ATOMICS 98# HG changeset patch 99# User John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> 100# Date 1592464269 0 101# Thu Jun 18 07:11:09 2020 +0000 102# Node ID 3f652d12b8bc0bd213020d488ecb4d3710bb11fa 103# Parent e3d924797cb2d508ff938414168e98ccf66f07fe 104Bug 1318905 - mfbt:tests: Define RETURN_INSTR for riscv64 in TestPoisonArea r=glandium 105 106Define RETURN_INSTR for riscv64 in TestPoisonArea, i.e. the riscv64 assembly 107opcodes for "ret ; ret". 108 109Differential Revision: https://phabricator.services.mozilla.com/D78625 110 111diff -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 114@@ -132,6 +132,9 @@ 115 #elif defined _ARCH_PPC || defined _ARCH_PWR || defined _ARCH_PWR2 116 # define RETURN_INSTR 0x4E800020 /* blr */ 117 118+#elif defined __riscv 119+# define RETURN_INSTR 0x80828082 /* ret; ret */ 120+ 121 #elif defined __sparc || defined __sparcv9 122 # define RETURN_INSTR 0x81c3e008 /* retl */ 123