summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@nokia.com>2011-06-23 11:21:50 +0200
committerTobias Hunger <tobias.hunger@nokia.com>2011-06-23 11:25:32 +0200
commitf7be9fccf0c7e7f978db3747eaa97af0c4d0032f (patch)
treef69359fd922a17386acf8b13a8a7cb128d9e1994
parent386ce4f6ef054d112fa5c3eff4c6843077df3282 (diff)
downloadqt-creator-f7be9fccf0c7e7f978db3747eaa97af0c4d0032f.tar.gz
Abi: Fix detection of ELF files on big endian machines
Change-Id: I1301e463fc97fa9615398a2a120874c809975ae5 Reviewed-on: http://codereview.qt.nokia.com/647 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
-rw-r--r--src/plugins/projectexplorer/abi.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/projectexplorer/abi.cpp b/src/plugins/projectexplorer/abi.cpp
index 0697ce28c5..fd5c7a3d9f 100644
--- a/src/plugins/projectexplorer/abi.cpp
+++ b/src/plugins/projectexplorer/abi.cpp
@@ -34,6 +34,7 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
+#include <QtCore/QtEndian>
#include <QtCore/QFile>
#include <QtCore/QString>
#include <QtCore/QStringList>
@@ -134,7 +135,10 @@ static QList<Abi> abiOf(const QByteArray &data)
&& static_cast<unsigned char>(data.at(0)) == 0x7f && static_cast<unsigned char>(data.at(1)) == 'E'
&& static_cast<unsigned char>(data.at(2)) == 'L' && static_cast<unsigned char>(data.at(3)) == 'F') {
// ELF format:
+ bool isLsbEncoded = (static_cast<quint8>(data.at(5)) == 1);
quint16 machine = (data.at(19) << 8) + data.at(18);
+ if (!isLsbEncoded)
+ machine = qFromBigEndian(machine);
quint8 osAbi = static_cast<quint8>(data.at(7));
Abi::OS os = Abi::UnixOS;