[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#849751: Acknowledgement (firefox: Fix broken m68k build support)



Control: tags -1 patch
Control: forwarded https://bugzilla.mozilla.org/show_bug.cgi?id=1325771

Whoops, forgot to attach the actual 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
Description: Fix build on m68k
Author: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Forwarded: https://bugzilla.mozilla.org/show_bug.cgi?id=1325771
Last-Update: 2016-12-30

--- firefox-50.1.0.orig/build/moz.configure/init.configure
+++ firefox-50.1.0/build/moz.configure/init.configure
@@ -412,6 +412,9 @@ def split_triplet(triplet):
     elif cpu.startswith('aarch64'):
         canonical_cpu = 'aarch64'
         endianness = 'little'
+    elif cpu in ('m68k'):
+        canonical_cpu = 'm68k'
+        endianness = 'big'
     else:
         die('Unknown CPU type: %s' % cpu)
 
--- firefox-50.1.0.orig/ipc/chromium/src/build/build_config.h
+++ firefox-50.1.0/ipc/chromium/src/build/build_config.h
@@ -83,6 +83,9 @@
 #elif defined(__ppc__) || defined(__powerpc__)
 #define ARCH_CPU_PPC 1
 #define ARCH_CPU_32_BITS 1
+#elif defined(__m68k__)
+#define ARCH_CPU_M68K 1
+#define ARCH_CPU_32_BITS 1
 #elif defined(__sparc64__)
 #define ARCH_CPU_SPARC 1
 #define ARCH_CPU_64_BITS 1
--- firefox-50.1.0.orig/js/src/jit/IonCode.h
+++ firefox-50.1.0/js/src/jit/IonCode.h
@@ -161,7 +161,11 @@ class JitCode : public gc::TenuredCell
 
   public:
     static const JS::TraceKind TraceKind = JS::TraceKind::JitCode;
+#if !defined(__m68k__)
 };
+#else
+} __attribute__ ((aligned(4)));     /* enforce 32-bit alignment on m68k */
+#endif
 
 class SnapshotWriter;
 class RecoverWriter;
--- firefox-50.1.0.orig/js/src/jsfriendapi.h
+++ firefox-50.1.0/js/src/jsfriendapi.h
@@ -562,7 +562,11 @@ public:
     uint32_t          slotInfo;
 
     static const uint32_t FIXED_SLOTS_SHIFT = 27;
+#if !defined(__m68k__)
 };
+#else
+} __attribute__ ((aligned(4)));     /* enforce 32-bit alignment on m68k */
+#endif
 
 /**
  * This layout is shared by all native objects. For non-native objects, the
--- firefox-50.1.0.orig/js/src/vm/Shape.h
+++ firefox-50.1.0/js/src/vm/Shape.h
@@ -985,7 +985,11 @@ class Shape : public gc::TenuredCell
         JS_STATIC_ASSERT(offsetof(Shape, slotInfo) == offsetof(js::shadow::Shape, slotInfo));
         JS_STATIC_ASSERT(FIXED_SLOTS_SHIFT == js::shadow::Shape::FIXED_SLOTS_SHIFT);
     }
+#if !defined(__m68k__)
 };
+#else
+} __attribute__ ((aligned(4)));     /* enforce 32-bit alignment on m68k */
+#endif
 
 /* Fat Shape used for accessor properties. */
 class AccessorShape : public Shape
@@ -1007,7 +1011,11 @@ class AccessorShape : public Shape
   public:
     /* Get a shape identical to this one, without parent/kids information. */
     inline AccessorShape(const StackShape& other, uint32_t nfixed);
+#if !defined(__m68k__)
 };
+#else
+} __attribute__ ((aligned(4)));     /* enforce 32-bit alignment on m68k */
+#endif
 
 inline
 StackBaseShape::StackBaseShape(Shape* shape)
--- firefox-50.1.0.orig/layout/style/nsCSSValue.h
+++ firefox-50.1.0/layout/style/nsCSSValue.h
@@ -850,7 +850,11 @@ protected:
     nsCSSValueFloatColor* MOZ_OWNING_REF mFloatColor;
     mozilla::css::FontFamilyListRefCnt* MOZ_OWNING_REF mFontFamilyList;
   } mValue;
+#if !defined(__m68k__)
 };
+#else
+} __attribute__ ((aligned(4)));     /* enforce 32-bit alignment on m68k */
+#endif
 
 struct nsCSSValue::Array final {
 
--- firefox-50.1.0.orig/mfbt/double-conversion/utils.h
+++ firefox-50.1.0/mfbt/double-conversion/utils.h
@@ -62,6 +62,8 @@
     defined(_MIPS_ARCH_MIPS32R2) || \
     defined(__AARCH64EL__) || defined(__aarch64__)
 #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
+#elif defined(__mc68000__)
+#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
 #elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
 #if defined(_WIN32)
 // Windows uses a 64bit wide floating point stack.
--- firefox-50.1.0.orig/mfbt/tests/TestPair.cpp
+++ firefox-50.1.0/mfbt/tests/TestPair.cpp
@@ -30,13 +30,17 @@ using mozilla::Pair;
                 "Pair<" #T2 ", " #T1 "> has an unexpected size");
 
 INSTANTIATE(int, int, prim1, 2 * sizeof(int));
+#if !defined(__m68k__)
 INSTANTIATE(int, long, prim2, 2 * sizeof(long));
+#else
+INSTANTIATE(int, long, prim2, sizeof(int) + sizeof(long));
+#endif
 
 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) {} };
