diff options
author | Dmitriy Ivanov <dimitry@google.com> | 2015-04-30 20:17:03 -0700 |
---|---|---|
committer | Dmitriy Ivanov <dimitry@google.com> | 2015-05-01 15:45:51 -0700 |
commit | dc145b510640202a60b0dfaef9d56cd8fc1c05a9 (patch) | |
tree | d59d6a41d9300ec13293b41e8eb3d05d82897447 /linker | |
parent | f92a417d07d70730fda15d7d98d36968a6a7362e (diff) | |
download | bionic-dc145b510640202a60b0dfaef9d56cd8fc1c05a9.tar.gz bionic-dc145b510640202a60b0dfaef9d56cd8fc1c05a9.tar.bz2 bionic-dc145b510640202a60b0dfaef9d56cd8fc1c05a9.zip |
Lookup version info when relocating mips got
Bug: http://b/20693971
Bug: http://b/20139821
Change-Id: I28bd3bc44dafe048761b2c598facfe20320128c4
(cherry picked from commit f39cb63603da949325b4d186e870d0c3de01eb30)
Diffstat (limited to 'linker')
-rw-r--r-- | linker/linker.cpp | 2 | ||||
-rw-r--r-- | linker/linker.h | 4 | ||||
-rw-r--r-- | linker/linker_mips.cpp | 21 |
3 files changed, 18 insertions, 9 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp index 0e6fa450d..2669a5637 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -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 diff --git a/linker/linker.h b/linker/linker.h index 109aeb720..dc8c6e08a 100644 --- a/linker/linker.h +++ b/linker/linker.h @@ -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_; diff --git a/linker/linker_mips.cpp b/linker/linker_mips.cpp index 3402afe68..7436180c3 100644 --- a/linker/linker_mips.cpp +++ b/linker/linker_mips.cpp @@ -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; } |