Implement lookup by DT_SONAME

  This CL also fixes SEARCH_NAME hack and resolves
  https://code.google.com/p/android/issues/detail?id=6670
  once and for all.

Bug: https://code.google.com/p/android/issues/detail?id=6670
Change-Id: I9b8d6a672cd722f30fbfbb40cdee8d9b39cfe56e
diff --git a/linker/linker.h b/linker/linker.h
index e4681eb..04acda4 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -92,7 +92,7 @@
 
 #define SUPPORTED_DT_FLAGS_1 (DF_1_NOW | DF_1_GLOBAL | DF_1_NODELETE)
 
-#define SOINFO_VERSION 1
+#define SOINFO_VERSION 2
 
 #define SOINFO_NAME_LEN 128
 
@@ -278,6 +278,8 @@
 
   soinfo* get_local_group_root() const;
 
+  const char* get_soname();
+
  private:
   ElfW(Sym)* elf_lookup(SymbolName& symbol_name);
   ElfW(Sym)* elf_addr_lookup(const void* addr);
@@ -322,6 +324,8 @@
   uint8_t* android_relocs_;
   size_t android_relocs_size_;
 
+  const char* soname_;
+
   friend soinfo* get_libdl_info();
 };