blob: b882d76ec2e8027d927e4904c099b4a61cd18941 [file] [log] [blame]
Brad Bishopc8f47122019-06-24 09:36:18 -04001From f2f8be496c8e34b4d909b688a95c6f8565201081 Mon Sep 17 00:00:00 2001
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08002From: Hongxu Jia <hongxu.jia@windriver.com>
Brad Bishopc8f47122019-06-24 09:36:18 -04003Date: Wed, 19 Jun 2019 14:30:44 +0800
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08004Subject: [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>
Brad Bishopc8f47122019-06-24 09:36:18 -040019Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080020---
21 build/moz.configure/init.configure | 5 ++++-
22 js/src/jit/mips-shared/Architecture-mips-shared.h | 4 +++-
23 python/mozbuild/mozbuild/configure/constants.py | 2 +-
24 3 files changed, 8 insertions(+), 3 deletions(-)
25
Brad Bishopc8f47122019-06-24 09:36:18 -040026diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
27index 648ac2d..d0bcaf8 100644
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080028--- a/build/moz.configure/init.configure
29+++ b/build/moz.configure/init.configure
Brad Bishopc8f47122019-06-24 09:36:18 -040030@@ -650,7 +650,10 @@ def split_triplet(triplet, allow_unknown=False):
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080031 canonical_cpu = 'mips32'
32 endianness = 'little' if 'el' in cpu else 'big'
33 elif cpu in ('mips64', 'mips64el'):
34- canonical_cpu = 'mips64'
35+ if 'n32' in triplet:
36+ canonical_cpu = 'mips32'
37+ else:
38+ canonical_cpu = 'mips64'
39 endianness = 'little' if 'el' in cpu else 'big'
40 elif cpu.startswith('aarch64'):
41 canonical_cpu = 'aarch64'
Brad Bishopc8f47122019-06-24 09:36:18 -040042diff --git a/js/src/jit/mips-shared/Architecture-mips-shared.h b/js/src/jit/mips-shared/Architecture-mips-shared.h
43index e95ffd4..caf83f7 100644
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080044--- a/js/src/jit/mips-shared/Architecture-mips-shared.h
45+++ b/js/src/jit/mips-shared/Architecture-mips-shared.h
Brad Bishopc8f47122019-06-24 09:36:18 -040046@@ -28,6 +28,8 @@
47 #elif (defined(_MIPS_SIM) && (_MIPS_SIM == _ABI64)) || \
48 defined(JS_SIMULATOR_MIPS64)
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080049 #define USES_N64_ABI
50+#elif (defined(_MIPS_SIM) && (_MIPS_SIM == _ABIN32))
51+#define USES_N32_ABI
52 #else
53 #error "Unsupported ABI"
54 #endif
Brad Bishopc8f47122019-06-24 09:36:18 -040055@@ -94,7 +96,7 @@ class Registers {
56 ta1 = t5,
57 ta2 = t6,
58 ta3 = t7,
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080059-#elif defined(USES_N64_ABI)
60+#elif defined(USES_N64_ABI) || defined(USES_N32_ABI)
Brad Bishopc8f47122019-06-24 09:36:18 -040061 a4 = r8,
62 a5 = r9,
63 a6 = r10,
64diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py
65index 1067b6a..e0f0405 100644
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080066--- a/python/mozbuild/mozbuild/configure/constants.py
67+++ b/python/mozbuild/mozbuild/configure/constants.py
Brad Bishop15ae2502019-06-18 21:44:24 -040068@@ -90,8 +90,8 @@ CPU_preprocessor_checks = OrderedDict((
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080069 ('hppa', '__hppa__'),
70 ('sparc64', '__sparc__ && __arch64__'),
71 ('sparc', '__sparc__'),
72- ('mips64', '__mips64'),
73 ('mips32', '__mips__'),
74+ ('mips64', '__mips64'),
Brad Bishop15ae2502019-06-18 21:44:24 -040075 ('sh4', '__sh__'),
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080076 ))
77
Brad Bishopc8f47122019-06-24 09:36:18 -040078--
792.7.4
80