--- firefox-50.1.0.orig/python/mozbuild/mozbuild/configure/constants.py
+++ firefox-50.1.0/python/mozbuild/mozbuild/configure/constants.py
@@ -44,6 +44,7 @@ CPU = EnumString.subclass(
     'arm',
     'hppa',
     'ia64',
+    'm68k',
     'mips32',
     'mips64',
     'ppc',
@@ -78,6 +79,7 @@ CPU_preprocessor_checks = OrderedDict((
     ('sparc', '__sparc__'),
     ('mips64', '__mips64'),
     ('mips32', '__mips__'),
+    ('m68k', '__m68k__'),
 ))
 
 assert sorted(CPU_preprocessor_checks.keys()) == sorted(CPU.POSSIBLE_VALUES)
--- firefox-50.1.0.orig/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+++ firefox-50.1.0/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
@@ -997,6 +997,9 @@ class LinuxCrossCompileToolchainTest(Bas
         'mips-unknown-linux-gnu': big_endian + {
             '__mips__': 1,
         },
+        'm68k-unknown-linux-gnu': big_endian + {
+            '__m68k__': 1,
+        },
     }
 
     PLATFORMS['powerpc64le-unknown-linux-gnu'] = \
--- firefox-50.1.0.orig/xpcom/reflect/xptcall/md/unix/xptcinvoke_linux_m68k.cpp
+++ firefox-50.1.0/xpcom/reflect/xptcall/md/unix/xptcinvoke_linux_m68k.cpp
@@ -100,7 +100,8 @@ EXPORT_XPCOM_API(nsresult)
 NS_InvokeByIndex(nsISupports* that, uint32_t methodIndex,
                    uint32_t paramCount, nsXPTCVariant* params)
 {
-    uint32_t result, n;
+    nsresult result;
+    uint32_t n;
 
     n = invoke_count_words(paramCount, params) * 4;
 
--- firefox-50.1.0.orig/xpcom/reflect/xptcall/md/unix/xptcstubs_linux_m68k.cpp
+++ firefox-50.1.0/xpcom/reflect/xptcall/md/unix/xptcstubs_linux_m68k.cpp
@@ -63,7 +63,7 @@ extern "C" {
             case nsXPTType::T_U64    : dp->val.u64 = *((uint64_t*)ap); ap++; break;
             case nsXPTType::T_FLOAT  : dp->val.f   = *((float*)   ap);       break;
             case nsXPTType::T_DOUBLE : dp->val.d   = *((double*)  ap); ap++; break;
-            case nsXPTType::T_BOOL   : dp->val.b   = *((uint32_t* ap);       break;
+            case nsXPTType::T_BOOL   : dp->val.b   = *((uint32_t*)ap);       break;
             case nsXPTType::T_CHAR   : dp->val.c   = *(((char*)   ap) + 3);  break;
             case nsXPTType::T_WCHAR  : dp->val.wc  = *((wchar_t*) ap);       break;
             default:
--- firefox-50.1.0.orig/media/webrtc/trunk/build/build_config.h
+++ firefox-50.1.0/media/webrtc/trunk/build/build_config.h
@@ -129,6 +129,11 @@
 #define ARCH_CPU_PPC 1
 #define ARCH_CPU_32_BITS 1
 #define ARCH_CPU_BIG_ENDIAN 1
+#elif defined(__m68k__)
+#define ARCH_CPU_M68K_FAMILY 1
+#define ARCH_CPU_M68K 1
+#define ARCH_CPU_32_BITS 1
+#define ARCH_CPU_BIG_ENDIAN 1
 #elif defined(__sparc64__)
 #define ARCH_CPU_SPARC_FAMILY 1
 #define ARCH_CPU_SPARC 1
--- firefox-50.1.0.orig/js/src/jit/AtomicOperations.h
+++ firefox-50.1.0/js/src/jit/AtomicOperations.h
@@ -324,6 +324,8 @@ AtomicOperations::isLockfree(int32_t siz
 # include "jit/arm/AtomicOperations-arm.h"
 #elif defined(JS_CODEGEN_ARM64)
 # include "jit/arm64/AtomicOperations-arm64.h"
+#elif defined(__m68k__)
+# include "jit/none/AtomicOperations-ppc.h"
 #elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
 # include "jit/mips-shared/AtomicOperations-mips-shared.h"
 #elif defined(__ppc__) || defined(__PPC__)
--- firefox-50.1.0.orig/mfbt/tests/TestPoisonArea.cpp
+++ firefox-50.1.0/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 */
 

Reply to: