summaryrefslogtreecommitdiff
path: root/linker/linker.cpp
diff options
context:
space:
mode:
authorNingsheng Jian <ningsheng.jian@arm.com>2014-09-16 15:22:10 +0800
committerElliott Hughes <enh@google.com>2014-09-26 22:58:57 +0000
commite93be99da0614ff38cbf8b2bb0624ff1dc79b8d0 (patch)
tree0b341ea3bad005b55b13910852702d1a4356c430 /linker/linker.cpp
parent17e7d3208c68ff69819179d8a63ca234be2d1ab9 (diff)
Fix gdb could not get shared library list issue
Get dynamic flags from phdr table's correct entry rather the first entry, so that the following DT_DEBUG entry can be set. Also fix the undefined reference to LoadTask::deleter issue under gcc -O0 option. Bug: 17524778 Change-Id: I9c679af197b034761fb739d6c980e628ff2ab84c
Diffstat (limited to 'linker/linker.cpp')
-rw-r--r--linker/linker.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp
index f11cfdbce..09ffa2399 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -612,6 +612,8 @@ class LoadTask {
DISALLOW_IMPLICIT_CONSTRUCTORS(LoadTask);
};
+LoadTask::deleter_t LoadTask::deleter;
+
template <typename T>
using linked_list_t = LinkedList<T, TypeBasedAllocator<LinkedListEntry<T>>>;
@@ -1826,7 +1828,9 @@ static int nullify_closed_stdio() {
}
bool soinfo::PrelinkImage() {
- phdr_table_get_dynamic_section(phdr, phnum, load_bias, &dynamic);
+ /* Extract dynamic section */
+ ElfW(Word) dynamic_flags = 0;
+ phdr_table_get_dynamic_section(phdr, phnum, load_bias, &dynamic, &dynamic_flags);
/* We can't log anything until the linker is relocated */
bool relocating_linker = (flags & FLAG_LINKER) != 0;
@@ -1835,8 +1839,6 @@ bool soinfo::PrelinkImage() {
DEBUG("si->base = %p si->flags = 0x%08x", reinterpret_cast<void*>(base), flags);
}
- /* Extract dynamic section */
- ElfW(Word) dynamic_flags = phdr->p_flags;
if (dynamic == nullptr) {
if (!relocating_linker) {
DL_ERR("missing PT_DYNAMIC in \"%s\"", name);
@@ -2228,7 +2230,7 @@ static void init_linker_info_for_gdb(ElfW(Addr) linker_base) {
ElfW(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(linker_base);
ElfW(Phdr)* phdr = reinterpret_cast<ElfW(Phdr)*>(linker_base + elf_hdr->e_phoff);
phdr_table_get_dynamic_section(phdr, elf_hdr->e_phnum, linker_base,
- &linker_soinfo_for_gdb.dynamic);
+ &linker_soinfo_for_gdb.dynamic, nullptr);
insert_soinfo_into_debug_map(&linker_soinfo_for_gdb);
}