diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-31 00:29:26 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-31 00:29:26 (GMT) |
commit | b3da295dc3a4e72d185f9eb767dfe1f518fb0b8a (patch) | |
tree | 804e18e85f8cfa91e6a16c08e60158117c657259 /src/corelib/plugin/qlibrary.cpp | |
parent | f70b38f9e7befd675998d39005a82072ddd2862a (diff) | |
parent | 3509fce85cc317168aa302b01a59d4be380b10a8 (diff) | |
download | Qt-b3da295dc3a4e72d185f9eb767dfe1f518fb0b8a.zip Qt-b3da295dc3a4e72d185f9eb767dfe1f518fb0b8a.tar.gz Qt-b3da295dc3a4e72d185f9eb767dfe1f518fb0b8a.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Fix compilation on mac.
Doc update: Mention the Qt::AA_X11InitThreads application attribute.
Fix incorrect include order
Add missing QT_BEGIN_NAMESPACE
Fix crash introduced with d34287af6fc1c7558e8ed15dbb29c0e6b58b7b00
find .rodata in qt plugins to optimize loading of plugins with no qt section
fix missing include
Optimize plugin loading on ELF platforms
use QFile:map instead of ::mmap
QAbstractItemView: optimize handling of editors for view with large numbers of editors.
Diffstat (limited to 'src/corelib/plugin/qlibrary.cpp')
-rw-r--r-- | src/corelib/plugin/qlibrary.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 1ca9d70..8f82cc4 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -38,7 +38,6 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - #include "qplatformdefs.h" #include "qlibrary.h" @@ -61,6 +60,7 @@ #include <qdebug.h> #include <qvector.h> #include <qdir.h> +#include "qelfparser_p.h" QT_BEGIN_NAMESPACE @@ -365,11 +365,31 @@ static bool qt_unix_query(const QString &library, uint *version, bool *debug, QB fdlen = data.size(); } - // verify that the pattern is present in the plugin + /* + ELF binaries on GNU, have .qplugin sections. + */ + long pos = 0; const char pattern[] = "pattern=QT_PLUGIN_VERIFICATION_DATA"; const ulong plen = qstrlen(pattern); - long pos = qt_find_pattern(filedata, fdlen, pattern, plen); - +#if defined (Q_OF_ELF) && defined(Q_CC_GNU) + int r = QElfParser().parse(filedata, fdlen, library, lib, &pos, &fdlen); + if (r == QElfParser::NoQtSection) { + if (pos > 0) { + // find inside .rodata + long rel = qt_find_pattern(filedata + pos, fdlen, pattern, plen); + if (rel < 0) { + pos = -1; + } else { + pos += rel; + } + } else { + pos = qt_find_pattern(filedata, fdlen, pattern, plen); + } + } else if (r != QElfParser::Ok) + return false; +#else + pos = qt_find_pattern(filedata, fdlen, pattern, plen); +#endif // defined(Q_OF_ELF) && defined(Q_CC_GNU) bool ret = false; if (pos >= 0) ret = qt_parse_pattern(filedata + pos, version, debug, key); |