Lookup version info when relocating mips got
Bug: http://b/20693971
Bug: http://b/20139821
Change-Id: I28bd3bc44dafe048761b2c598facfe20320128c4
(cherry picked from commit f39cb63603
)
This commit is contained in:
parent
f92a417d07
commit
dc145b5106
3 changed files with 18 additions and 9 deletions
|
@ -2941,7 +2941,7 @@ bool soinfo::link_image(const soinfo_list_t& global_group, const soinfo_list_t&
|
|||
#endif
|
||||
|
||||
#if defined(__mips__)
|
||||
if (!mips_relocate_got(global_group, local_group)) {
|
||||
if (!mips_relocate_got(version_tracker, global_group, local_group)) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -247,7 +247,9 @@ struct soinfo {
|
|||
uint32_t mips_symtabno_;
|
||||
uint32_t mips_local_gotno_;
|
||||
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
|
||||
size_t ref_count_;
|
||||
|
|
|
@ -124,7 +124,8 @@ bool soinfo::relocate(const VersionTracker& version_tracker,
|
|||
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) {
|
||||
ElfW(Addr)** got = plt_got_;
|
||||
if (got == nullptr) {
|
||||
|
@ -148,21 +149,27 @@ bool soinfo::mips_relocate_got(const soinfo_list_t& global_group,
|
|||
}
|
||||
|
||||
// Now for the global GOT entries...
|
||||
ElfW(Sym)* sym = symtab_ + mips_gotsym_;
|
||||
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.
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
if (s == nullptr) {
|
||||
// We only allow an undefined symbol if this is a weak reference.
|
||||
s = &symtab_[g];
|
||||
if (ELF_ST_BIND(s->st_info) != STB_WEAK) {
|
||||
if (ELF_ST_BIND(local_sym->st_info) != STB_WEAK) {
|
||||
DL_ERR("cannot locate \"%s\"...", sym_name);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue