From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13283 invoked by alias); 14 Jan 2004 23:42:09 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 13262 invoked from network); 14 Jan 2004 23:42:08 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 14 Jan 2004 23:42:08 -0000 Received: from drow by nevyn.them.org with local (Exim 4.30 #1 (Debian)) id 1AgueE-0001xs-Gy; Wed, 14 Jan 2004 18:42:06 -0500 Date: Wed, 14 Jan 2004 23:42:00 -0000 From: Daniel Jacobowitz To: Richard.Earnshaw@arm.com Cc: Nick Clifton , gdb-patches@sources.redhat.com, binutils@sources.redhat.com Subject: Re: RFA: Skip ARM ELF Mapping symbols when showing disassembly Message-ID: <20040114234206.GA7504@nevyn.them.org> Mail-Followup-To: Richard.Earnshaw@arm.com, Nick Clifton , gdb-patches@sources.redhat.com, binutils@sources.redhat.com References: <200311131445.hADEj7C19503@pc960.cambridge.arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200311131445.hADEj7C19503@pc960.cambridge.arm.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2004-01/txt/msg00383.txt.bz2 On Thu, Nov 13, 2003 at 02:45:07PM +0000, Richard Earnshaw wrote: > > Hi Guys, > > > > I have recently committed a patch to the arm-elf port of GAS which > > causes it to generate special mapping symbols as required by the ARM > > ELF spec. Unfortunately this now means that when GDB shows a > > disassembly it can select one of the mapping symbols instead of the > > proper function name symbol. > > > > The patch below is a fix for this problem. It is not elegant, but > > it does have the advantage of being entirely arm specific. A > > cleaner patch would require changes to generic code, which I did not > > feel comfortable doing. > > > > May I apply this patch ? > > > > Cheers > > Nick > > > > I wonder whether a better way to handle all this is to override > slurp_symbol_table for arm-elf to a routine that just skips the mapping > symbols entirely (or at least, doesn't put them into the list that it > passes back to its caller), then to add a separate function to slurp the > mapping symbols independently. Then gdb and the disassembler (and the > linker error reports) would all just work normally. > > It would be necessary to add support for copying and fixing up the mapping > symbols when linking, but that's probably not too hard. Actually, I think it's not necessary, since elf_link_input_bfd doesn't use the slurp routines anyway - it parses the ELF symbol table directly. In testing it appears to work. There is another problem, though. The symbols are in the symbol table and thus have assigned numbers. The returned list of symbols is passed back to functions like bfd_canonicalize_reloc, which use the list of symbols to resolve relocations. Probably other consumers assume the whole list of ELF symbols is returned, also, and index it by other copies of the symbol index. So the linker doesn't appear to care, but objdump and possibly GDB do. Any ideas on how to resolve this? We can't NULL out the mapping symbols in symptrs either, because the list is defined to be NULL-terminated (even though we return its length...). -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer