From a26235dab98288cbcc13b6314ac2bff6ce9c604a Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Thu, 23 Jun 2022 20:44:24 +0200 Subject: [PATCH] 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: Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/abi.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/abi.cpp b/src/plugins/projectexplorer/abi.cpp index 2afbfa8be01..ea8e0fb77aa 100644 --- a/src/plugins/projectexplorer/abi.cpp +++ b/src/plugins/projectexplorer/abi.cpp @@ -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;