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 | |
| 25 | diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure |
| 26 | index 6fe6591..a77b46c 100644 |
| 27 | --- a/build/moz.configure/init.configure |
| 28 | +++ b/build/moz.configure/init.configure |
| 29 | @@ -357,7 +357,10 @@ def split_triplet(triplet): |
| 30 | canonical_cpu = 'mips32' |
| 31 | endianness = 'little' if 'el' in cpu else 'big' |
| 32 | elif cpu in ('mips64', 'mips64el'): |
| 33 | - canonical_cpu = 'mips64' |
| 34 | + if 'n32' in triplet: |
| 35 | + canonical_cpu = 'mips32' |
| 36 | + else: |
| 37 | + canonical_cpu = 'mips64' |
| 38 | endianness = 'little' if 'el' in cpu else 'big' |
| 39 | elif cpu.startswith('aarch64'): |
| 40 | canonical_cpu = 'aarch64' |
| 41 | diff --git a/js/src/jit/mips-shared/Architecture-mips-shared.h b/js/src/jit/mips-shared/Architecture-mips-shared.h |
| 42 | index 7afe305..c6e29dc 100644 |
| 43 | --- a/js/src/jit/mips-shared/Architecture-mips-shared.h |
| 44 | +++ b/js/src/jit/mips-shared/Architecture-mips-shared.h |
| 45 | @@ -24,6 +24,8 @@ |
| 46 | #define USES_O32_ABI |
| 47 | #elif (defined(_MIPS_SIM) && (_MIPS_SIM == _ABI64)) || defined(JS_SIMULATOR_MIPS64) |
| 48 | #define USES_N64_ABI |
| 49 | +#elif (defined(_MIPS_SIM) && (_MIPS_SIM == _ABIN32)) |
| 50 | +#define USES_N32_ABI |
| 51 | #else |
| 52 | #error "Unsupported ABI" |
| 53 | #endif |
| 54 | @@ -91,7 +93,7 @@ class Registers |
| 55 | ta1 = t5, |
| 56 | ta2 = t6, |
| 57 | ta3 = t7, |
| 58 | -#elif defined(USES_N64_ABI) |
| 59 | +#elif defined(USES_N64_ABI) || defined(USES_N32_ABI) |
| 60 | a4 = r8, |
| 61 | a5 = r9, |
| 62 | a6 = r10, |
| 63 | diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py |
| 64 | index dfc7cf8..27f83ab 100644 |
| 65 | --- a/python/mozbuild/mozbuild/configure/constants.py |
| 66 | +++ b/python/mozbuild/mozbuild/configure/constants.py |
| 67 | @@ -83,8 +83,8 @@ CPU_preprocessor_checks = OrderedDict(( |
| 68 | ('hppa', '__hppa__'), |
| 69 | ('sparc64', '__sparc__ && __arch64__'), |
| 70 | ('sparc', '__sparc__'), |
| 71 | - ('mips64', '__mips64'), |
| 72 | ('mips32', '__mips__'), |
| 73 | + ('mips64', '__mips64'), |
| 74 | )) |
| 75 | |
| 76 | assert sorted(CPU_preprocessor_checks.keys()) == sorted(CPU.POSSIBLE_VALUES) |
| 77 | -- |
| 78 | 2.7.4 |
| 79 | |