summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin/qlibrary_unix.cpp
diff options
context:
space:
mode:
authorYan Shapochnik <shapochniky@seapine.com>2012-04-20 08:41:18 -0400
committerQt by Nokia <qt-info@nokia.com>2012-04-24 19:37:13 +0200
commit33a4e3b4706e6819f4471fc431436ec69bee1d33 (patch)
tree387c08af51296475f9d8540a42ea68c83249eddc /src/corelib/plugin/qlibrary_unix.cpp
parent0723e14699704c35d5d61fa7f5e9f3bdbb378afa (diff)
Provide access to RTLD_NODELETE flag on Unix.
Introduce a new QLibrary::PreventUnloadHint to support the RTLD_NODELETE flag support by dlcompat on Unix platforms. Change-Id: Ib1327e968a2a888850ad1086a102a143f86c5090 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com>
Diffstat (limited to 'src/corelib/plugin/qlibrary_unix.cpp')
-rw-r--r--src/corelib/plugin/qlibrary_unix.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
index cb81440c7e..0ad7a87c97 100644
--- a/src/corelib/plugin/qlibrary_unix.cpp
+++ b/src/corelib/plugin/qlibrary_unix.cpp
@@ -167,6 +167,18 @@ bool QLibraryPrivate::load_sys()
dlFlags |= RTLD_LOCAL;
}
#endif
+
+ // Provide access to RTLD_NODELETE flag on Unix
+ // From GNU documentation on RTLD_NODELETE:
+ // Do not unload the library during dlclose(). Consequently, the
+ // library's specific static variables are not reinitialized if the
+ // library is reloaded with dlopen() at a later time.
+#ifdef RTLD_NODELETE
+ if (loadHints & QLibrary::PreventUnloadHint) {
+ dlFlags |= RTLD_NODELETE;
+ }
+#endif
+
#if defined(Q_OS_AIX) // Not sure if any other platform actually support this thing.
if (loadHints & QLibrary::LoadArchiveMemberHint) {
dlFlags |= RTLD_MEMBER;