ProjectExplorer: Fix abi detection of static Qt builds

Qt 6.2.4 static builds, both with MSVC 2019 and MinGW 11.2.0 are
having the coff headers at the 66 offset instead of 60.

I determined the value empirically, I haven't managed to find
a reference about the magic 60 or 66 values.

Fixes: QTCREATORBUG-27735
Change-Id: Ie2e9f8d6456e765acffce4991955067964b8c0fc
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Cristian Adam
2022-06-23 20:44:24 +02:00
parent c95cf1c0cf
commit a26235dab9

View File

@@ -1197,8 +1197,14 @@ Abis Abi::abisOfBinary(const Utils::FilePath &path)
offset += fileLength.toInt() + 60 /* header */;
tmp.append(abiOf(data.mid(toSkip)));
if (tmp.isEmpty() && fileName == "/0 ")
if (tmp.isEmpty() && fileName == "/0 ") {
tmp = parseCoffHeader(data.mid(toSkip, 20)); // This might be windws...
if (tmp.isEmpty()) {
// Qt 6.2 static builds have the coff headers for both MSVC and MinGW at offset 66
toSkip = 66 + fileNameOffset;
tmp = parseCoffHeader(data.mid(toSkip, 20));
}
}
if (!tmp.isEmpty() && tmp.at(0).binaryFormat() != MachOFormat)
break;