This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: RFA: Don't canonicalize STT_SECTION syms
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