blob: a36478bfba781b760ac2619627b793a859c5ad44 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 5ad700c92224193bfc789f7d53af38fc6f8b8904 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Thu, 19 Jul 2018 17:31:35 +0800
4Subject: [PATCH] fix compiling failure on mips64-n32 bsp
5
6- Tweak mips64-n32 with mips32
7
8- The toolchain of mips64-n32 supports both of macro
9 `__mips64' and `__mips__', but 32bit is required here.
10
11- N32 uses 64-bit registers but restricts addresses to 32 bits.
12 https://www.linux-mips.org/pub/linux/mips/doc/ABI/MIPS-N32-ABI-Handbook.pdf
13 Table 2-1 specifies the use of registers in n32 and native 64-bit mode.
14 From the table, N32 and N64 have the same registers
15
16Upstream-Status: Inappropriate [oe specific]
17
18Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
19---
20 build/moz.configure/init.configure | 5 ++++-
21 js/src/jit/mips-shared/Architecture-mips-shared.h | 4 +++-
22 python/mozbuild/mozbuild/configure/constants.py | 2 +-
23 3 files changed, 8 insertions(+), 3 deletions(-)
24
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080025--- a/build/moz.configure/init.configure
26+++ b/build/moz.configure/init.configure
Brad Bishop15ae2502019-06-18 21:44:24 -040027@@ -650,7 +650,10 @@ def split_triplet(triplet, allow_unknown
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080028 canonical_cpu = 'mips32'
29 endianness = 'little' if 'el' in cpu else 'big'
30 elif cpu in ('mips64', 'mips64el'):
31- canonical_cpu = 'mips64'
32+ if 'n32' in triplet:
33+ canonical_cpu = 'mips32'
34+ else:
35+ canonical_cpu = 'mips64'
36 endianness = 'little' if 'el' in cpu else 'big'
37 elif cpu.startswith('aarch64'):
38 canonical_cpu = 'aarch64'
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080039--- a/js/src/jit/mips-shared/Architecture-mips-shared.h
40+++ b/js/src/jit/mips-shared/Architecture-mips-shared.h
Brad Bishop15ae2502019-06-18 21:44:24 -040041@@ -26,6 +26,8 @@
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080042 #define USES_O32_ABI
43 #elif (defined(_MIPS_SIM) && (_MIPS_SIM == _ABI64)) || defined(JS_SIMULATOR_MIPS64)
44 #define USES_N64_ABI
45+#elif (defined(_MIPS_SIM) && (_MIPS_SIM == _ABIN32))
46+#define USES_N32_ABI
47 #else
48 #error "Unsupported ABI"
49 #endif
Brad Bishop15ae2502019-06-18 21:44:24 -040050@@ -93,7 +95,7 @@ class Registers
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080051 ta1 = t5,
52 ta2 = t6,
53 ta3 = t7,
54-#elif defined(USES_N64_ABI)
55+#elif defined(USES_N64_ABI) || defined(USES_N32_ABI)
56 a4 = r8,
57 a5 = r9,
58 a6 = r10,
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080059--- a/python/mozbuild/mozbuild/configure/constants.py
60+++ b/python/mozbuild/mozbuild/configure/constants.py
Brad Bishop15ae2502019-06-18 21:44:24 -040061@@ -90,8 +90,8 @@ CPU_preprocessor_checks = OrderedDict((
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080062 ('hppa', '__hppa__'),
63 ('sparc64', '__sparc__ && __arch64__'),
64 ('sparc', '__sparc__'),
65- ('mips64', '__mips64'),
66 ('mips32', '__mips__'),
67+ ('mips64', '__mips64'),
Brad Bishop15ae2502019-06-18 21:44:24 -040068 ('sh4', '__sh__'),
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080069 ))
70