From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29195 invoked by alias); 11 Dec 2004 05:08:12 -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 27873 invoked from network); 11 Dec 2004 05:07:37 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sourceware.org with SMTP; 11 Dec 2004 05:07:37 -0000 Received: from drow by nevyn.them.org with local (Exim 4.34 #1 (Debian)) id 1CczTd-0000qA-To; Sat, 11 Dec 2004 00:07:29 -0500 Date: Sat, 11 Dec 2004 05:08:00 -0000 From: Daniel Jacobowitz To: binutils@sources.redhat.com Cc: Hans-Peter Nilsson Subject: Re: RFA: Don't canonicalize STT_SECTION syms Message-ID: <20041211050729.GA1103@nevyn.them.org> Mail-Followup-To: binutils@sources.redhat.com, Hans-Peter Nilsson References: <20041210140431.GF12046@bubble.modra.org> <200412101514.iBAFEVEf002240@ignucius.se.axis.com> <20041210151929.GA14328@nevyn.them.org> <20041211042043.GJ12046@bubble.modra.org> <20041211043426.GA31280@nevyn.them.org> <20041211045751.GL12046@bubble.modra.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041211045751.GL12046@bubble.modra.org> User-Agent: Mutt/1.5.5.1+cvs20040105i X-SW-Source: 2004-12/txt/msg00134.txt.bz2 On Sat, Dec 11, 2004 at 03:27:51PM +1030, Alan Modra wrote: > On Fri, Dec 10, 2004 at 11:34:26PM -0500, Daniel Jacobowitz wrote: > > On Sat, Dec 11, 2004 at 02:50:43PM +1030, Alan Modra wrote: > > > On Fri, Dec 10, 2004 at 10:19:29AM -0500, Daniel Jacobowitz wrote: > > > > so I assume there is more. > > > > > > Yeah. > > > > > > bfd/ChangeLog > > > * elfcode.h (elf_slurp_symbol_table): Use bfd_elf_sym_name so that > > > canonical sections syms have a name. > > > > Could you explain why this change is necessary? It's not going back to > > the same place we were before, and I find this... > > Well, you either have this change, revert your change that stopped use > of the section symbol for relocs, or introduce some elf dependecy into > objdump. Otherwise objdump -r won't display a name for relocs against > section syms. OK, now I see the problem. > > > -0+00 l d foo 0+0 > > > +0+00 l d foo 0+0 (|foo) > > > > to be pretty confusing, since IIRC an undefined reference to foo > > shouldn't be resolved to that symbol, if the ELF symbol's name is > > empty. > > How is this different from other local symbols? Like this. Output from my system tools, i.e. well before this patch. drow@nevyn:~/qtmp% cat foo.s .section "foo" .word 0 drow@nevyn:~/qtmp% cat bar.s .section "bar" .word foo drow@nevyn:~/qtmp% as -o foo.o foo.s drow@nevyn:~/qtmp% as -o bar.o bar.s drow@nevyn:~/qtmp% readelf -s foo.o bar.o File: foo.o Symbol table '.symtab' contains 5 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 SECTION LOCAL DEFAULT 1 2: 00000000 0 SECTION LOCAL DEFAULT 2 3: 00000000 0 SECTION LOCAL DEFAULT 3 4: 00000000 0 SECTION LOCAL DEFAULT 4 File: bar.o Symbol table '.symtab' contains 6 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 SECTION LOCAL DEFAULT 1 2: 00000000 0 SECTION LOCAL DEFAULT 2 3: 00000000 0 SECTION LOCAL DEFAULT 3 4: 00000000 0 SECTION LOCAL DEFAULT 4 5: 00000000 0 NOTYPE GLOBAL DEFAULT UND foo drow@nevyn:~/qtmp% ld -r -o foo foo.o bar.o drow@nevyn:~/qtmp% readelf -s foo Symbol table '.symtab' contains 11 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 SECTION LOCAL DEFAULT 1 2: 00000000 0 SECTION LOCAL DEFAULT 2 3: 00000000 0 SECTION LOCAL DEFAULT 3 4: 00000000 0 SECTION LOCAL DEFAULT 4 5: 00000000 0 SECTION LOCAL DEFAULT 5 6: 00000000 0 SECTION LOCAL DEFAULT 6 7: 00000000 0 SECTION LOCAL DEFAULT 7 8: 00000000 0 SECTION LOCAL DEFAULT 8 9: 00000000 0 SECTION LOCAL DEFAULT 9 10: 00000000 0 NOTYPE GLOBAL DEFAULT UND foo drow@nevyn:~/qtmp% objdump -t foo foo: file format elf32-i386 SYMBOL TABLE: 00000000 l d .text 00000000 00000000 l d .data 00000000 00000000 l d .bss 00000000 00000000 l d foo 00000000 00000000 l d bar 00000000 00000000 l d *ABS* 00000000 00000000 l d *ABS* 00000000 00000000 l d *ABS* 00000000 00000000 l d *ABS* 00000000 00000000 *UND* 00000000 foo If that showed both of these: 00000000 l d foo 00000000 foo 00000000 *UND* 00000000 foo I'd be really confused! "Why didn't 'foo' resolve to 'foo'?" the user asks me... -- Daniel Jacobowitz