From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18704 invoked by alias); 23 Aug 2006 17:33:10 -0000 Received: (qmail 18686 invoked by uid 22791); 23 Aug 2006 17:33:09 -0000 X-Spam-Check-By: sourceware.org Received: from ip-85-160-201-12.eurotel.cz (HELO host0.dyn.jankratochvil.net) (85.160.201.12) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 23 Aug 2006 17:33:07 +0000 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.13.7/8.13.7) with ESMTP id k7NHVbaC002453; Wed, 23 Aug 2006 19:31:37 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.13.7/8.13.7/Submit) id k7NHV0S9002171; Wed, 23 Aug 2006 19:31:00 +0200 Date: Wed, 23 Aug 2006 17:33:00 -0000 From: Jan Kratochvil To: Alan Modra Cc: Vivek Goyal , gdb@sourceware.org, Dave Anderson , binutils@sourceware.org Subject: Re: "gdb vmlinux" gives wrong symbol addresses Message-ID: <20060823173100.GA1865@host0.dyn.jankratochvil.net> References: <20060818183807.GD12962@in.ibm.com> <20060818184837.GA1980@nevyn.them.org> <20060821013829.GA20576@bubble.grove.modra.org> <20060821015430.GA4615@nevyn.them.org> <20060821032419.GB20875@bubble.grove.modra.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="0vzXIDBeUiKkjNJl" Content-Disposition: inline In-Reply-To: <20060821032419.GB20875@bubble.grove.modra.org> User-Agent: Mutt/1.4.2.1i X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-08/txt/msg00182.txt.bz2 --0vzXIDBeUiKkjNJl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1122 On Mon, 21 Aug 2006 05:24:19 +0200, Alan Modra wrote: > On Sun, Aug 20, 2006 at 09:54:30PM -0400, Daniel Jacobowitz wrote: > > On Mon, Aug 21, 2006 at 11:08:29AM +0930, Alan Modra wrote: > > > I think that for ET_EXEC and ET_DYN gdb should ignore relocs that use > > > the normal symbol table. Sane ELF targets will have dynamic reloc > > > section(s) with sh_link pointing at a symtab section with sh_type of > > > SHT_DYNSYM. --emit-relocs creates reloc sections with sh_link pointing > > > at a symtab section with sh_type of SHT_SYMTAB. > > > > This amounts to always ignoring relocations; GDB only uses relocations > > for debug sections, which will never point at SHT_DYNSYM (I don't > > think?). > > When we emitted relocs for debug sections on some targets (eg. ppc32 > prior to 2005-04-19), they were against SHT_DYNSYM symbols. Do you have such (ppc32?) shared library(?) binary handy? It would be find to include it to the gdb testsuite. The restricted patch targetting relocatable Linux kernel but not targetting the libraries attached, IMO safe. It is gdb-only patch, not binutils-wide. Regards, Jan --0vzXIDBeUiKkjNJl Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb-6.5-bz203661-emit-relocs.patch" Content-length: 613 --- sources-clean/gdb/symfile.c 2006-08-23 09:22:21.000000000 +0200 +++ sources-custom/gdb/symfile.c 2006-08-23 09:54:24.000000000 +0200 @@ -3713,6 +3713,12 @@ bfd_byte * symfile_relocate_debug_section (bfd *abfd, asection *sectp, bfd_byte *buf) { + /* Executable files have all the relocations already resolved. + * Handle files linked with --emit-relocs. + * http://sources.redhat.com/ml/gdb/2006-08/msg00137.html */ + if ((abfd->flags & EXEC_P) != 0) + return NULL; + /* We're only interested in debugging sections with relocation information. */ if ((sectp->flags & SEC_RELOC) == 0) --0vzXIDBeUiKkjNJl--