summaryrefslogtreecommitdiffstats
path: root/libdwfl/elf-from-memory.c
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2007-08-13 22:58:36 +0000
committerRoland McGrath <[email protected]>2007-08-13 22:58:36 +0000
commit099dd52727f2ce1a2c73cde82af8cd5e06368aec (patch)
tree65df96e401bdf9cc978a9ff655dd9819b9ac1f8b /libdwfl/elf-from-memory.c
parentd82217264c4ac9108dbda1502a545ea25f6d22fe (diff)
missed testdata files
Diffstat (limited to 'libdwfl/elf-from-memory.c')
-rw-r--r--libdwfl/elf-from-memory.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libdwfl/elf-from-memory.c b/libdwfl/elf-from-memory.c
index a292210a..c0e7c46d 100644
--- a/libdwfl/elf-from-memory.c
+++ b/libdwfl/elf-from-memory.c
@@ -213,6 +213,7 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
size_t contents_size = 0;
GElf_Off segments_end = 0;
GElf_Addr loadbase = ehdr_vma;
+ bool found_base = false;
switch (ehdr.e32.e_ident[EI_CLASS])
{
inline void handle_segment (GElf_Addr vaddr, GElf_Off offset,
@@ -223,8 +224,11 @@ elf_from_remote_memory (GElf_Addr ehdr_vma,
if (segment_end > (GElf_Off) contents_size)
contents_size = segment_end;
- if ((offset & -align) == 0 && loadbase == ehdr_vma)
- loadbase = ehdr_vma - (vaddr & -align);
+ if (!found_base && (offset & -align) == 0)
+ {
+ loadbase = ehdr_vma - (vaddr & -align);
+ found_base = true;
+ }
segments_end = offset + filesz;
}