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 <alexandru.croitor@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5f522947878690bf7b99ff4b39a6cbaa259b74b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2024-09-02 07:28:15 -07:00 committed by Qt Cherry-pick Bot
parent ba6ffd99e2
commit 02510e11a9
2 changed files with 5 additions and 25 deletions

View File

@ -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
)

View File

@ -12,7 +12,7 @@
#include <QScopeGuard>
#include "theplugin/plugininterface.h"
#include <QtCore/private/qglobal_p.h>
#include <QtCore/private/qsimd_p.h>
#if defined(QT_BUILD_INTERNAL) && defined(Q_OF_MACH_O)
# include <QtCore/private/qmachparser_p.h>
@ -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