Lookup version info when relocating mips got
Bug: http://b/20693971 Bug: http://b/20139821 Change-Id: I28bd3bc44dafe048761b2c598facfe20320128c4 (cherry picked from commit f39cb63603da949325b4d186e870d0c3de01eb30)
This commit is contained in:
parent
f92a417d07
commit
dc145b5106
@ -2941,7 +2941,7 @@ bool soinfo::link_image(const soinfo_list_t& global_group, const soinfo_list_t&
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__mips__)
|
#if defined(__mips__)
|
||||||
if (!mips_relocate_got(global_group, local_group)) {
|
if (!mips_relocate_got(version_tracker, global_group, local_group)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -247,7 +247,9 @@ struct soinfo {
|
|||||||
uint32_t mips_symtabno_;
|
uint32_t mips_symtabno_;
|
||||||
uint32_t mips_local_gotno_;
|
uint32_t mips_local_gotno_;
|
||||||
uint32_t mips_gotsym_;
|
uint32_t mips_gotsym_;
|
||||||
bool mips_relocate_got(const soinfo_list_t& global_group, const soinfo_list_t& local_group);
|
bool mips_relocate_got(const VersionTracker& version_tracker,
|
||||||
|
const soinfo_list_t& global_group,
|
||||||
|
const soinfo_list_t& local_group);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
size_t ref_count_;
|
size_t ref_count_;
|
||||||
|
@ -124,7 +124,8 @@ bool soinfo::relocate(const VersionTracker& version_tracker,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool soinfo::mips_relocate_got(const soinfo_list_t& global_group,
|
bool soinfo::mips_relocate_got(const VersionTracker& version_tracker,
|
||||||
|
const soinfo_list_t& global_group,
|
||||||
const soinfo_list_t& local_group) {
|
const soinfo_list_t& local_group) {
|
||||||
ElfW(Addr)** got = plt_got_;
|
ElfW(Addr)** got = plt_got_;
|
||||||
if (got == nullptr) {
|
if (got == nullptr) {
|
||||||
@ -148,21 +149,27 @@ bool soinfo::mips_relocate_got(const soinfo_list_t& global_group,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now for the global GOT entries...
|
// Now for the global GOT entries...
|
||||||
ElfW(Sym)* sym = symtab_ + mips_gotsym_;
|
|
||||||
got = plt_got_ + mips_local_gotno_;
|
got = plt_got_ + mips_local_gotno_;
|
||||||
for (size_t g = mips_gotsym_; g < mips_symtabno_; g++, sym++, got++) {
|
for (ElfW(Word) sym = mips_gotsym_; sym < mips_symtabno_; sym++, got++) {
|
||||||
// This is an undefined reference... try to locate it.
|
// This is an undefined reference... try to locate it.
|
||||||
const char* sym_name = get_string(sym->st_name);
|
const ElfW(Sym)* local_sym = symtab_ + sym;
|
||||||
|
const char* sym_name = get_string(local_sym->st_name);
|
||||||
soinfo* lsi = nullptr;
|
soinfo* lsi = nullptr;
|
||||||
const ElfW(Sym)* s = nullptr;
|
const ElfW(Sym)* s = nullptr;
|
||||||
if (!soinfo_do_lookup(this, sym_name, nullptr, &lsi, global_group, local_group, &s)) {
|
|
||||||
|
const version_info* vi = nullptr;
|
||||||
|
|
||||||
|
if (!lookup_version_info(version_tracker, sym, sym_name, &vi)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!soinfo_do_lookup(this, sym_name, vi, &lsi, global_group, local_group, &s)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s == nullptr) {
|
if (s == nullptr) {
|
||||||
// We only allow an undefined symbol if this is a weak reference.
|
// We only allow an undefined symbol if this is a weak reference.
|
||||||
s = &symtab_[g];
|
if (ELF_ST_BIND(local_sym->st_info) != STB_WEAK) {
|
||||||
if (ELF_ST_BIND(s->st_info) != STB_WEAK) {
|
|
||||||
DL_ERR("cannot locate \"%s\"...", sym_name);
|
DL_ERR("cannot locate \"%s\"...", sym_name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user