diff options
author | Yan Shapochnik <shapochniky@seapine.com> | 2012-04-20 08:41:18 -0400 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-24 19:37:13 +0200 |
commit | 33a4e3b4706e6819f4471fc431436ec69bee1d33 (patch) | |
tree | 387c08af51296475f9d8540a42ea68c83249eddc /src/corelib/plugin/qlibrary_unix.cpp | |
parent | 0723e14699704c35d5d61fa7f5e9f3bdbb378afa (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.cpp | 12 |
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; |