| Index: third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp
|
| diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp b/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp
|
| index b509e16634f755a9957c840e10785e004ccfe672..eff997d2983495a02bff9610f622b3a4e8dc96c4 100644
|
| --- a/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp
|
| +++ b/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp
|
| @@ -101,7 +101,6 @@ class SharedLibraryResolver : public ElfRelocations::SymbolResolver {
|
| Vector<LibraryView*>* preloads,
|
| Vector<LibraryView*>* dependencies)
|
| : main_program_handle_(::dlopen(NULL, RTLD_NOW)),
|
| - sdk_build_version_(*Globals::GetSDKBuildVersion()),
|
| lib_(lib), preloads_(preloads), dependencies_(dependencies) {}
|
|
|
| virtual void* Lookup(const char* symbol_name) {
|
| @@ -117,50 +116,30 @@ class SharedLibraryResolver : public ElfRelocations::SymbolResolver {
|
| if (address)
|
| return address;
|
|
|
| - // Make sure that we do nothing here for non-Lollipop platforms.
|
| - // In practice, preloads_ will be empty (because we ignore LD_PRELOAD
|
| - // when not Lollipop) and searching in the main executable should be
|
| - // benign. But crbug/479220 is weird enough that we want to take all
|
| - // possible precautions.
|
| + // Then look inside the preloads.
|
| //
|
| - // For more, see:
|
| - // https://code.google.com/p/chromium/issues/detail?id=479220
|
| - if (sdk_build_version_ == SDK_VERSION_CODE_LOLLIPOP) {
|
| - // Then look inside the preloads.
|
| - //
|
| - // Note that searching preloads *before* the main executable is opposite
|
| - // to the search ordering used by the system linker, but it is required
|
| - // to work round a dlsym() bug in some Android releases (on releases
|
| - // without this dlsym() bug preloads_ will be empty, making this preloads
|
| - // search a no-op).
|
| - //
|
| - // For more, see commentary in LibraryList(), and
|
| - // https://code.google.com/p/android/issues/detail?id=74255
|
| - for (size_t n = 0; n < preloads_->GetCount(); ++n) {
|
| - LibraryView* wrap = (*preloads_)[n];
|
| - // LOG("%s: Looking into preload %p (%s)\n", __FUNCTION__, wrap,
|
| - // wrap->GetName());
|
| - address = LookupInWrap(symbol_name, wrap);
|
| - if (address)
|
| - return address;
|
| - }
|
| - }
|
| -
|
| - // Do not lookup inside the main executable for pre-Lollipop, for
|
| - // crbug/479220. We do however want to do it for Lollipop and
|
| - // later, because in Lollipop-mr1 the dlsym() bug is fixed, so that
|
| - // we don't explicitly handle LD_PRELOADS but instead rely on dlsym
|
| - // correctly searching preloads via the main executable.
|
| + // Note that searching preloads *before* the main executable is opposite
|
| + // to the search ordering used by the system linker, but it is required
|
| + // to work round a dlsym() bug in some Android releases (on releases
|
| + // without this dlsym() bug preloads_ will be empty, making this preloads
|
| + // search a no-op).
|
| //
|
| - // For more, see:
|
| - // https://code.google.com/p/chromium/issues/detail?id=479220
|
| - if (sdk_build_version_ >= SDK_VERSION_CODE_LOLLIPOP) {
|
| - // Then look inside the main executable.
|
| - address = ::dlsym(main_program_handle_, symbol_name);
|
| + // For more, see commentary in LibraryList(), and
|
| + // https://code.google.com/p/android/issues/detail?id=74255
|
| + for (size_t n = 0; n < preloads_->GetCount(); ++n) {
|
| + LibraryView* wrap = (*preloads_)[n];
|
| + // LOG("%s: Looking into preload %p (%s)\n", __FUNCTION__, wrap,
|
| + // wrap->GetName());
|
| + address = LookupInWrap(symbol_name, wrap);
|
| if (address)
|
| return address;
|
| }
|
|
|
| + // Then lookup inside the main executable.
|
| + address = ::dlsym(main_program_handle_, symbol_name);
|
| + if (address)
|
| + return address;
|
| +
|
| // Then look inside the dependencies.
|
| for (size_t n = 0; n < dependencies_->GetCount(); ++n) {
|
| LibraryView* wrap = (*dependencies_)[n];
|
| @@ -209,7 +188,6 @@ class SharedLibraryResolver : public ElfRelocations::SymbolResolver {
|
| return NULL;
|
| }
|
|
|
| - const int sdk_build_version_;
|
| void* main_program_handle_;
|
| SharedLibrary* lib_;
|
| Vector<LibraryView*>* preloads_;
|
|
|