Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(553)

Unified Diff: third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp

Issue 1100763002: Inject CanAddURLToHistory into TopSitesImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefs
Patch Set: Fix error introduced during rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_;

Powered by Google App Engine
This is Rietveld 408576698