Source: mozjs52 Version: 52.3.1-7 Severity: normal Tags: patch User: debian-68k@lists.debian.org Usertags: m68k
Hi! The attached patch adds support for m68k. It is based on a number of patches that I submitted to Firefox upstream but that unfortunately were never merged due to some disagreement on how to resolve the alignment issues in a compiler-agnostic way. Since Debian uses either gcc or clang and not Microsoft's C/C++ compiler, the patch shouldn't cause any issues since the "__attribute__ ((aligned(4)))" is understood by both. Note: This patch needs to be added on top of the patch for sh4 support in #880692 [2]. Additional patches for the remaining architectures will follow shortly. Thanks for consideration! Adrian > [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1325771 > [2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=880692 -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer - glaub...@debian.org `. `' Freie Universitaet Berlin - glaub...@physik.fu-berlin.de `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Description: Add support for m68k Based on the patches sent to Firefox upstream. See: https://bugzilla.mozilla.org/show_bug.cgi?id=1325771 . Author: John Paul Adrian Glaubitz <glaub...@physik.fu-berlin.de> Last-Update: 2017-11-03 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/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/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) {} };