Brad Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 1 | From f2f8be496c8e34b4d909b688a95c6f8565201081 Mon Sep 17 00:00:00 2001 |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 2 | From: Hongxu Jia <hongxu.jia@windriver.com> |
Brad Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 3 | Date: Wed, 19 Jun 2019 14:30:44 +0800 |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 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> |
Brad Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 19 | Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com> |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 20 | --- |
| 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 Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 26 | diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure |
| 27 | index 648ac2d..d0bcaf8 100644 |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 28 | --- a/build/moz.configure/init.configure |
| 29 | +++ b/build/moz.configure/init.configure |
Brad Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 30 | @@ -650,7 +650,10 @@ def split_triplet(triplet, allow_unknown=False): |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 31 | 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 Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 42 | diff --git a/js/src/jit/mips-shared/Architecture-mips-shared.h b/js/src/jit/mips-shared/Architecture-mips-shared.h |
| 43 | index e95ffd4..caf83f7 100644 |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 44 | --- a/js/src/jit/mips-shared/Architecture-mips-shared.h |
| 45 | +++ b/js/src/jit/mips-shared/Architecture-mips-shared.h |
Brad Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 46 | @@ -28,6 +28,8 @@ |
| 47 | #elif (defined(_MIPS_SIM) && (_MIPS_SIM == _ABI64)) || \ |
| 48 | defined(JS_SIMULATOR_MIPS64) |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 49 | #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 Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 55 | @@ -94,7 +96,7 @@ class Registers { |
| 56 | ta1 = t5, |
| 57 | ta2 = t6, |
| 58 | ta3 = t7, |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 59 | -#elif defined(USES_N64_ABI) |
| 60 | +#elif defined(USES_N64_ABI) || defined(USES_N32_ABI) |
Brad Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 61 | a4 = r8, |
| 62 | a5 = r9, |
| 63 | a6 = r10, |
| 64 | diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py |
| 65 | index 1067b6a..e0f0405 100644 |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 66 | --- a/python/mozbuild/mozbuild/configure/constants.py |
| 67 | +++ b/python/mozbuild/mozbuild/configure/constants.py |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 68 | @@ -90,8 +90,8 @@ CPU_preprocessor_checks = OrderedDict(( |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 69 | ('hppa', '__hppa__'), |
| 70 | ('sparc64', '__sparc__ && __arch64__'), |
| 71 | ('sparc', '__sparc__'), |
| 72 | - ('mips64', '__mips64'), |
| 73 | ('mips32', '__mips__'), |
| 74 | + ('mips64', '__mips64'), |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 75 | ('sh4', '__sh__'), |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 76 | )) |
| 77 | |
Brad Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 78 | -- |
| 79 | 2.7.4 |
| 80 | |