summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2021-09-12 20:18:51 -0700
committerThiago Macieira <thiago.macieira@intel.com>2021-09-14 12:25:54 -0700
commit42ec48d8197847c72a6c527faadee59d219f2043 (patch)
tree451650753b4c322aa713119a64f0c93cc34ae8df /src/corelib/plugin
parentde9d7b0b25245b73d4da63552e5fa24e7fb8578a (diff)
QPlugin: make the macros match the scanning code for ELF systems
For ELF platforms with a GCC-compatible compiler, the QElfParser has been ignoring the .rodata section ever since Qt 5.0 commit 7443895857fdaee132c8efc643e471f02b3d0fa4 ("Remove support for Qt 4 style plugins"). That change removed handling of return value QElfParser::NoQtSection from the ELF parser, which meant that the plugins without a .qtmetadata section were never considered plugins. In other words, for those systems, the __attribute__ macro is mandatory. For systems with a GCC-incompatible compiler, there were only two in Qt 5.x's lifetime: Oracle/Sun Solaris with SunCC and IBM AIX with IBM xlC compiler. Neither compiler supports C++17 according to [1], so they can't be in use in Qt 6. IBM xlC now comes with a Clang-based front-end for users who need Qt 6 and the OpenIndiana distribution of Open Source Solaris has been using GCC since 2012. So make the macros mandatory from now on. [1] https://en.cppreference.com/w/cpp/compiler_support#C.2B.2B17_features Change-Id: I42eb903a916645db9900fffd16a443745446cc64 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/qlibrary.cpp2
-rw-r--r--src/corelib/plugin/qplugin.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index e3783c9cb4..ba682956c1 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -273,7 +273,7 @@ static bool findPatternUnloaded(const QString &library, QLibraryPrivate *lib)
char pattern[] = "qTMETADATA ";
pattern[0] = 'Q'; // Ensure the pattern "QTMETADATA" is not found in this library should QPluginLoader ever encounter it.
const ulong plen = ulong(qstrlen(pattern));
-#if defined (Q_OF_ELF) && defined(Q_CC_GNU)
+#if defined (Q_OF_ELF)
QElfParser::ScanResult r = QElfParser().parse(filedata, fdlen, library, lib, &pos, &fdlen);
if (r == QElfParser::Corrupt || r == QElfParser::NotElf) {
if (lib && qt_debug_component()) {
diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h
index 53cf95056e..411edba792 100644
--- a/src/corelib/plugin/qplugin.h
+++ b/src/corelib/plugin/qplugin.h
@@ -88,7 +88,7 @@ Q_DECLARE_TYPEINFO(QStaticPlugin, Q_PRIMITIVE_TYPE);
void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin);
-#if (defined(Q_OF_ELF) || defined(Q_OS_WIN)) && (defined (Q_CC_GNU) || defined(Q_CC_CLANG))
+#if defined(Q_OF_ELF) || (defined(Q_OS_WIN) && (defined (Q_CC_GNU) || defined(Q_CC_CLANG)))
# define QT_PLUGIN_METADATA_SECTION \
__attribute__ ((section (".qtmetadata"))) __attribute__((used))
#elif defined(Q_OS_MAC)