am 398eb5a7: Merge "Remove unnecessary lookups during relocations"

* commit '398eb5a7ee1f0f7173e463e82381431ef4b21a17':
  Remove unnecessary lookups during relocations
This commit is contained in:
Dmitriy Ivanov 2014-10-28 04:46:54 +00:00 committed by Android Git Automerger
commit fee054f3ec

View File

@ -530,6 +530,11 @@ static ElfW(Sym)* soinfo_do_lookup(soinfo* si, const char* name, soinfo** lsi, c
// 3. Look for it in the local group // 3. Look for it in the local group
if (s == nullptr) { if (s == nullptr) {
local_group.visit([&](soinfo* local_si) { local_group.visit([&](soinfo* local_si) {
if (local_si == si && si->has_DT_SYMBOLIC) {
// we already did this - skip
return true;
}
DEBUG("%s: looking up %s in %s (from local group)", si->name, name, local_si->name); DEBUG("%s: looking up %s in %s (from local group)", si->name, name, local_si->name);
s = soinfo_elf_lookup(local_si, elf_hash, name); s = soinfo_elf_lookup(local_si, elf_hash, name);
if (s != nullptr) { if (s != nullptr) {
@ -541,28 +546,6 @@ static ElfW(Sym)* soinfo_do_lookup(soinfo* si, const char* name, soinfo** lsi, c
}); });
} }
// 4. Look for it in this library (unless we already did it because of DT_SYMBOLIC)
if (s == nullptr && !si->has_DT_SYMBOLIC) {
DEBUG("%s: looking up %s in local scope", si->name, name);
s = soinfo_elf_lookup(si, elf_hash, name);
if (s != nullptr) {
*lsi = si;
}
}
// 5. Dependencies
if (s == nullptr) {
si->get_children().visit([&](soinfo* child) {
DEBUG("%s: looking up %s in %s", si->name, name, child->name);
s = soinfo_elf_lookup(child, elf_hash, name);
if (s != nullptr) {
*lsi = child;
return false;
}
return true;
});
}
if (s != nullptr) { if (s != nullptr) {
TRACE_TYPE(LOOKUP, "si %s sym %s s->st_value = %p, " TRACE_TYPE(LOOKUP, "si %s sym %s s->st_value = %p, "
"found in %s, base = %p, load bias = %p", "found in %s, base = %p, load bias = %p",