From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24843 invoked by alias); 6 Feb 2005 16:52:14 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 24795 invoked from network); 6 Feb 2005 16:52:06 -0000 Received: from unknown (HELO sccrmhc12.comcast.net) (204.127.202.56) by sourceware.org with SMTP; 6 Feb 2005 16:52:06 -0000 Received: from lucon.org ([24.6.212.230]) by comcast.net (sccrmhc12) with ESMTP id <2005020616520501200g06s8e>; Sun, 6 Feb 2005 16:52:05 +0000 Received: by lucon.org (Postfix, from userid 1000) id 4C0CB65603; Sun, 6 Feb 2005 08:52:05 -0800 (PST) Date: Mon, 07 Feb 2005 02:30:00 -0000 From: "H. J. Lu" To: binutils@sources.redhat.com Subject: Re: PATCH: SHN_XINDEX support is broken Message-ID: <20050206165205.GA27181@lucon.org> References: <20050204234328.GA11070@lucon.org> <20050205002412.GA11816@lucon.org> <20050206131810.GB23954@bubble.modra.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050206131810.GB23954@bubble.modra.org> User-Agent: Mutt/1.4.1i X-SW-Source: 2005-02/txt/msg00094.txt.bz2 On Sun, Feb 06, 2005 at 11:48:10PM +1030, Alan Modra wrote: > On Fri, Feb 04, 2005 at 04:24:12PM -0800, H. J. Lu wrote: > > On Fri, Feb 04, 2005 at 03:43:28PM -0800, H. J. Lu wrote: > > > Hi Alan, > > > > > > SHN_XINDEX support doesn't work. I have a testcase to show it. The > > > problem is that binutils assumes the full symbol table is available > > > before all sections are processed. > > HJ, you really ought to describe in a little more detail why you need to > make changes. Since I know the ELF linker code fairly well, I can guess > that this change is needed to read a group signature symbol. Correct? > > If you have done the work to debug the problem, a description like the > following should be easy to write, and would make review of your patches > simpler. I will remember that before I came up with a smal testcase next time. BTW, I couldn't create a small testcase. > > "SHT_GROUP sections are typically ordered before SHT_SYMTAB and > SHT_SYMTAB_SHNDX in the ELF section headers, and thus are loaded by > elf_object_p before the symbol table sections. When loading a group > section, bfd_section_from_shdr calls group_signature to read a symbol > name associated with the group. group_signature ensures that the > SHT_SYMTAB section is loaded, but doesn't load SHT_SYMTAB_SHNDX. This > can lead to an abort if the symbol st_shndx is SHN_XINDEX." > > > > It only works without SHN_XINDEX > > > since SHT_REL/SHT_RELA sections will load SHT_SYMTAB. The problem > > > affects both bfd and readelf. I will see what I can do. > > > > > > > 2005-02-04 H.J. Lu > > > > * elfcode.h (elf_object_p): Read in SHT_SYMTAB and > > SHT_SYMTAB_SHNDX sections first. > > I don't think this is the best place to fix this problem. One reason is > that elfcode.h is compiled twice, once for 32-bit support and once for > 64-bit, so we should avoid adding code to elfcode.h if at all possible. > Another reason is that bfd_section_from_shdr already handles a number of > similar section dependecies, so that's where I would add code to load > SHT_SYMTAB_SHNDX when handling SHT_SYMTAB. > > Like this. Plus a few cleanups and minor optimizations. I'll commit in > the morning assuming my overnight tests look good. > It seems to work with my 20MB testcase. Thanks. H.J.