From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4113 invoked by alias); 30 Mar 2006 00:20:34 -0000 Received: (qmail 4104 invoked by uid 22791); 30 Mar 2006 00:20:34 -0000 X-Spam-Check-By: sourceware.org Received: from ausmtp04.au.ibm.com (HELO ausmtp04.au.ibm.com) (202.81.18.152) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 30 Mar 2006 00:20:32 +0000 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [202.81.18.202]) by ausmtp04.au.ibm.com (8.13.6/8.13.5) with ESMTP id k2U0SrGa264108 for ; Thu, 30 Mar 2006 11:28:54 +1100 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.250.242]) by sd0208e0.au.ibm.com (8.12.10/NCO/VER6.8) with ESMTP id k2U0NXhd239664 for ; Thu, 30 Mar 2006 11:23:33 +1100 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.12.11/8.13.3) with ESMTP id k2U0KEmM013249 for ; Thu, 30 Mar 2006 10:20:14 +1000 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.190.163.12]) by d23av01.au.ibm.com (8.12.11/8.12.11) with ESMTP id k2U0KE3K013246 for ; Thu, 30 Mar 2006 10:20:14 +1000 Received: by ozlabs.au.ibm.com (Postfix, from userid 1017) id DB8D973749; Thu, 30 Mar 2006 11:21:13 +1100 (EST) Date: Thu, 30 Mar 2006 13:35:00 -0000 From: Ben Elliston To: binutils@sourceware.org Subject: PATCH: Fix PR 2267 Message-ID: <20060330002113.GA24100@ozlabs.au.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.6i Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-03/txt/msg00358.txt.bz2 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 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++;