0006-Add-initial-support-of-ARC-architecture.patch 7.47 KB
From a695eec2ef21240bbc6cd8cd1bdbab76f8da8dfd Mon Sep 17 00:00:00 2001
From: Vineet Gupta <vgupta@synopsys.com>
Date: Wed, 20 May 2015 10:37:25 +0300
Subject: [PATCH 1/2] Add initial support of ARC architecture

DesignWare ARC 700 and ARC HS38 are families of 32-bit CPUs
developed by Synopsys, Inc.

This change implements following:
 [1] Defines ARC as one embedded targets
 [2] Defines default tools prefixed for ARC like
     arc-linux-g++ etc
 [3] Defines "inotify" syscall numbers for ARC
     (note ARC fully compliant to Linux UAPI headers)
 [4] Disables 16-bit aligned data access

For now we're using generic atomic ops even though it may
introduce performance panalty.

Change-Id: I91e879ac55c2f3643a544f97cd59671a81ccc3c2

This patch was submited in upstream Qt4 and if it ever gets accepted,
it should be removed from Buildroot.

https://codereview.qt-project.org/#/c/112667
---
 configure                                     |  6 ++++
 mkspecs/qws/linux-arc-g++/qmake.conf          | 21 ++++++++++++++
 mkspecs/qws/linux-arc-g++/qplatformdefs.h     | 42 +++++++++++++++++++++++++++
 src/corelib/arch/qatomic_arch.h               |  2 ++
 src/corelib/io/qfilesystemwatcher_inotify.cpp |  5 ++++
 src/gui/painting/qblendfunctions.cpp          |  4 +--
 6 files changed, 78 insertions(+), 2 deletions(-)
 create mode 100644 mkspecs/qws/linux-arc-g++/qmake.conf
 create mode 100644 mkspecs/qws/linux-arc-g++/qplatformdefs.h

diff --git a/configure b/configure
index 10ad7ca..c7ef074 100755
--- a/configure
+++ b/configure
@@ -2829,6 +2829,9 @@ if [ "$CFG_EMBEDDED" != "no" ]; then
                     *86_64)
                         CFG_EMBEDDED=x86_64
                         ;;
+                    *arc)
+                        CFG_EMBEDDED=arc
+                        ;;
                     *)
                         CFG_EMBEDDED=generic
                         ;;
@@ -3309,6 +3312,9 @@ if [ "$PLATFORM" != "$XPLATFORM" -a "$CFG_EMBEDDED" != "no" ]; then
     arm*)
         CFG_ARCH=arm
         ;;
+    arc)
+        CFG_ARCH=arc
+        ;;
     *)
         CFG_ARCH="$CFG_EMBEDDED"
         ;;
diff --git a/mkspecs/qws/linux-arc-g++/qmake.conf b/mkspecs/qws/linux-arc-g++/qmake.conf
new file mode 100644
index 0000000..a14587b
--- /dev/null
+++ b/mkspecs/qws/linux-arc-g++/qmake.conf
@@ -0,0 +1,21 @@
+#
+# qmake configuration for building with arc-linux-g++
+#
+
+include(../../common/linux.conf)
+include(../../common/gcc-base-unix.conf)
+include(../../common/g++-unix.conf)
+include(../../common/qws.conf)
+
+# modifications to g++.conf
+QMAKE_CC                = arc-linux-gcc
+QMAKE_CXX               = arc-linux-g++
+QMAKE_LINK              = arc-linux-g++
+QMAKE_LINK_SHLIB        = arc-linux-g++
+
+# modifications to linux.conf
+QMAKE_AR                = arc-linux-ar cqs
+QMAKE_OBJCOPY           = arc-linux-objcopy
+QMAKE_STRIP             = arc-linux-strip
+
+load(qt_config)
diff --git a/mkspecs/qws/linux-arc-g++/qplatformdefs.h b/mkspecs/qws/linux-arc-g++/qplatformdefs.h
new file mode 100644
index 0000000..a654aa7
--- /dev/null
+++ b/mkspecs/qws/linux-arc-g++/qplatformdefs.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the qmake spec of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../../linux-g++/qplatformdefs.h"
diff --git a/src/corelib/arch/qatomic_arch.h b/src/corelib/arch/qatomic_arch.h
index d154b7e..a48c42a 100644
--- a/src/corelib/arch/qatomic_arch.h
+++ b/src/corelib/arch/qatomic_arch.h
@@ -94,6 +94,8 @@ QT_BEGIN_HEADER
 #  include "QtCore/qatomic_sh4a.h"
 #elif defined(QT_ARCH_NACL)
 #  include "QtCore/qatomic_generic.h"
+#elif defined(QT_ARCH_ARC)
+#  include "QtCore/qatomic_generic.h"
 #else
 #  error "Qt has not been ported to this architecture"
 #endif
diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp
index 8bca422..e3e2565 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify.cpp
+++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp
@@ -143,6 +143,11 @@
 # define __NR_inotify_add_watch 27
 # define __NR_inotify_rm_watch  28
 // no inotify_init for aarch64
+#elif defined (__arc__)
+# define __NR_inotify_init      1043
+# define __NR_inotify_add_watch 27
+# define __NR_inotify_rm_watch  28
+# define __NR_inotify_init1     26
 #else
 # error "This architecture is not supported. Please talk to qt-bugs@trolltech.com"
 #endif
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp
index de8790a..cc2f5b6 100644
--- a/src/gui/painting/qblendfunctions.cpp
+++ b/src/gui/painting/qblendfunctions.cpp
@@ -309,9 +309,9 @@ template <typename T> void qt_blend_argb24_on_rgb16(uchar *destPixels, int dbpl,
         const uchar *src = srcPixels + y * sbpl;
         const uchar *srcEnd = src + srcOffset;
         while (src < srcEnd) {
-#if defined(QT_ARCH_ARMV5) || defined(QT_ARCH_POWERPC) || defined(QT_ARCH_SH) || defined(QT_ARCH_AVR32) || (defined(QT_ARCH_WINDOWSCE) && !defined(_X86_)) || (defined(QT_ARCH_SPARC) && defined(Q_CC_GNU)) || (defined(QT_ARCH_INTEGRITY) && !defined(_X86_))
+#if defined(QT_ARCH_ARMV5) || defined(QT_ARCH_POWERPC) || defined(QT_ARCH_SH) || defined(QT_ARCH_AVR32) || (defined(QT_ARCH_WINDOWSCE) && !defined(_X86_)) || (defined(QT_ARCH_SPARC) && defined(Q_CC_GNU)) || (defined(QT_ARCH_INTEGRITY) && !defined(_X86_)) || defined(QT_ARCH_ARC)
             // non-16-bit aligned memory access is not possible on PowerPC,
-            // ARM <v6 (QT_ARCH_ARMV5) & SH & AVR32 & SPARC w/GCC
+            // ARM <v6 (QT_ARCH_ARMV5) & SH & AVR32 & SPARC w/GCC & ARC
             quint16 spix = (quint16(src[2])<<8) + src[1];
 #else
             quint16 spix = *(quint16 *) (src + 1);
-- 
2.1.0