Re: Bug#903483: mozjs52: FTBFS on m68k: not supported by build/moz.configure/init.configure
Control: tags -1 patch
Hi Simon!
On 07/10/2018 05:55 PM, John Paul Adrian Glaubitz wrote:
> Yes, I've seen that. I've most likely forgotten the hunk in question,
> I will provide an updated patch sonish, also one for riscv64.
Attaching an updated patch.
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer - glaubitz@debian.org
`. `' Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Date: Tue, 11 Jul 2018 12:58:00 +0200
Subject: Add support for m68k
Based on the patches sent to Firefox upstream.
Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1325771
Last-Update: 2018-07-11
---
js/src/gc/Heap.h | 2 +-
js/src/jit/AtomicOperations.h | 2 ++
js/src/jsfriendapi.h | 2 +-
mfbt/double-conversion/utils.h | 2 ++
mfbt/tests/TestPair.cpp | 9 +++++++--
mfbt/tests/TestPoisonArea.cpp | 3 +++
python/mozbuild/mozbuild/configure/constants.py | 2 ++
.../mozbuild/mozbuild/test/configure/test_toolchain_configure.py | 2 ++
8 files changed, 20 insertions(+), 4 deletions(-)
Index: mozjs52-52.3.1/js/src/gc/Heap.h
===================================================================
--- mozjs52-52.3.1.orig/js/src/gc/Heap.h
+++ mozjs52-52.3.1/js/src/gc/Heap.h
@@ -282,7 +282,7 @@ struct Cell
protected:
inline uintptr_t address() const;
inline Chunk* chunk() const;
-} JS_HAZ_GC_THING;
+} JS_HAZ_GC_THING __attribute__ ((aligned(4)));
// A GC TenuredCell gets behaviors that are valid for things in the Tenured
// heap, such as access to the arena and mark bits.
Index: mozjs52-52.3.1/js/src/jit/AtomicOperations.h
===================================================================
--- mozjs52-52.3.1.orig/js/src/jit/AtomicOperations.h
+++ mozjs52-52.3.1/js/src/jit/AtomicOperations.h
@@ -326,6 +326,8 @@ AtomicOperations::isLockfree(int32_t siz
# include "jit/arm64/AtomicOperations-arm64.h"
#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
# include "jit/mips-shared/AtomicOperations-mips-shared.h"
+#elif defined(__m68k__)
+# include "jit/none/AtomicOperations-ppc.h"
#elif defined(__ppc__) || defined(__PPC__)
# include "jit/none/AtomicOperations-ppc.h"
#elif defined(__sh__)
Index: mozjs52-52.3.1/js/src/jsfriendapi.h
===================================================================
--- mozjs52-52.3.1.orig/js/src/jsfriendapi.h
+++ mozjs52-52.3.1/js/src/jsfriendapi.h
@@ -571,7 +571,7 @@ public:
uint32_t slotInfo;
static const uint32_t FIXED_SLOTS_SHIFT = 27;
-};
+} __attribute__ ((aligned(4)));
/**
* This layout is shared by all native objects. For non-native objects, the
Index: mozjs52-52.3.1/mfbt/double-conversion/utils.h
===================================================================
--- mozjs52-52.3.1.orig/mfbt/double-conversion/utils.h
+++ mozjs52-52.3.1/mfbt/double-conversion/utils.h
@@ -69,6 +69,8 @@
#else
#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
#endif // _WIN32
+#elif defined(__m68k__)
+#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
#else
#error Target architecture was not detected as supported by Double-Conversion.
#endif
Index: mozjs52-52.3.1/mfbt/tests/TestPair.cpp
===================================================================
--- mozjs52-52.3.1.orig/mfbt/tests/TestPair.cpp
+++ mozjs52-52.3.1/mfbt/tests/TestPair.cpp
@@ -29,14 +29,19 @@ using mozilla::Pair;
static_assert(sizeof(name##_2) == (size), \
"Pair<" #T2 ", " #T1 "> has an unexpected size");
+static constexpr size_t sizemax(size_t a, size_t b)
+{
+ return (a > b) ? a : b;
+}
+
INSTANTIATE(int, int, prim1, 2 * sizeof(int));
-INSTANTIATE(int, long, prim2, 2 * sizeof(long));
+INSTANTIATE(int, long, prim2, sizeof(long) + sizemax(sizeof(int), alignof(long)));
struct EmptyClass { explicit EmptyClass(int) {} };
struct NonEmpty { char mC; explicit NonEmpty(int) {} };
INSTANTIATE(int, EmptyClass, both1, sizeof(int));
-INSTANTIATE(int, NonEmpty, both2, 2 * sizeof(int));
+INSTANTIATE(int, NonEmpty, both2, sizeof(int) + alignof(int));
INSTANTIATE(EmptyClass, NonEmpty, both3, 1);
struct A { char dummy; explicit A(int) {} };
Index: mozjs52-52.3.1/mfbt/tests/TestPoisonArea.cpp
===================================================================
--- mozjs52-52.3.1.orig/mfbt/tests/TestPoisonArea.cpp
+++ mozjs52-52.3.1/mfbt/tests/TestPoisonArea.cpp
@@ -133,6 +133,9 @@
#elif defined _ARCH_PPC || defined _ARCH_PWR || defined _ARCH_PWR2
#define RETURN_INSTR 0x4E800020 /* blr */
+#elif defined __m68k__
+#define RETURN_INSTR 0x4E754E75 /* rts; rts */
+
#elif defined __sparc || defined __sparcv9
#define RETURN_INSTR 0x81c3e008 /* retl */
Index: mozjs52-52.3.1/python/mozbuild/mozbuild/configure/constants.py
===================================================================
--- mozjs52-52.3.1.orig/python/mozbuild/mozbuild/configure/constants.py
+++ mozjs52-52.3.1/python/mozbuild/mozbuild/configure/constants.py
@@ -44,6 +44,7 @@ CPU_bitness = {
'arm': 32,
'hppa': 32,
'ia64': 64,
+ 'm68k': 32,
'mips32': 32,
'mips64': 64,
'ppc': 32,
@@ -87,6 +88,7 @@ CPU_preprocessor_checks = OrderedDict((
('mips64', '__mips64'),
('mips32', '__mips__'),
('sh4', '__sh__'),
+ ('m68k', '__m68k__'),
))
assert sorted(CPU_preprocessor_checks.keys()) == sorted(CPU.POSSIBLE_VALUES)
Index: mozjs52-52.3.1/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
===================================================================
--- mozjs52-52.3.1.orig/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+++ mozjs52-52.3.1/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
@@ -1039,6 +1039,8 @@ class LinuxCrossCompileToolchainTest(Bas
},
'sh4-unknown-linux-gnu': little_endian + {
'__sh__': 1,
+ 'm68k-unknown-linux-gnu': big_endian + {
+ '__m68k__': 1,
},
}
Index: mozjs52-52.3.1/build/moz.configure/init.configure
===================================================================
--- mozjs52-52.3.1.orig/build/moz.configure/init.configure
+++ mozjs52-52.3.1/build/moz.configure/init.configure
@@ -383,6 +383,9 @@ def split_triplet(triplet):
elif cpu == 'sh4':
canonical_cpu = 'sh4'
endianness = 'little'
+ elif cpu == 'm68k':
+ canonical_cpu = 'm68k'
+ endianness = 'big'
else:
die('Unknown CPU type: %s' % cpu)
Reply to: