summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuhang Zhao <[email protected]>2023-04-16 13:19:48 +0800
committerYuhang Zhao <[email protected]>2023-04-26 02:21:08 +0000
commitebd27ff654a5973be404183d3dd517bd13ff06a0 (patch)
treec82c7a8c52c490362bd7a434fc276ed60fe02646
parent6e99922234270df91658dd07d20ececc829722a8 (diff)
windeployqt: improve debug detection
MSVC binaries can also be stripped and according to my experiments they still work normally. So we should not limit this check to MinGW only. Change-Id: I026d75a38b94f309ad695cf8f700ed3ac160dd87 Reviewed-by: Oliver Wolff <[email protected]> Reviewed-by: Timothée Keller <[email protected]>
-rw-r--r--src/tools/windeployqt/utils.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/tools/windeployqt/utils.cpp b/src/tools/windeployqt/utils.cpp
index ec68d6c3712..cf3356b0078 100644
--- a/src/tools/windeployqt/utils.cpp
+++ b/src/tools/windeployqt/utils.cpp
@@ -728,13 +728,10 @@ inline QStringList determineDependentLibs(const ImageNtHeader *nth, const void *
template <class ImageNtHeader>
inline bool determineDebug(const ImageNtHeader *nth, const void *fileMemory,
- bool isMinGW,
- QStringList *dependentLibrariesIn,
- QString *errorMessage)
+ QStringList *dependentLibrariesIn, QString *errorMessage)
{
- // Use logic that's used e.g. in objdump / pfd library
- if (isMinGW)
- return !(nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED);
+ if (nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED)
+ return false;
const QStringList dependentLibraries = dependentLibrariesIn != nullptr ?
*dependentLibrariesIn :
@@ -752,7 +749,6 @@ inline bool determineDebug(const ImageNtHeader *nth, const void *fileMemory,
template <class ImageNtHeader>
inline void determineDebugAndDependentLibs(const ImageNtHeader *nth, const void *fileMemory,
- bool isMinGW,
QStringList *dependentLibrariesIn,
bool *isDebugIn, QString *errorMessage)
{
@@ -760,7 +756,7 @@ inline void determineDebugAndDependentLibs(const ImageNtHeader *nth, const void
*dependentLibrariesIn = determineDependentLibs(nth, fileMemory, errorMessage);
if (isDebugIn)
- *isDebugIn = determineDebug(nth, fileMemory, isMinGW, dependentLibrariesIn, errorMessage);
+ *isDebugIn = determineDebug(nth, fileMemory, dependentLibrariesIn, errorMessage);
}
// Read a PE executable and determine dependent libraries, word size
@@ -814,10 +810,10 @@ bool readPeExecutable(const QString &peExecutableFileName, QString *errorMessage
*wordSizeIn = wordSize;
if (wordSize == 32) {
determineDebugAndDependentLibs(reinterpret_cast<const IMAGE_NT_HEADERS32 *>(ntHeaders),
- fileMemory, isMinGW, dependentLibrariesIn, isDebugIn, errorMessage);
+ fileMemory, dependentLibrariesIn, isDebugIn, errorMessage);
} else {
determineDebugAndDependentLibs(reinterpret_cast<const IMAGE_NT_HEADERS64 *>(ntHeaders),
- fileMemory, isMinGW, dependentLibrariesIn, isDebugIn, errorMessage);
+ fileMemory, dependentLibrariesIn, isDebugIn, errorMessage);
}
if (machineArchIn)