summaryrefslogtreecommitdiffstats
path: root/linker
diff options
context:
space:
mode:
authorDmitriy Ivanov <dimitry@google.com>2015-05-04 19:30:49 -0700
committerDmitriy Ivanov <dimitry@google.com>2015-05-05 15:39:42 -0700
commit456afe24b6460f75b3abc296f8f5885f4d8d907a (patch)
treeb08c2bd7510ca9202fdf27d4f52453e855681c89 /linker
parent064a9800f372b8efd6d7b08150ab5204e5304c84 (diff)
downloadbionic-456afe24b6460f75b3abc296f8f5885f4d8d907a.zip
bionic-456afe24b6460f75b3abc296f8f5885f4d8d907a.tar.gz
bionic-456afe24b6460f75b3abc296f8f5885f4d8d907a.tar.bz2
Fix protected symbol lookups for mips
Bug: http://b/20694161 Change-Id: I5cc58034f9776e1db9cddc34abe48ef85f6048f4 (cherry picked from commit dbe26fdcc7de503539837467299b96c4a93084cc)
Diffstat (limited to 'linker')
-rw-r--r--linker/linker_mips.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/linker/linker_mips.cpp b/linker/linker_mips.cpp
index 7436180..a7a4bc0 100644
--- a/linker/linker_mips.cpp
+++ b/linker/linker_mips.cpp
@@ -157,20 +157,34 @@ bool soinfo::mips_relocate_got(const VersionTracker& version_tracker,
soinfo* lsi = nullptr;
const ElfW(Sym)* s = nullptr;
- const version_info* vi = nullptr;
+ ElfW(Word) st_visibility = (local_sym->st_other & 0x3);
- if (!lookup_version_info(version_tracker, sym, sym_name, &vi)) {
- return false;
- }
+ if (st_visibility == STV_DEFAULT) {
+ 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)) {
+ if (!soinfo_do_lookup(this, sym_name, vi, &lsi, global_group, local_group, &s)) {
+ return false;
+ }
+ } else if (st_visibility == STV_PROTECTED) {
+ if (local_sym->st_value == 0) {
+ DL_ERR("%s: invalid symbol \"%s\" (PROTECTED/UNDEFINED) ", get_soname(), sym_name);
+ return false;
+ }
+ s = local_sym;
+ lsi = this;
+ } else {
+ DL_ERR("%s: invalid symbol \"%s\" visibility: 0x%x", get_soname(), sym_name, st_visibility);
return false;
}
if (s == nullptr) {
// We only allow an undefined symbol if this is a weak reference.
if (ELF_ST_BIND(local_sym->st_info) != STB_WEAK) {
- DL_ERR("cannot locate \"%s\"...", sym_name);
+ DL_ERR("%s: cannot locate \"%s\"...", get_soname(), sym_name);
return false;
}
*got = 0;