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
Bug: 18186310

(cherry picked from commit cfa97f172d)

Change-Id: I5fa8c673f929e4652c738912c7ae078d7ec286d2
This commit is contained in:
Dmitriy Ivanov
2014-10-21 09:23:18 -07:00
parent 4d0c1f673f
commit fd2747bb58
14 changed files with 688 additions and 162 deletions

View File

@@ -207,7 +207,7 @@ struct soinfo {
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 @@ struct soinfo {
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: