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

Bug#729187: qtbase-opensource-src: FTBFS on mips/mipsel



Package: qtbase-opensource-src
Version: 5.1.1+dfsg-5
Severity: important
Tags: patch upstream
Justification: fails to build from source

qtbase-opensource-src fails to build from source because it assumes a
MIPS32 ISA, while Debian is still using a MIPS2 ISA, mostly for the 
compatibility with Loongson 2 machines.

Qt5 is using the sync opcode with an immediate argument, which is
something introduced in the MIPS32 instruction set. However some of the
older CPUs interprets this opcode without the immediate argument (which
is a stronger ordering than with the argument), and for the others the
kernel emulates it.

It is therefore fine to use this opcode in the Qt5 build. However it's
not possible to build Qt5 with -march=mips32, as it will enable other
instructions that are not supported by older CPUs and not emulated by
the kernel.

The patch below does exactly that. With it I was able to fully build Qt5
on a MIPS system. Would it be possible to include it in the next upload?
Thanks in advance.

--- qtbase-opensource-src-5.1.1+dfsg.orig/src/corelib/arch/qatomic_mips.h
+++ qtbase-opensource-src-5.1.1+dfsg/src/corelib/arch/qatomic_mips.h
@@ -119,13 +119,19 @@ template <typename T> struct QAtomicOps
 template <int size> template <typename T> inline
 void QBasicAtomicOps<size>::acquireMemoryFence(const T &) Q_DECL_NOTHROW
 {
-    asm volatile ("sync 0x11" ::: "memory");
+    asm volatile (".set push\n"
+                  ".set mips32\n"
+                  "sync 0x11\n"
+                  ".set pop\n" ::: "memory");
 }
 
 template <int size> template <typename T> inline
 void QBasicAtomicOps<size>::releaseMemoryFence(const T &) Q_DECL_NOTHROW
 {
-    asm volatile ("sync 0x12" ::: "memory");
+    asm volatile (".set push\n"
+                  ".set mips32\n"
+                  "sync 0x12\n"
+                  ".set pop\n" ::: "memory");
 }
 
 template <int size> template <typename T> inline


-- System Information:
Debian Release: jessie/sid
  APT prefers unreleased
  APT policy: (500, 'unstable')
Architecture: mips (mips64)

Kernel: Linux 3.2.0-4-5kc-malta
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash


Reply to: