Commit a5fc5191 by Ping-Hao Wu Committed by Greg Hartman

dlopen() has no NO_LOAD option before Android L.

This change could result in multiple instances of the shared library being loaded when using alternate paths. This will be addressed by b/18752589. Change-Id: Icf26a0c6f76edfd4f1c710e14f1005138d97e77a Reviewed-on: https://swiftshader-review.googlesource.com/2664Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarGreg Hartman <ghartman@google.com>
parent f5525ca6
...@@ -74,14 +74,19 @@ void *loadLibrary(const char *(&names)[n]) ...@@ -74,14 +74,19 @@ void *loadLibrary(const char *(&names)[n])
inline void *getLibraryHandle(const char *path) inline void *getLibraryHandle(const char *path)
{ {
void *resident = dlopen(path, RTLD_LAZY | RTLD_NOLOAD); #ifdef __ANDROID__
// bionic doesn't support RTLD_NOLOAD before L
if(resident) return dlopen(path, RTLD_NOW);
{ #else
return dlopen(path, RTLD_LAZY); // Increment reference count void *resident = dlopen(path, RTLD_LAZY | RTLD_NOLOAD);
}
if(resident)
return 0; {
return dlopen(path, RTLD_LAZY); // Increment reference count
}
return 0;
#endif
} }
inline void freeLibrary(void *library) inline void freeLibrary(void *library)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment