Load libraries in breadth-first order

  This patch fixes the problem with symbol search order
  for dlsym(RTLD_DEFAULT/RTLD_NEXT, .) by loading libraries
  and ld_preloads in correct order.

Bug: https://code.google.com/p/android/issues/detail?id=74255
Attempt: 2

(cherry picked from commit 14669a939d113214a4a20b9318fca0992d5453f0)

Change-Id: Id87540c96a2242220967b6fa5d84ddcd829e2b97
diff --git a/linker/linker.h b/linker/linker.h
index 6547d68..3024d3a 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -204,6 +204,7 @@
   void CallConstructors();
   void CallDestructors();
   void CallPreInitConstructors();
+  bool PrelinkImage();
   bool LinkImage(const android_dlextinfo* extinfo);
 
   void add_child(soinfo* child);
@@ -217,6 +218,7 @@
   bool get_has_ifuncs();
 
   soinfo_list_t& get_children();
+  soinfo_list_t& get_parents();
 
   bool inline has_min_version(uint32_t min_version) {
     return (flags & FLAG_NEW_SOINFO) != 0 && version >= min_version;