Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | From 5ad700c92224193bfc789f7d53af38fc6f8b8904 Mon Sep 17 00:00:00 2001 |
| 2 | From: Hongxu Jia <hongxu.jia@windriver.com> |
| 3 | Date: Thu, 19 Jul 2018 17:31:35 +0800 |
| 4 | Subject: [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 | |
| 16 | Upstream-Status: Inappropriate [oe specific] |
| 17 | |
| 18 | Signed-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 Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 25 | --- a/build/moz.configure/init.configure |
| 26 | +++ b/build/moz.configure/init.configure |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 27 | @@ -650,7 +650,10 @@ def split_triplet(triplet, allow_unknown |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 28 | 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 Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 39 | --- a/js/src/jit/mips-shared/Architecture-mips-shared.h |
| 40 | +++ b/js/src/jit/mips-shared/Architecture-mips-shared.h |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 41 | @@ -26,6 +26,8 @@ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 42 | #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 Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 50 | @@ -93,7 +95,7 @@ class Registers |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 51 | 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 Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 59 | --- a/python/mozbuild/mozbuild/configure/constants.py |
| 60 | +++ b/python/mozbuild/mozbuild/configure/constants.py |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 61 | @@ -90,8 +90,8 @@ CPU_preprocessor_checks = OrderedDict(( |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 62 | ('hppa', '__hppa__'), |
| 63 | ('sparc64', '__sparc__ && __arch64__'), |
| 64 | ('sparc', '__sparc__'), |
| 65 | - ('mips64', '__mips64'), |
| 66 | ('mips32', '__mips__'), |
| 67 | + ('mips64', '__mips64'), |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame^] | 68 | ('sh4', '__sh__'), |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 69 | )) |
| 70 | |