Chromium Code Reviews| Index: base/native_library_posix.cc |
| diff --git a/base/native_library_posix.cc b/base/native_library_posix.cc |
| index 2dc434b7be25af2395a80b313defa3e8be08616f..ab43acabb5a0fed5d51f3f15c148010e67dcb9ad 100644 |
| --- a/base/native_library_posix.cc |
| +++ b/base/native_library_posix.cc |
| @@ -19,16 +19,27 @@ std::string NativeLibraryLoadError::ToString() const { |
| } |
| // static |
| -NativeLibrary LoadNativeLibrary(const FilePath& library_path, |
| - NativeLibraryLoadError* error) { |
| +NativeLibrary LoadNativeLibraryWithOptions(const FilePath& library_path, |
| + const NativeLibraryOptions& options, |
| + NativeLibraryLoadError* error) { |
| // dlopen() opens the file off disk. |
| ThreadRestrictions::AssertIOAllowed(); |
| - // We deliberately do not use RTLD_DEEPBIND. For the history why, please |
| - // refer to the bug tracker. Some useful bug reports to read include: |
| + // We deliberately do not use RTLD_DEEPBIND by default. For the history why, |
| + // please refer to the bug tracker. Some useful bug reports to read include: |
| // http://crbug.com/17943, http://crbug.com/17557, http://crbug.com/36892, |
| // and http://crbug.com/40794. |
| - void* dl = dlopen(library_path.value().c_str(), RTLD_LAZY); |
| + int flags = RTLD_LAZY; |
| +#if defined(OS_ANDROID) |
| + // Android dlopen() behavior is not well specified and may vary across |
|
Primiano Tucci (use gerrit)
2016/08/25 21:10:53
I'd make this a bit softer and say: "dlopen() beha
Ken Rockot(use gerrit already)
2016/08/25 21:25:01
Done
|
| + // versions. Crash here to warn developers that they're trying to rely on |
| + // undefined behavior. |
| + CHECK(!options.prefer_own_symbols); |
| +#else |
| + if (options.prefer_own_symbols) |
| + flags |= RTLD_DEEPBIND; |
| +#endif |
| + void* dl = dlopen(library_path.value().c_str(), flags); |
| if (!dl && error) |
| error->message = dlerror(); |