diff options
author | Nick Clifton <nickc@redhat.com> | 2007-12-28 14:45:34 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2007-12-28 14:45:34 +0000 |
commit | 4750aaa46469b761f8888012f9d5314d5afc2636 (patch) | |
tree | b994b6e19e12078f1d97054267f7a44b28567ed6 | |
parent | 000d5124032895c4ae8176491d891132a6d3c755 (diff) | |
download | fsf-binutils-gdb-4750aaa46469b761f8888012f9d5314d5afc2636.zip fsf-binutils-gdb-4750aaa46469b761f8888012f9d5314d5afc2636.tar.gz fsf-binutils-gdb-4750aaa46469b761f8888012f9d5314d5afc2636.tar.bz2 |
* elf32-hppa.c (hppa_record_segment_addr): Locate the segment
containing the section using the segment map, rather than guessing
based upon the section's vma and file position.
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf32-hppa.c | 24 |
2 files changed, 29 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ef64819..a00def0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2007-12-28 Nick Hudson <nick.hudson@dsl.pipex.com> + + * elf32-hppa.c (hppa_record_segment_addr): Locate the segment + containing the section using the segment map, rather than guessing + based upon the section's vma and file position. + 2007-12-24 H.J. Lu <hongjiu.lu@intel.com> PR binutils/5488 diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 0da7e6d..20a2f80 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -3266,8 +3266,30 @@ hppa_record_segment_addr (bfd *abfd ATTRIBUTE_UNUSED, if ((section->flags & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { - bfd_vma value = section->vma - section->filepos; + bfd_vma value; + struct elf_segment_map *m; + Elf_Internal_Phdr *p; + + /* Find the segment that contains the output_section for this section. */ + for (m = elf_tdata (abfd)->segment_map, + p = elf_tdata (abfd)->phdr; + m != NULL; + m = m->next, p++) + { + int i; + + for (i = m->count - 1; i >= 0; i--) + if (m->sections[i] == section->output_section) + break; + if (i >= 0) + break; + } + if (m == NULL) + return; + + value = p->p_vaddr; + if ((section->flags & SEC_READONLY) != 0) { if (value < htab->text_segment_base) |