Fix relocation to look for symbols in local group
The local group is a sequence of libraries in default (breadth-first)
order. It allows RTLD_LOCALLY loaded library to correctly relocate
symbols within its group (see test-cases).
Local group lookup is performed after main executable and ld_preloads.
Bug: 2643900
Bug: 15432753
Change-Id: I9bb013b46d17dbb5cbdfb8fef26f552748385541
diff --git a/linker/linker.h b/linker/linker.h
index 08dd625..02cfa10 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -207,7 +207,7 @@
void CallDestructors();
void CallPreInitConstructors();
bool PrelinkImage();
- bool LinkImage(const android_dlextinfo* extinfo);
+ bool LinkImage(const soinfo_list_t& local_group, const android_dlextinfo* extinfo);
void add_child(soinfo* child);
void remove_all_links();
@@ -234,9 +234,9 @@
void CallArray(const char* array_name, linker_function_t* functions, size_t count, bool reverse);
void CallFunction(const char* function_name, linker_function_t function);
#if defined(USE_RELA)
- int Relocate(ElfW(Rela)* rela, unsigned count);
+ int Relocate(ElfW(Rela)* rela, unsigned count, const soinfo_list_t& local_group);
#else
- int Relocate(ElfW(Rel)* rel, unsigned count);
+ int Relocate(ElfW(Rel)* rel, unsigned count, const soinfo_list_t& local_group);
#endif
private: