Created
November 16, 2016 07:27
-
-
Save sorear/996aacf0be0ad84c97c582db551704fb to your computer and use it in GitHub Desktop.
Patch to make SpiderMonkey build on RISC-V
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur mozilla-central-79feeed42933.orig/build/autoconf/config.guess mozilla-central-79feeed42933/build/autoconf/config.guess | |
--- mozilla-central-79feeed42933.orig/build/autoconf/config.guess 2016-11-15 23:25:35.000000000 +0000 | |
+++ mozilla-central-79feeed42933/build/autoconf/config.guess 2016-11-16 05:01:37.000000000 +0000 | |
@@ -2,7 +2,7 @@ | |
# Attempt to guess a canonical system name. | |
# Copyright 1992-2016 Free Software Foundation, Inc. | |
-timestamp='2016-03-24' | |
+timestamp='2016-10-02' | |
# This file is free software; you can redistribute it and/or modify it | |
# under the terms of the GNU General Public License as published by | |
@@ -186,9 +186,12 @@ | |
*) machine=${UNAME_MACHINE_ARCH}-unknown ;; | |
esac | |
# The Operating System including object format, if it has switched | |
- # to ELF recently, or will in the future. | |
+ # to ELF recently (or will in the future) and ABI. | |
case "${UNAME_MACHINE_ARCH}" in | |
- arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) | |
+ earm*) | |
+ os=netbsdelf | |
+ ;; | |
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax) | |
eval $set_cc_for_build | |
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | |
| grep -q __ELF__ | |
@@ -386,7 +389,7 @@ | |
# This test works for both compilers. | |
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then | |
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ | |
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ | |
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ | |
grep IS_64BIT_ARCH >/dev/null | |
then | |
SUN_ARCH=x86_64 | |
@@ -684,7 +687,7 @@ | |
exit (0); | |
} | |
EOF | |
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` | |
+ (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` | |
test -z "$HP_ARCH" && HP_ARCH=hppa | |
fi ;; | |
esac | |
@@ -701,7 +704,7 @@ | |
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess | |
# => hppa64-hp-hpux11.23 | |
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | | |
+ if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | | |
grep -q __LP64__ | |
then | |
HP_ARCH=hppa2.0w | |
@@ -900,7 +903,7 @@ | |
exit ;; | |
*:GNU/*:*:*) | |
# other systems with GNU libc and userland | |
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} | |
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} | |
exit ;; | |
i*86:Minix:*:*) | |
echo ${UNAME_MACHINE}-pc-minix | |
@@ -997,6 +1000,9 @@ | |
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` | |
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } | |
;; | |
+ mips64el:Linux:*:*) | |
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} | |
+ exit ;; | |
openrisc*:Linux:*:*) | |
echo or1k-unknown-linux-${LIBC} | |
exit ;; | |
@@ -1029,6 +1035,9 @@ | |
ppcle:Linux:*:*) | |
echo powerpcle-unknown-linux-${LIBC} | |
exit ;; | |
+ riscv32:Linux:*:* | riscv64:Linux:*:*) | |
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC} | |
+ exit ;; | |
s390:Linux:*:* | s390x:Linux:*:*) | |
echo ${UNAME_MACHINE}-ibm-linux-${LIBC} | |
exit ;; | |
@@ -1294,7 +1303,7 @@ | |
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then | |
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then | |
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ | |
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ | |
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ | |
grep IS_64BIT_ARCH >/dev/null | |
then | |
case $UNAME_PROCESSOR in | |
@@ -1389,7 +1398,7 @@ | |
echo i386-pc-xenix | |
exit ;; | |
i*86:skyos:*:*) | |
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' | |
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` | |
exit ;; | |
i*86:rdos:*:*) | |
echo ${UNAME_MACHINE}-pc-rdos | |
@@ -1408,18 +1417,17 @@ | |
cat >&2 <<EOF | |
$0: unable to guess system type | |
-This script, last modified $timestamp, has failed to recognize | |
-the operating system you are using. It is advised that you | |
-download the most up to date version of the config scripts from | |
+This script (version $timestamp), has failed to recognize the | |
+operating system you are using. If your script is old, overwrite | |
+config.guess and config.sub with the latest versions from: | |
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess | |
and | |
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub | |
-If the version you run ($0) is already up to date, please | |
-send the following data and any information you think might be | |
-pertinent to <config-patches@gnu.org> in order to provide the needed | |
-information to handle your system. | |
+If $0 has already been updated, send the following data and any | |
+information you think might be pertinent to config-patches@gnu.org to | |
+provide the necessary information to handle your system. | |
config.guess timestamp = $timestamp | |
diff -ur mozilla-central-79feeed42933.orig/build/moz.configure/init.configure mozilla-central-79feeed42933/build/moz.configure/init.configure | |
--- mozilla-central-79feeed42933.orig/build/moz.configure/init.configure 2016-11-15 23:25:35.000000000 +0000 | |
+++ mozilla-central-79feeed42933/build/moz.configure/init.configure 2016-11-16 05:19:20.000000000 +0000 | |
@@ -418,6 +418,9 @@ | |
elif cpu.startswith('aarch64'): | |
canonical_cpu = 'aarch64' | |
endianness = 'little' | |
+ elif cpu in ('riscv32', 'riscv64'): | |
+ canonical_cpu = cpu | |
+ endianness = 'little' | |
else: | |
die('Unknown CPU type: %s' % cpu) | |
diff -ur mozilla-central-79feeed42933.orig/js/src/jit/none/MacroAssembler-none.h mozilla-central-79feeed42933/js/src/jit/none/MacroAssembler-none.h | |
--- mozilla-central-79feeed42933.orig/js/src/jit/none/MacroAssembler-none.h 2016-11-15 23:25:35.000000000 +0000 | |
+++ mozilla-central-79feeed42933/js/src/jit/none/MacroAssembler-none.h 2016-11-16 06:31:24.000000000 +0000 | |
@@ -425,6 +425,10 @@ | |
Address ToPayload(Address) { MOZ_CRASH(); } | |
Address ToType(Address) { MOZ_CRASH(); } | |
#endif | |
+ | |
+ struct AutoPrepareForPatching { | |
+ explicit AutoPrepareForPatching(MacroAssemblerNone&) {} | |
+ }; | |
}; | |
typedef MacroAssemblerNone MacroAssemblerSpecific; | |
diff -ur mozilla-central-79feeed42933.orig/mfbt/double-conversion/utils.h mozilla-central-79feeed42933/mfbt/double-conversion/utils.h | |
--- mozilla-central-79feeed42933.orig/mfbt/double-conversion/utils.h 2016-11-15 23:25:35.000000000 +0000 | |
+++ mozilla-central-79feeed42933/mfbt/double-conversion/utils.h 2016-11-16 05:40:50.000000000 +0000 | |
@@ -60,7 +60,8 @@ | |
defined(__sparc__) || defined(__sparc) || defined(__s390__) || \ | |
defined(__SH4__) || defined(__alpha__) || \ | |
defined(_MIPS_ARCH_MIPS32R2) || \ | |
- defined(__AARCH64EL__) || defined(__aarch64__) | |
+ defined(__AARCH64EL__) || defined(__aarch64__) || \ | |
+ defined(__riscv) | |
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 | |
#elif defined(_M_IX86) || defined(__i386__) || defined(__i386) | |
#if defined(_WIN32) | |
diff -ur mozilla-central-79feeed42933.orig/mfbt/tests/TestPoisonArea.cpp mozilla-central-79feeed42933/mfbt/tests/TestPoisonArea.cpp | |
--- mozilla-central-79feeed42933.orig/mfbt/tests/TestPoisonArea.cpp 2016-11-15 23:25:35.000000000 +0000 | |
+++ mozilla-central-79feeed42933/mfbt/tests/TestPoisonArea.cpp 2016-11-16 05:59:02.000000000 +0000 | |
@@ -157,6 +157,9 @@ | |
#elif defined __aarch64__ | |
#define RETURN_INSTR 0xd65f03c0 /* ret */ | |
+#elif defined __riscv | |
+#define RETURN_INSTR 0x8067 /* ret aka jalr zero, 0(ra) */ | |
+ | |
#elif defined __ia64 | |
struct ia64_instr { uint32_t mI[4]; }; | |
static const ia64_instr _return_instr = | |
diff -ur mozilla-central-79feeed42933.orig/python/mozbuild/mozbuild/configure/constants.py mozilla-central-79feeed42933/python/mozbuild/mozbuild/configure/constants.py | |
--- mozilla-central-79feeed42933.orig/python/mozbuild/mozbuild/configure/constants.py 2016-11-15 23:25:35.000000000 +0000 | |
+++ mozilla-central-79feeed42933/python/mozbuild/mozbuild/configure/constants.py 2016-11-16 05:12:14.000000000 +0000 | |
@@ -48,6 +48,8 @@ | |
'mips64': 64, | |
'ppc': 32, | |
'ppc64': 64, | |
+ 'riscv32': 32, | |
+ 'riscv64': 64, | |
's390': 32, | |
's390x': 64, | |
'sparc': 32, | |
@@ -79,6 +81,8 @@ | |
('s390', '__s390__'), | |
('ppc64', '__powerpc64__'), | |
('ppc', '__powerpc__'), | |
+ ('riscv64', '__riscv64'), | |
+ ('riscv32', '__riscv32'), | |
('Alpha', '__alpha__'), | |
('hppa', '__hppa__'), | |
('sparc64', '__sparc__ && __arch64__'), | |
diff -ur mozilla-central-79feeed42933.orig/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py mozilla-central-79feeed42933/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py | |
--- mozilla-central-79feeed42933.orig/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py 2016-11-15 23:25:35.000000000 +0000 | |
+++ mozilla-central-79feeed42933/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py 2016-11-16 05:14:16.000000000 +0000 | |
@@ -1024,6 +1024,12 @@ | |
'mips-unknown-linux-gnu': big_endian + { | |
'__mips__': 1, | |
}, | |
+ 'riscv64-unknown-linux-gnu': little_endian + { | |
+ '__riscv64': 1, | |
+ }, | |
+ 'riscv32-unknown-linux-gnu': little_endian + { | |
+ '__riscv32': 1, | |
+ }, | |
} | |
PLATFORMS['powerpc64le-unknown-linux-gnu'] = \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment