Commit 76394858 by Nicolas Capens

Explicitly load shared libraries with local visibility.

On some platforms the default is undefined if neither RTLD_GLOBAL nor RTLD_LOCAL is specified. Bug 25282950 Change-Id: I0aea6a9f604afa0412a8f6d9c614b18987fbf514 Reviewed-on: https://swiftshader-review.googlesource.com/4190Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent b7e6c326
...@@ -84,20 +84,20 @@ void *loadLibrary(const char *(&names)[n], const char *mustContainSymbol = nullp ...@@ -84,20 +84,20 @@ void *loadLibrary(const char *(&names)[n], const char *mustContainSymbol = nullp
#else #else
inline void *loadLibrary(const char *path) inline void *loadLibrary(const char *path)
{ {
return dlopen(path, RTLD_LAZY); return dlopen(path, RTLD_LAZY | RTLD_LOCAL);
} }
inline void *getLibraryHandle(const char *path) inline void *getLibraryHandle(const char *path)
{ {
#ifdef __ANDROID__ #ifdef __ANDROID__
// bionic doesn't support RTLD_NOLOAD before L // bionic doesn't support RTLD_NOLOAD before L
return dlopen(path, RTLD_NOW); return dlopen(path, RTLD_NOW | RTLD_LOCAL);
#else #else
void *resident = dlopen(path, RTLD_LAZY | RTLD_NOLOAD); void *resident = dlopen(path, RTLD_LAZY | RTLD_NOLOAD | RTLD_LOCAL);
if(resident) if(resident)
{ {
return dlopen(path, RTLD_LAZY); // Increment reference count return dlopen(path, RTLD_LAZY | RTLD_LOCAL); // Increment reference count
} }
return 0; return 0;
......
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