Validate defined versions in prelink_image
Validate the list of defined versions explicitly, during library
prelinking, rather than implicitly as part of constructing the
VersionTracker in soinfo::link_image.
Doing the validation upfront allows removing the symbol lookup failure
code paths, which only happen on a library with invalid version
information.
Helps on the walleye 64-bit linker relocation benchmark (146.2ms ->
131.6ms)
Bug: none
Test: bionic unit tests
Change-Id: Id17508aba3af2863909f0526897c4277419322b7
diff --git a/linker/linker_cfi.cpp b/linker/linker_cfi.cpp
index 435bb1a..5995013 100644
--- a/linker/linker_cfi.cpp
+++ b/linker/linker_cfi.cpp
@@ -142,8 +142,7 @@
static uintptr_t soinfo_find_symbol(soinfo* si, const char* s) {
SymbolName name(s);
- const ElfW(Sym) * sym;
- if (si->find_symbol_by_name(name, nullptr, &sym) && sym) {
+ if (const ElfW(Sym)* sym = si->find_symbol_by_name(name, nullptr)) {
return si->resolve_symbol_address(sym);
}
return 0;