am d644fecc: Merge "Fix gdb could not get shared library list issue"
* commit 'd644fecc8e5eec0107ca4e2011cee0e5c0a10bdd': Fix gdb could not get shared library list issue
This commit is contained in:
commit
f799da9f17
@ -612,6 +612,8 @@ class LoadTask {
|
|||||||
DISALLOW_IMPLICIT_CONSTRUCTORS(LoadTask);
|
DISALLOW_IMPLICIT_CONSTRUCTORS(LoadTask);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
LoadTask::deleter_t LoadTask::deleter;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using linked_list_t = LinkedList<T, TypeBasedAllocator<LinkedListEntry<T>>>;
|
using linked_list_t = LinkedList<T, TypeBasedAllocator<LinkedListEntry<T>>>;
|
||||||
|
|
||||||
@ -1826,7 +1828,9 @@ static int nullify_closed_stdio() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool soinfo::PrelinkImage() {
|
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 */
|
/* We can't log anything until the linker is relocated */
|
||||||
bool relocating_linker = (flags & FLAG_LINKER) != 0;
|
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);
|
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 (dynamic == nullptr) {
|
||||||
if (!relocating_linker) {
|
if (!relocating_linker) {
|
||||||
DL_ERR("missing PT_DYNAMIC in \"%s\"", name);
|
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(Ehdr)* elf_hdr = reinterpret_cast<ElfW(Ehdr)*>(linker_base);
|
||||||
ElfW(Phdr)* phdr = reinterpret_cast<ElfW(Phdr)*>(linker_base + elf_hdr->e_phoff);
|
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,
|
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);
|
insert_soinfo_into_debug_map(&linker_soinfo_for_gdb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,15 +702,20 @@ int phdr_table_get_arm_exidx(const ElfW(Phdr)* phdr_table, size_t phdr_count,
|
|||||||
* load_bias -> load bias
|
* load_bias -> load bias
|
||||||
* Output:
|
* Output:
|
||||||
* dynamic -> address of table in memory (null on failure).
|
* dynamic -> address of table in memory (null on failure).
|
||||||
|
* dynamic_flags -> protection flags for section (unset on failure)
|
||||||
* Return:
|
* Return:
|
||||||
* void
|
* void
|
||||||
*/
|
*/
|
||||||
void phdr_table_get_dynamic_section(const ElfW(Phdr)* phdr_table, size_t phdr_count,
|
void phdr_table_get_dynamic_section(const ElfW(Phdr)* phdr_table, size_t phdr_count,
|
||||||
ElfW(Addr) load_bias, ElfW(Dyn)** dynamic) {
|
ElfW(Addr) load_bias, ElfW(Dyn)** dynamic,
|
||||||
|
ElfW(Word)* dynamic_flags) {
|
||||||
*dynamic = nullptr;
|
*dynamic = nullptr;
|
||||||
for (const ElfW(Phdr)* phdr = phdr_table, *phdr_limit = phdr + phdr_count; phdr < phdr_limit; phdr++) {
|
for (const ElfW(Phdr)* phdr = phdr_table, *phdr_limit = phdr + phdr_count; phdr < phdr_limit; phdr++) {
|
||||||
if (phdr->p_type == PT_DYNAMIC) {
|
if (phdr->p_type == PT_DYNAMIC) {
|
||||||
*dynamic = reinterpret_cast<ElfW(Dyn)*>(load_bias + phdr->p_vaddr);
|
*dynamic = reinterpret_cast<ElfW(Dyn)*>(load_bias + phdr->p_vaddr);
|
||||||
|
if (dynamic_flags) {
|
||||||
|
*dynamic_flags = phdr->p_flags;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,7 @@ int phdr_table_get_arm_exidx(const ElfW(Phdr)* phdr_table, size_t phdr_count, El
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void phdr_table_get_dynamic_section(const ElfW(Phdr)* phdr_table, size_t phdr_count,
|
void phdr_table_get_dynamic_section(const ElfW(Phdr)* phdr_table, size_t phdr_count,
|
||||||
ElfW(Addr) load_bias, ElfW(Dyn)** dynamic);
|
ElfW(Addr) load_bias, ElfW(Dyn)** dynamic,
|
||||||
|
ElfW(Word)* dynamic_flags);
|
||||||
|
|
||||||
#endif /* LINKER_PHDR_H */
|
#endif /* LINKER_PHDR_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user