public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH: Fix PR 2267
@ 2006-03-30 13:35 Ben Elliston
  0 siblings, 0 replies; only message in thread
From: Ben Elliston @ 2006-03-30 13:35 UTC (permalink / raw)
  To: binutils

This little patch corrects PR 2267.  Tested on mips-elf, where the
problem was reported.  No regressions.

Pre-approved by Alan Modra; committed.

2006-03-30  Ben Elliston  <bje@au.ibm.com>

        PR ld/2267
        * elflink.c (elf_fixup_link_order): Ensure `elfsec' is not a
        special section number that exceeds the number of ELF sections
        (eg. SHN_MIPS_SCOMMON).

Index: elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.207
diff -u -p -r1.207 elflink.c
--- elflink.c   17 Mar 2006 18:37:21 -0000      1.207
+++ elflink.c   30 Mar 2006 00:19:14 -0000
@@ -7665,7 +7665,7 @@ elf_fixup_link_order (bfd *abfd, asectio
   struct bfd_link_order *p;
   bfd *sub;
   const struct elf_backend_data *bed = get_elf_backend_data (abfd);
-  int elfsec;
+  unsigned elfsec;
   struct bfd_link_order **sections;
   asection *s, *other_sec, *linkorder_sec;
   bfd_vma offset;
@@ -7682,7 +7682,8 @@ elf_fixup_link_order (bfd *abfd, asectio
          sub = s->owner;
          if (bfd_get_flavour (sub) == bfd_target_elf_flavour
              && elf_elfheader (sub)->e_ident[EI_CLASS] == bed->s->elfclass
-             && (elfsec = _bfd_elf_section_from_bfd_section (sub, s)) != -1
+             && (elfsec = _bfd_elf_section_from_bfd_section (sub, s))
+             && elfsec < elf_numsections (sub)
              && elf_elfsections (sub)[elfsec]->sh_flags & SHF_LINK_ORDER)
            {
              seen_linkorder++;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-30  0:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-30 13:35 PATCH: Fix PR 2267 Ben Elliston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).