From 02510e11a9e4d881ad62eadb4c952ddceeabde71 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 2 Sep 2024 07:28:15 -0700 Subject: [PATCH] tst_QPluginLoader: use qCpuHasFeature instead of __builtin_cpu_supports Fixes a build problem on VxWorks because their runtime library isn't libgcc.a and is thus missing the symbols that the Clang emits into the test code when the intrinsic is used. This also better aligns the CPU check with what QtCore does. Drive-by add a comment explaining what this is and why Darwin is excluded. Drive-by clean up of the CMakeLists.txt, especially the no-ops. Task-number: QTBUG-115777 Change-Id: Ib15e33ce157f7e6d99d0530076de6a1024733ed6 Reviewed-by: Alexandru Croitor Reviewed-by: Thiago Macieira (cherry picked from commit 5f522947878690bf7b99ff4b39a6cbaa259b74b1) Reviewed-by: Qt Cherry-pick Bot --- .../plugin/qpluginloader/tst/CMakeLists.txt | 24 +------------------ .../qpluginloader/tst_qpluginloader.cpp | 6 +++-- 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt b/tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt index 30931b4b28e..50bfc314ce3 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt +++ b/tests/auto/corelib/plugin/qpluginloader/tst/CMakeLists.txt @@ -16,6 +16,7 @@ qt_internal_add_test(tst_qpluginloader ../theplugin/plugininterface.h ../tst_qpluginloader.cpp LIBRARIES + Qt::CorePrivate staticplugin TESTDATA ${test_data} ) @@ -46,26 +47,3 @@ if(ANDROID) QT_ANDROID_EXTRA_LIBS "${extra_libs}" ) endif() - -## Scopes: -##################################################################### - -qt_internal_extend_target(tst_qpluginloader - LIBRARIES - Qt::CorePrivate -) - -qt_internal_extend_target(tst_qpluginloader CONDITION CMAKE_BUILD_TYPE STREQUAL Debug AND WIN32 AND debug_and_release - LIBRARIES - # Remove: L../staticplugin/debug -) - -qt_internal_extend_target(tst_qpluginloader CONDITION WIN32 AND debug_and_release AND NOT CMAKE_BUILD_TYPE STREQUAL Debug - LIBRARIES - # Remove: L../staticplugin/release -) - -qt_internal_extend_target(tst_qpluginloader CONDITION UNIX OR NOT debug_and_release - LIBRARIES - # Remove: L../staticplugin -) diff --git a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp index 46ec5f693d9..54da124f87b 100644 --- a/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp @@ -12,7 +12,7 @@ #include #include "theplugin/plugininterface.h" -#include +#include #if defined(QT_BUILD_INTERNAL) && defined(Q_OF_MACH_O) # include @@ -861,7 +861,9 @@ void tst_QPluginLoader::archSpecificVersion() QString expectedArch; #if defined(Q_PROCESSOR_X86_64) && defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) - if (__builtin_cpu_supports("avx2") && __builtin_cpu_supports("fma")) + // On Unix systems (other than Darwin, which has fat binaries), + // QPluginLoader will load a separate file for x86-64-v3 systems. + if (qCpuHasFeature(ArchHaswell)) expectedArch = "x86-64-v3"; #endif