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>
This commit is contained in:
parent
de9d7b0b25
commit
42ec48d819
@ -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()) {
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user