1 |
commit: ba4514f5b434a0a974c6d5ad759f4f6bde11eaaf |
2 |
Author: WANG Xuerui <xen0n <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed May 25 14:32:30 2022 +0000 |
4 |
Commit: WANG Xuerui <xen0n <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 26 00:55:36 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba4514f5 |
7 |
|
8 |
dev-lang/spidermonkey: fix build on loong for 68.12.0-r1 |
9 |
|
10 |
Patch applied here has been running on real loong hardware since late |
11 |
2021, simple and no problems so far. |
12 |
|
13 |
See: https://github.com/gentoo/gentoo/pull/25632 |
14 |
Acked-by: Joonas Niilola <juippis <AT> gentoo.org> |
15 |
Signed-off-by: WANG Xuerui <xen0n <AT> gentoo.org> |
16 |
|
17 |
.../files/spidermonkey-68.0-loong-support.patch | 103 +++++++++++++++++++++ |
18 |
.../spidermonkey/spidermonkey-68.12.0-r1.ebuild | 1 + |
19 |
2 files changed, 104 insertions(+) |
20 |
|
21 |
diff --git a/dev-lang/spidermonkey/files/spidermonkey-68.0-loong-support.patch b/dev-lang/spidermonkey/files/spidermonkey-68.0-loong-support.patch |
22 |
new file mode 100644 |
23 |
index 000000000000..f7010d5ebf32 |
24 |
--- /dev/null |
25 |
+++ b/dev-lang/spidermonkey/files/spidermonkey-68.0-loong-support.patch |
26 |
@@ -0,0 +1,103 @@ |
27 |
+https://raw.githubusercontent.com/xen0n/loongson-overlay/00901fd4c599ec320c7852cbd30b40d3f6aa8971/dev-lang/spidermonkey/files/spidermonkey-68.0-add-loongarch64-support.patch |
28 |
+ |
29 |
+--- a/build/moz.configure/init.configure |
30 |
++++ b/build/moz.configure/init.configure |
31 |
+@@ -734,6 +734,9 @@ def split_triplet(triplet, allow_unknown |
32 |
+ elif cpu == 'sh4': |
33 |
+ canonical_cpu = 'sh4' |
34 |
+ endianness = 'little' |
35 |
++ elif cpu == 'loongarch64': |
36 |
++ canonical_cpu = 'loongarch64' |
37 |
++ endianness = 'little' |
38 |
+ elif allow_unknown: |
39 |
+ canonical_cpu = cpu |
40 |
+ endianness = 'unknown' |
41 |
+--- a/js/src/jit/AtomicOperations.h |
42 |
++++ b/js/src/jit/AtomicOperations.h |
43 |
+@@ -382,6 +382,9 @@ inline bool AtomicOperations::isLockfree |
44 |
+ # else |
45 |
+ # include "jit/shared/AtomicOperations-feeling-lucky.h" |
46 |
+ # endif |
47 |
++#elif defined(__loongarch64) |
48 |
++// This is only here to avoid merge conflict with spidermonkey-68.0-add-riscv-support.patch. |
49 |
++# include "jit/shared/AtomicOperations-feeling-lucky.h" |
50 |
+ #elif defined(__mips__) |
51 |
+ # if defined(__clang__) || defined(__GNUC__) |
52 |
+ # include "jit/mips-shared/AtomicOperations-mips-shared.h" |
53 |
+--- a/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h |
54 |
++++ b/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h |
55 |
+@@ -57,6 +57,11 @@ |
56 |
+ # define HAS_64BIT_LOCKFREE |
57 |
+ #endif |
58 |
+ |
59 |
++#ifdef __loongarch64 |
60 |
++# define HAS_64BIT_ATOMICS |
61 |
++# define HAS_64BIT_LOCKFREE |
62 |
++#endif |
63 |
++ |
64 |
+ #if defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || \ |
65 |
+ defined(__PPC64LE__) |
66 |
+ # define HAS_64BIT_ATOMICS |
67 |
+--- a/mfbt/tests/TestPoisonArea.cpp |
68 |
++++ b/mfbt/tests/TestPoisonArea.cpp |
69 |
+@@ -127,6 +127,9 @@ |
70 |
+ #elif defined __arm__ || defined _M_ARM |
71 |
+ # define RETURN_INSTR 0xE12FFF1E /* bx lr */ |
72 |
+ |
73 |
++#elif defined __loongarch__ |
74 |
++# define RETURN_INSTR 0x4c000020 /* jirl zero, ra, 0 */ |
75 |
++ |
76 |
+ // PPC has its own style of CPU-id #defines. There is no Windows for |
77 |
+ // PPC as far as I know, so no _M_ variant. |
78 |
+ #elif defined _ARCH_PPC || defined _ARCH_PWR || defined _ARCH_PWR2 |
79 |
+--- a/python/mozbuild/mozbuild/configure/constants.py |
80 |
++++ b/python/mozbuild/mozbuild/configure/constants.py |
81 |
+@@ -46,6 +46,7 @@ CPU_bitness = { |
82 |
+ 'arm': 32, |
83 |
+ 'hppa': 32, |
84 |
+ 'ia64': 64, |
85 |
++ 'loongarch64': 64, |
86 |
+ 'mips32': 32, |
87 |
+ 'mips64': 64, |
88 |
+ 'ppc': 32, |
89 |
+@@ -78,6 +79,7 @@ CPU_preprocessor_checks = OrderedDict(( |
90 |
+ ('arm', '__arm__ || _M_ARM'), |
91 |
+ ('aarch64', '__aarch64__ || _M_ARM64'), |
92 |
+ ('ia64', '__ia64__'), |
93 |
++ ('loongarch64', '__loongarch64'), |
94 |
+ ('s390x', '__s390x__'), |
95 |
+ ('s390', '__s390__'), |
96 |
+ ('ppc64', '__powerpc64__'), |
97 |
+--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py |
98 |
++++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py |
99 |
+@@ -1068,6 +1068,10 @@ class LinuxCrossCompileToolchainTest(Bas |
100 |
+ 'ia64-unknown-linux-gnu': little_endian + { |
101 |
+ '__ia64__': 1, |
102 |
+ }, |
103 |
++ 'loongarch64-unknown-linux-gnu': little_endian + { |
104 |
++ '__loongarch__': 1, |
105 |
++ '__loongarch64': 1, |
106 |
++ }, |
107 |
+ 's390x-unknown-linux-gnu': big_endian + { |
108 |
+ '__s390x__': 1, |
109 |
+ '__s390__': 1, |
110 |
+--- a/intl/icu/source/i18n/double-conversion-utils.h |
111 |
++++ b/intl/icu/source/i18n/double-conversion-utils.h |
112 |
+@@ -117,6 +117,7 @@ int main(int argc, char** argv) { |
113 |
+ #if defined(_M_X64) || defined(__x86_64__) || \ |
114 |
+ defined(__ARMEL__) || defined(__avr32__) || defined(_M_ARM) || defined(_M_ARM64) || \ |
115 |
+ defined(__hppa__) || defined(__ia64__) || \ |
116 |
++ defined(__loongarch__) || \ |
117 |
+ defined(__mips__) || \ |
118 |
+ defined(__nios2__) || defined(__ghs) || \ |
119 |
+ defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \ |
120 |
+--- a/mfbt/double-conversion/double-conversion/utils.h |
121 |
++++ b/mfbt/double-conversion/double-conversion/utils.h |
122 |
+@@ -117,6 +117,7 @@ int main(int argc, char** argv) { |
123 |
+ #if defined(_M_X64) || defined(__x86_64__) || \ |
124 |
+ defined(__ARMEL__) || defined(__avr32__) || defined(_M_ARM) || defined(_M_ARM64) || \ |
125 |
+ defined(__hppa__) || defined(__ia64__) || \ |
126 |
++ defined(__loongarch__) || \ |
127 |
+ defined(__mips__) || \ |
128 |
+ defined(__nios2__) || defined(__ghs) || \ |
129 |
+ defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \ |
130 |
|
131 |
diff --git a/dev-lang/spidermonkey/spidermonkey-68.12.0-r1.ebuild b/dev-lang/spidermonkey/spidermonkey-68.12.0-r1.ebuild |
132 |
index a836814ad075..46cc4b1b3634 100644 |
133 |
--- a/dev-lang/spidermonkey/spidermonkey-68.12.0-r1.ebuild |
134 |
+++ b/dev-lang/spidermonkey/spidermonkey-68.12.0-r1.ebuild |
135 |
@@ -101,6 +101,7 @@ src_prepare() { |
136 |
eapply "${WORKDIR}"/firefox |
137 |
eapply "${WORKDIR}"/spidermonkey-patches |
138 |
eapply "${FILESDIR}"/spidermonkey-68.0-add-riscv-support.patch |
139 |
+ eapply "${FILESDIR}"/spidermonkey-68.0-loong-support.patch |
140 |
|
141 |
default |