From d59e50063ad708509f3ad83350be33f5612c4f54 Mon Sep 17 00:00:00 2001 From: Dmitriy Ivanov Date: Fri, 9 May 2014 09:10:14 -0700 Subject: 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 --- linker/linker_allocator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'linker/linker_allocator.cpp') diff --git a/linker/linker_allocator.cpp b/linker/linker_allocator.cpp index 573809075..c8b97b121 100644 --- a/linker/linker_allocator.cpp +++ b/linker/linker_allocator.cpp @@ -55,8 +55,7 @@ void* LinkerBlockAllocator::alloc() { 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 @@ void LinkerBlockAllocator::free(void* block) { abort(); } + memset(block, 0, block_size_); + FreeBlockInfo* block_info = reinterpret_cast(block); block_info->next_block = free_block_list_; @@ -100,6 +101,7 @@ void LinkerBlockAllocator::create_new_page() { if (page == MAP_FAILED) { abort(); // oom } + memset(page, 0, PAGE_SIZE); FreeBlockInfo* first_block = reinterpret_cast(page->bytes); first_block->next_block = free_block_list_; -- cgit v1.2.3