forked from qt-creator/qt-creator
Fix ABI detection of static mingw libraries on windows
Task-number: QTCREATORBUG-4771
(cherry picked from commit fcf82b74b6)
This commit is contained in:
@@ -506,8 +506,6 @@ QList<Abi> Abi::abisOfBinary(const QString &path)
|
|||||||
if (!f.exists())
|
if (!f.exists())
|
||||||
return tmp;
|
return tmp;
|
||||||
|
|
||||||
bool windowsStatic = path.endsWith(QLatin1String(".lib"));
|
|
||||||
|
|
||||||
f.open(QFile::ReadOnly);
|
f.open(QFile::ReadOnly);
|
||||||
QByteArray data = f.read(1024);
|
QByteArray data = f.read(1024);
|
||||||
if (data.size() >= 67
|
if (data.size() >= 67
|
||||||
@@ -534,12 +532,11 @@ QList<Abi> Abi::abisOfBinary(const QString &path)
|
|||||||
|
|
||||||
int toSkip = 60 + fileNameOffset;
|
int toSkip = 60 + fileNameOffset;
|
||||||
offset += fileLength.toInt() + 60 /* header */;
|
offset += fileLength.toInt() + 60 /* header */;
|
||||||
if (windowsStatic) {
|
|
||||||
if (fileName == QLatin1String("/0 "))
|
tmp.append(abiOf(data.mid(toSkip)));
|
||||||
tmp = parseCoffHeader(data.mid(toSkip, 20));
|
if (tmp.isEmpty() && fileName == QLatin1String("/0 "))
|
||||||
} else {
|
tmp = parseCoffHeader(data.mid(toSkip, 20)); // This might be windws...
|
||||||
tmp.append(abiOf(data.mid(toSkip)));
|
|
||||||
}
|
|
||||||
if (!tmp.isEmpty()
|
if (!tmp.isEmpty()
|
||||||
&& tmp.at(0).binaryFormat() != Abi::MachOFormat)
|
&& tmp.at(0).binaryFormat() != Abi::MachOFormat)
|
||||||
break;
|
break;
|
||||||
@@ -606,6 +603,9 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary_data()
|
|||||||
QTest::newRow("static QtCore: win msvc2008 (debug)")
|
QTest::newRow("static QtCore: win msvc2008 (debug)")
|
||||||
<< QString::fromLatin1("%1/abi/static/win-msvc2008-debug.lib").arg(prefix)
|
<< QString::fromLatin1("%1/abi/static/win-msvc2008-debug.lib").arg(prefix)
|
||||||
<< (QStringList() << QString::fromLatin1("x86-windows-unknown-pe-32bit"));
|
<< (QStringList() << QString::fromLatin1("x86-windows-unknown-pe-32bit"));
|
||||||
|
QTest::newRow("static QtCore: win mingw")
|
||||||
|
<< QString::fromLatin1("%1/abi/static/win-mingw.a").arg(prefix)
|
||||||
|
<< (QStringList() << QString::fromLatin1("x86-windows-unknown-pe-32bit"));
|
||||||
QTest::newRow("static QtCore: mac (debug)")
|
QTest::newRow("static QtCore: mac (debug)")
|
||||||
<< QString::fromLatin1("%1/abi/static/mac-32bit-debug.a").arg(prefix)
|
<< QString::fromLatin1("%1/abi/static/mac-32bit-debug.a").arg(prefix)
|
||||||
<< (QStringList() << QString::fromLatin1("x86-macos-generic-mach_o-32bit"));
|
<< (QStringList() << QString::fromLatin1("x86-macos-generic-mach_o-32bit"));
|
||||||
|
|||||||
Reference in New Issue
Block a user