[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libunwind-devel] [PATCH 3/7] Fix issue with resolving relative addresse
From: |
Anderson Lizardo |
Subject: |
[Libunwind-devel] [PATCH 3/7] Fix issue with resolving relative addresses for prelinked libraries |
Date: |
Wed, 25 Jun 2008 07:51:10 -0400 |
User-agent: |
quilt/0.46-1 |
When a library is prelinked, its section addresses are already absolute. This
patch checks for prelinked libraries by looking at the virtual address of the
PT_LOAD entry that has an offset equal to zero. If it is not zero, it means the
library is prelinked.
Note that this only affects remote backtrace for ARM, because it fills the
struct dl_phdr_info manually with information from tdep_get_elf_image().
Signed-off-by: Anderson Lizardo <address@hidden>
Signed-off-by: Bruna Moreira <address@hidden>
---
src/dwarf/Gfind_proc_info-lsb.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
Index: libunwind-indt-split/src/dwarf/Gfind_proc_info-lsb.c
===================================================================
--- libunwind-indt-split.orig/src/dwarf/Gfind_proc_info-lsb.c
+++ libunwind-indt-split/src/dwarf/Gfind_proc_info-lsb.c
@@ -269,6 +269,7 @@
char *buf;
size_t bufsize;
unsigned int i;
+ unw_word_t segbase = info->dlpi_addr;
/* First, see if we loaded this frame already. */
@@ -295,15 +296,27 @@
else
name = (char*) dlname;
+ /* pre-linked libraries already have absolute section addresses */
+ for (i = 0; i < info->dlpi_phnum; i++)
+ {
+ if (info->dlpi_phdr[i].p_type == PT_LOAD &&
+ info->dlpi_phdr[i].p_offset == 0 &&
+ info->dlpi_phdr[i].p_vaddr != 0)
+ {
+ segbase = 0;
+ break;
+ }
+ }
+
/* Find the start/end of the described region by parsing the
dl_phdr_info structure. */
- start = info->dlpi_addr + info->dlpi_phdr[0].p_vaddr;
+ start = segbase + info->dlpi_phdr[0].p_vaddr;
end = start;
for (i = 0; i < info->dlpi_phnum; i++)
{
- Elf_W (Addr) hdrbase = info->dlpi_addr + info->dlpi_phdr[i].p_vaddr;
+ Elf_W (Addr) hdrbase = segbase + info->dlpi_phdr[i].p_vaddr;
Elf_W (Addr) hdrlimit = hdrbase + info->dlpi_phdr[i].p_memsz;
if (info->dlpi_phdr[i].p_type != PT_LOAD)
--
Anderson Lizardo
Instituto Nokia de Tecnologia (INdT)
Manaus - Brazil
- [Libunwind-devel] [PATCH 7/7] Implement _UPTi_find_unwind_table() for ARM, (continued)
- [Libunwind-devel] [PATCH 7/7] Implement _UPTi_find_unwind_table() for ARM, Anderson Lizardo, 2008/06/25
- [Libunwind-devel] [PATCH 2/7] Change debuglink lookup order, Anderson Lizardo, 2008/06/25
- [Libunwind-devel] [PATCH 1/7] ARM: add missing register offsets, Anderson Lizardo, 2008/06/25
- [Libunwind-devel] [PATCH 3/7] Fix issue with resolving relative addresses for prelinked libraries,
Anderson Lizardo <=
- [Libunwind-devel] [PATCH 4/7] Add path and pathlen arguments to tdep_get_elf_image(), Anderson Lizardo, 2008/06/25
- Re: [Libunwind-devel] [PATCH 0/7] ARM: add remote backtrace support, Daniel Jacobowitz, 2008/06/25