From 7bae23b3a63e37d08ab3ab21b23b44e85560cb0c Mon Sep 17 00:00:00 2001
From: Tobias Hunger <tobias.hunger@nokia.com>
Date: Wed, 6 Apr 2011 10:04:57 +0200
Subject: [PATCH] Abi: Mips support

* Detect Mips in binaries
* Parse mips gcc string properly
* Add unit tests for both

Thanks go to fralik from devnet for providing the test data!
---
 src/plugins/projectexplorer/abi.cpp          | 4 ++++
 src/plugins/projectexplorer/gcctoolchain.cpp | 9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/plugins/projectexplorer/abi.cpp b/src/plugins/projectexplorer/abi.cpp
index 3dcbebe3dfe..b49cf8f9ea5 100644
--- a/src/plugins/projectexplorer/abi.cpp
+++ b/src/plugins/projectexplorer/abi.cpp
@@ -654,6 +654,10 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary_data()
     QTest::newRow("dynamic QtCore: arm linux 32bit")
             << QString::fromLatin1("%1/abi/dynamic/arm-linux.so").arg(prefix)
             << (QStringList() << QString::fromLatin1("arm-linux-generic-elf-32bit"));
+    QTest::newRow("dynamic QtCore: mips linux 32bit")
+            << QString::fromLatin1("%1/abi/dynamic/mips-linux.so").arg(prefix)
+            << (QStringList() << QString::fromLatin1("mips-linux-generic-elf-32bit"));
+
 }
 
 void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary()
diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp
index acdbd16fbd0..9efa4a849fb 100644
--- a/src/plugins/projectexplorer/gcctoolchain.cpp
+++ b/src/plugins/projectexplorer/gcctoolchain.cpp
@@ -182,7 +182,8 @@ static QList<ProjectExplorer::Abi> guessGccAbi(const QString &m)
 
     foreach (const QString &p, parts) {
         if (p == QLatin1String("unknown") || p == QLatin1String("pc") || p == QLatin1String("none")
-            || p == QLatin1String("gnu") || p == QLatin1String("86_64")) {
+            || p == QLatin1String("gnu") || p == QLatin1String("uclibc")
+            || p == QLatin1String("86_64")) {
             continue;
         } else if (p == QLatin1String("i386") || p == QLatin1String("i486") || p == QLatin1String("i586")
                    || p == QLatin1String("i686") || p == QLatin1String("x86")) {
@@ -191,6 +192,9 @@ static QList<ProjectExplorer::Abi> guessGccAbi(const QString &m)
         } else if (p == QLatin1String("arm")) {
             arch = ProjectExplorer::Abi::ArmArchitecture;
             width = 32;
+        } else if (p == QLatin1String("mipsel")) {
+            arch = ProjectExplorer::Abi::MipsArcitecture;
+            width = 32;
         } else if (p == QLatin1String("x86_64")) {
             arch = ProjectExplorer::Abi::X86Architecture;
             width = 64;
@@ -838,6 +842,9 @@ void ProjectExplorerPlugin::testGccAbiGuessing_data()
             << QString::fromLatin1("x86_64-linux-gnu")
             << (QStringList() << QLatin1String("x86-linux-generic-elf-64bit")
                               << QLatin1String("x86-linux-generic-elf-32bit"));
+    QTest::newRow("Linux 4")
+            << QString::fromLatin1("mipsel-linux-uclibc")
+            << (QStringList() << QLatin1String("mips-linux-generic-elf-32bit"));
     QTest::newRow("Mingw 1")
             << QString::fromLatin1("i686-w64-mingw32")
             << (QStringList() << QLatin1String("x86-windows-msys-pe-64bit")
-- 
GitLab