summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2012-04-30 13:22:51 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-05 12:09:38 +0200
commitec360d7ad90945273c7d96c9a159131dcbcd67c3 (patch)
tree9d3e72a732007c6922452aacf83d03cd6009f392 /src/corelib/plugin
parenta7d1b6419d7503474ed5e02f7fb984e4ad5f9219 (diff)
Place the plugin metadata into special sections for Mac and Win
The plugin metadata is placed into a special section in the object file on ELF systems to allow finding it fast. Place the data into a special section on Mac and Windows as well, even though we don't have Mach-O or COFF parsers available yet. This will allow us to add the Mach-O and COFF parsers as a pure optimization later on. Task-number: QTBUG-25054 Change-Id: I376d5443ede715aee2c68fb62d24afdbf66e5685 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/qplugin.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h
index 93be7248c3..e31ab5f565 100644
--- a/src/corelib/plugin/qplugin.h
+++ b/src/corelib/plugin/qplugin.h
@@ -69,11 +69,25 @@ struct QStaticPlugin
void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin);
-#if defined (Q_OF_ELF) && defined (Q_CC_GNU)
+#if defined (Q_OF_ELF) && (defined (Q_CC_GNU) || defined(Q_CC_CLANG))
# define QT_PLUGIN_VERIFICATION_SECTION \
__attribute__ ((section (".qtplugin"))) __attribute__((used))
# define QT_PLUGIN_METADATA_SECTION \
__attribute__ ((section (".qtmetadata"))) __attribute__((used))
+#elif defined(Q_OS_MAC)
+// TODO: Implement section parsing on Mac
+# define QT_PLUGIN_VERIFICATION_SECTION \
+ __attribute__((section("__TEXT,qtplugin"))) __attribute__((used))
+# define QT_PLUGIN_METADATA_SECTION \
+ __attribute__ ((section ("__TEXT,qtmetadata"))) __attribute__((used))
+#elif defined(Q_CC_MSVC)
+// TODO: Implement section parsing for MSVC
+#pragma section(".qtplugin",read,shared)
+#pragma section(".qtmetadata",read,shared)
+# define QT_PLUGIN_VERIFICATION_SECTION \
+ __declspec(allocate(".qtplugin"))
+# define QT_PLUGIN_METADATA_SECTION \
+ __declspec(allocate(".qtmetadata"))
#else
# define QT_PLUGIN_VERIFICATION_SECTION
# define QT_PLUGIN_METADATA_SECTION
@@ -140,8 +154,6 @@ void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin);
// NOTE: if you change pattern, you MUST change the pattern in
// qlibrary.cpp as well. changing the pattern will break all
// backwards compatibility as well (no old plugins will be loaded).
-// QT5: should probably remove the entire pattern thing and do the section
-// trick for all platforms. for now, keep it and fallback to scan for it.
# ifdef QPLUGIN_DEBUG_STR
# undef QPLUGIN_DEBUG_STR
# endif