Improve detection of already loaded libraries

Linker is now able to resolve symlinked libraries correctly.

soinfo is extended to save the graph of dependencies during
load/unload. Dependencies are used only in CallConstructor.

Bug: 9741592
Change-Id: Id9c48a74c46aa89bcdf3d54ec2f8ba3d398130b1
diff --git a/linker/linker_allocator.cpp b/linker/linker_allocator.cpp
index 5738090..c8b97b1 100644
--- a/linker/linker_allocator.cpp
+++ b/linker/linker_allocator.cpp
@@ -55,8 +55,7 @@
     free_block_list_ = block_info->next_block;
   }
 
-  block_info->next_block = nullptr;
-  block_info->num_free_blocks = 0;
+  memset(block_info, 0, block_size_);
 
   return block_info;
 }
@@ -78,6 +77,8 @@
     abort();
   }
 
+  memset(block, 0, block_size_);
+
   FreeBlockInfo* block_info = reinterpret_cast<FreeBlockInfo*>(block);
 
   block_info->next_block = free_block_list_;
@@ -100,6 +101,7 @@
   if (page == MAP_FAILED) {
     abort(); // oom
   }
+  memset(page, 0, PAGE_SIZE);
 
   FreeBlockInfo* first_block = reinterpret_cast<FreeBlockInfo*>(page->bytes);
   first_block->next_block = free_block_list_;