Fix unused DT entry warnings.
DT_STRSZ Implement strtab boundary checks
DT_FLAGS_1 Warn if flags other than DF_1_NOW|DF_1_GLOBAL are set
Bug: 17552334
Bug: 18186310
(cherry picked from commit 6cdeb5234d7f4523fe9d83974f265d80f10512a6)
Change-Id: I7ffc7bc600798308a77ad949a644949b64250ae2
diff --git a/linker/dlfcn.cpp b/linker/dlfcn.cpp
index c02bfb8..367179d 100644
--- a/linker/dlfcn.cpp
+++ b/linker/dlfcn.cpp
@@ -147,7 +147,7 @@
// Determine if any symbol in the library contains the specified address.
ElfW(Sym)* sym = dladdr_find_symbol(si, addr);
if (sym != nullptr) {
- info->dli_sname = si->strtab + sym->st_name;
+ info->dli_sname = si->get_string(sym->st_name);
info->dli_saddr = reinterpret_cast<void*>(si->resolve_symbol_address(sym));
}
@@ -245,6 +245,7 @@
__libdl_info.bucket = g_libdl_buckets;
__libdl_info.chain = g_libdl_chains;
__libdl_info.ref_count = 1;
+ __libdl_info.strtab_size = sizeof(ANDROID_LIBDL_STRTAB);
}
return &__libdl_info;