public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@bigpond.net.au>
To: binutils@sources.redhat.com,
	Hans-Peter Nilsson <hans-peter.nilsson@axis.com>
Subject: Re: RFA: Don't canonicalize STT_SECTION syms
Date: Sat, 11 Dec 2004 05:52:00 -0000	[thread overview]
Message-ID: <20041211055235.GN12046@bubble.modra.org> (raw)
In-Reply-To: <20041211053202.GM12046@bubble.modra.org>

On Sat, Dec 11, 2004 at 04:02:02PM +1030, Alan Modra wrote:
> On Sat, Dec 11, 2004 at 12:07:29AM -0500, Daniel Jacobowitz wrote:
> > drow@nevyn:~/qtmp% ld -r -o foo foo.o bar.o
> 
> Mutter.  ld -r.  Mutter.
> 
> > 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...
> 
> Well, I'm not wedded to the trick I used.  In fact, I made provision for
> reverting the elfcode.h change without needing to change the testsuite.

And if you can play tricks with ld -r, so can I.  :)

$ cat u1.s
 .long foo
 .long bar
$ cat u2..s
 .section foo,"awM",@progbits,4
 .long foo
bar:
 .long bar
$ as -o u1.o u1.s
$ as -o u2.o u2.s
$ ld -r -o u.o u1.o u2.o
$ objdump -t u.o

u.o:     file format elf32-i386

SYMBOL TABLE:
00000000 l    d  .text  00000000
00000000 l    d  *ABS*  00000000
00000000 l    d  .data  00000000
00000000 l    d  foo    00000000
00000000 l    d  *ABS*  00000000
00000000 l    d  .bss   00000000
00000000 l    d  *ABS*  00000000
00000000 l    d  *ABS*  00000000
00000000 l    d  *ABS*  00000000
00000004 l       foo    00000000 bar
00000000         *UND*  00000000 foo
00000000         *UND*  00000000 bar

Both defined and undefined "bar".  Repeating with current tools:

u.o:     file format elf32-i386

SYMBOL TABLE:
00000000 l    d  .text  00000000 .text
00000000 l    d  *ABS*  00000000 .rel.text
00000000 l    d  .data  00000000 .data
00000000 l    d  foo    00000000 foo
00000000 l    d  *ABS*  00000000 .relfoo
00000000 l    d  .bss   00000000 .bss
00000000 l    d  *ABS*  00000000 .shstrtab
00000000 l    d  *ABS*  00000000 .symtab
00000000 l    d  *ABS*  00000000 .strtab
00000004 l       foo    00000000 bar
00000000         *UND*  00000000 foo
00000000         *UND*  00000000 bar

I don't see that as being as worse.  Like I said before, the reason we
can have this is that bar (and foo) are local to a file.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

      parent reply	other threads:[~2004-12-11  5:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-08 21:50 Daniel Jacobowitz
2004-12-08 23:57 ` Alan Modra
2004-12-10  3:15 ` Hans-Peter Nilsson
2004-12-10  3:21   ` Daniel Jacobowitz
2004-12-10 12:14     ` Alan Modra
2004-12-10 12:56       ` Alan Modra
2004-12-10 14:04         ` Alan Modra
2004-12-10 15:14           ` Hans-Peter Nilsson
2004-12-10 15:19             ` Daniel Jacobowitz
2004-12-11  4:21               ` Alan Modra
2004-12-11  4:34                 ` Daniel Jacobowitz
2004-12-11  4:57                   ` Alan Modra
2004-12-11  5:08                     ` Daniel Jacobowitz
2004-12-11  5:32                       ` Alan Modra
2004-12-11  5:38                         ` Daniel Jacobowitz
2004-12-11  5:59                           ` Alan Modra
2004-12-11  6:11                             ` Daniel Jacobowitz
2004-12-11  5:52                         ` Alan Modra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041211055235.GN12046@bubble.modra.org \
    --to=amodra@bigpond.net.au \
    --cc=binutils@sources.redhat.com \
    --cc=hans-peter.nilsson@axis.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).