summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2022-06-17 15:49:02 -0700
committerThiago Macieira <thiago.macieira@intel.com>2022-08-12 11:32:29 -0700
commit6234182d82b5f645a61c89219d71ab6a4ac03609 (patch)
tree226bf7fe9c67819f186309e5ea321a63959464a9 /tests/auto/corelib/kernel
parent985e24dd5f1e0b148a79b0c5f9459233cf03dba4 (diff)
QMetaType: don't use global relocations to the lambdas and structures
The way the Qt 6.0 QMetaTypeInterface was designed, using a static inline variable in a template, would normally require the linker and dynamic linker to merge all copies and choose a single copy as the official one. But because of hidden visibility and of Windows DLLs, QMetaType already copes with multiple copies NOT getting merged. So we may as well ask the linkers not to bother and use simpler, local relocations to find those symbols. They are all supposed to still be equivalent and it's an ODR violation if they're not. The Apple ld64 linker complains if you use this type of global relocation: ld: warning: direct access in function [...] to global weak symbol 'QtPrivate::QMetaTypeInterfaceWrapper<int>::metaType' Fixes: QTBUG-93471 Pick-to: 6.3 6.4 Change-Id: Id0fb9ab0089845ee8843fffd16f98a10aa719434 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/corelib/kernel')
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp
index 11dc593ebb..265ec3095f 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype2.cpp
@@ -522,6 +522,14 @@ void tst_QMetaType::operatorEqAcrossLibs()
QCOMPARE(QByteArray(lib2Type.name()), QByteArray(localType.name()));
QCOMPARE(lib1Type, localType);
QCOMPARE(lib2Type, localType);
+
+#if !defined(Q_OS_WIN) && !defined(Q_OS_INTEGRITY)
+ if (actualTypeId < QMetaType::FirstGuiType && actualTypeId != QMetaType::Void) {
+ // for built-in QtCore types, we expect the interfaces to be the same too
+ QCOMPARE(lib1Iface, localIface);
+ QCOMPARE(lib2Iface, localIface);
+ }
+#endif
}
class WithPrivateDTor {