summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin/qlibrary_unix.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-10-21 11:15:55 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2014-12-02 14:38:36 +0100
commit864cf2a6cd658e4b98e1248e9aaab6fe6afc038f (patch)
tree61ca5ea284c9155af09c0d10d1af0989306e9137 /src/corelib/plugin/qlibrary_unix.cpp
parentf6eb3c220b17ecb56befe1a1ea2241ca6d5ab0c8 (diff)
Add DeepBind option to QLibrary
Adds an option to request the RTLD_DEEPBIND flag to dlopen. On Linux this can be used to force a library to resolve global symbols locally instead of using the similarly named symbols already loaded. This makes it possible to load and use plugins linked against Qt 4 without crashing. [ChangeLog][QtCore][QLibrary] Added DeepBindHint which maps to RTLD_DEEPBIND on Linux making it possible to load libraries with external symbols that clash with already loaded ones, such as plugins linked to Qt4. Change-Id: I4edb4af68e4a47e932a87d108360dba8d91dc34a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/plugin/qlibrary_unix.cpp')
-rw-r--r--src/corelib/plugin/qlibrary_unix.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
index 4f96f3bccf..b178c173c5 100644
--- a/src/corelib/plugin/qlibrary_unix.cpp
+++ b/src/corelib/plugin/qlibrary_unix.cpp
@@ -171,6 +171,10 @@ bool QLibraryPrivate::load_sys()
dlFlags |= RTLD_LOCAL;
}
#endif
+#if defined(RTLD_DEEPBIND)
+ if (loadHints & QLibrary::DeepBindHint)
+ dlFlags |= RTLD_DEEPBIND;
+#endif
// Provide access to RTLD_NODELETE flag on Unix
// From GNU documentation on RTLD_NODELETE: