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>
This commit is contained in:
parent
0723e14699
commit
33a4e3b470
@ -163,6 +163,10 @@ static QBasicMutex qt_library_mutex;
|
||||
If this hint is given, the filename of the library consists of
|
||||
a path, which is a reference to an archive file, followed by
|
||||
a reference to the archive member.
|
||||
\value PreventUnloadHint
|
||||
Prevents the library from being unloaded from the address space if close()
|
||||
is called. The library's static variables are not reinitialized if open()
|
||||
is called at a later time.
|
||||
|
||||
\sa loadHints
|
||||
*/
|
||||
@ -1230,6 +1234,8 @@ QString QLibrary::errorString() const
|
||||
to the library \c shr_64.o in the archive file named \c libGL.a. This
|
||||
is only supported on the AIX platform.
|
||||
|
||||
Setting PreventUnloadHint will only apply on Unix platforms.
|
||||
|
||||
The interpretation of the load hints is platform dependent, and if
|
||||
you use it you are probably making some assumptions on which platform
|
||||
you are compiling for, so use them only if you understand the consequences
|
||||
|
@ -68,7 +68,8 @@ public:
|
||||
enum LoadHint {
|
||||
ResolveAllSymbolsHint = 0x01,
|
||||
ExportExternalSymbolsHint = 0x02,
|
||||
LoadArchiveMemberHint = 0x04
|
||||
LoadArchiveMemberHint = 0x04,
|
||||
PreventUnloadHint = 0x08
|
||||
};
|
||||
Q_DECLARE_FLAGS(LoadHints, LoadHint)
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user