From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23935 invoked by alias); 7 May 2011 08:11:00 -0000 Received: (qmail 23923 invoked by uid 22791); 7 May 2011 08:10:56 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,TW_FX X-Spam-Check-By: sourceware.org Received: from mail-pv0-f169.google.com (HELO mail-pv0-f169.google.com) (74.125.83.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 07 May 2011 08:10:42 +0000 Received: by pvc12 with SMTP id 12so2505229pvc.0 for ; Sat, 07 May 2011 01:10:42 -0700 (PDT) Received: by 10.142.247.7 with SMTP id u7mr2517211wfh.255.1304755842204; Sat, 07 May 2011 01:10:42 -0700 (PDT) Received: from bubble.grove.modra.org ([115.187.252.19]) by mx.google.com with ESMTPS id u3sm2683562pbn.77.2011.05.07.01.10.39 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 07 May 2011 01:10:40 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id ABD7C170C2B9; Sat, 7 May 2011 17:40:35 +0930 (CST) Date: Sat, 07 May 2011 08:11:00 -0000 From: Alan Modra To: "H.J. Lu" Cc: Binutils Subject: Re: PATCH: PR ld/12730: regression] crash when allocating in a static constructor Message-ID: <20110507081035.GR7018@bubble.grove.modra.org> Mail-Followup-To: "H.J. Lu" , Binutils References: <20110505051832.GA28229@intel.com> <20110505082721.GG7018@bubble.grove.modra.org> <20110505141230.GJ7018@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00093.txt.bz2 On Fri, May 06, 2011 at 09:16:20AM -0700, H.J. Lu wrote: > How about this patch? Much better, thanks. But, > * elf.c (_bfd_elf_section_reloc_offset): New. why not put your changes in _bfd_elf_section_offset? > * elf64-x86-64.c (elf_x86_64_relocate_section): Call > _bfd_elf_section_reloc_offset instead of > _bfd_elf_section_offset. > * elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise. The world is more than just Intel.. Every other ELF target will need the same as you've done for x86_64 and ia64, and it would be better to reverse relocs even for REL targets just in case you have a reloc against a global sym. > + /* We need to reverse-copy input .ctors/.dtors sections if > + they are placed in .init_array/.finit_array for output. */ > + if (o->size > address_size > + && ((strcmp (o->name, ".ctors") == 0 strncmp (o->name, ".ctors", 6) == 0 && (o->name[6] == 0 || o->name[6] == '.') Ditto for dtors, or explain to me why not. Seems to me that .ctors.nn section could possibly have more than one constructor. -- Alan Modra Australia Development Lab, IBM