summaryrefslogtreecommitdiff
path: root/bfd/elf32-frv.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-frv.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-frv.c')
-rw-r--r--bfd/elf32-frv.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index 4fc4359f95..6ce1b9f114 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -1341,26 +1341,9 @@ _frvfdpic_add_rofixup (bfd *output_bfd, asection *rofixup, bfd_vma offset,
static unsigned
_frvfdpic_osec_to_segment (bfd *output_bfd, asection *osec)
{
- struct elf_segment_map *m;
- Elf_Internal_Phdr *p;
-
- /* Find the segment that contains the output_section. */
- for (m = elf_tdata (output_bfd)->segment_map,
- p = elf_tdata (output_bfd)->phdr;
- m != NULL;
- m = m->next, p++)
- {
- int i;
-
- for (i = m->count - 1; i >= 0; i--)
- if (m->sections[i] == osec)
- break;
-
- if (i >= 0)
- break;
- }
+ Elf_Internal_Phdr *p = _bfd_elf_find_segment_containing_section (output_bfd, osec);
- return p - elf_tdata (output_bfd)->phdr;
+ return (p != NULL) ? p - elf_tdata (output_bfd)->phdr : -1;
}
inline static bfd_boolean