summaryrefslogtreecommitdiff
path: root/bfd/elf32-hppa.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2007-12-31 11:01:54 +0000
committerNick Clifton <nickc@redhat.com>2007-12-31 11:01:54 +0000
commit17019b39b4f9c69885387279723fef84dc0639e7 (patch)
tree0cf67c9a380c63a1a3909ba2ebf7ce70d25ef30a /bfd/elf32-hppa.c
parent7d225079baa7d2fb19b0d076e1ee3907be292b2b (diff)
downloadbinutils-redhat-17019b39b4f9c69885387279723fef84dc0639e7.tar.gz
* elf.c (_bfd_elf_find_segment_containing_section): New function:
Scan the segment map looking for the segment containing a specified function. * elf-bfd.h: Prototype the new function. * elf-hppa.h (elf_hppa_osec_to_segment): Delete. (elf_hppa_record_segment_addrs): Use new function. * elf32-bfin.c (_bfdfdpic_osec_to_segment): Use new function. * elf32-frv.c (_frvfdpic_osec_to_segment): Use new function. * elf32-hppa.c (hppa_record_segment_addr): Use new function. * elfxx-ia64.c (elfNN_ia64_relocate_section): Use new function.
Diffstat (limited to 'bfd/elf32-hppa.c')
-rw-r--r--bfd/elf32-hppa.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 6fbcd646ec..b707345ba4 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -3256,9 +3256,7 @@ elf32_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
/* Record the lowest address for the data and text segments. */
static void
-hppa_record_segment_addr (bfd *abfd,
- asection *section,
- void *data)
+hppa_record_segment_addr (bfd *abfd, asection *section, void *data)
{
struct elf32_hppa_link_hash_table *htab;
@@ -3266,8 +3264,12 @@ hppa_record_segment_addr (bfd *abfd,
if ((section->flags & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{
- unsigned seg = elf_hppa_osec_to_segment (abfd, section->output_section);
- bfd_vma value = elf_tdata (abfd)->phdr[seg].p_vaddr;
+ bfd_vma value;
+ Elf_Internal_Phdr *p;
+
+ p = _bfd_elf_find_segment_containing_section (abfd, section->output_section);
+ BFD_ASSERT (p != NULL);
+ value = p->p_vaddr;
if ((section->flags & SEC_READONLY) != 0)
{