This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
MIPS-elf relocs not like i386-elf sparc-elf
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: MIPS-elf relocs not like i386-elf sparc-elf
- From: plai at Lynx dot COM (Paul Lai)
- Date: Wed, 14 Apr 1999 11:42:36 -0700
PROBLEM SYNOPSIS:
It seems that mips32-elf assembler generates section relative relocs
for global symbols defined within the same object file. Whereas on other
targets, i386-elf (linux-elf) and sparc-elf (sparc-solaris), all reference
the globals through the GOT.
QUESTIONS:
Is this correct behaviour for the mips-elf assembler?
If so, why and what reference defines this behaviour?
If not, where to be fixed?
TESTCASE:
Given the test code:
foo()
{
bar();
extfunc();
}
bar() {}
MIPS DATA:
I find that the mips-elf compiler generates fairly generic references to the
symbols 'bar' and 'extfunc' :
....
foo:
....
la $25,bar
jal $31,$25
la $25,extfunc
jal $31,$25
....
But the assmebler will generate an object where the reloc for 'bar' is
section (.text) relative, rather than GOT relative.
objdump -d --reloc snippet:
....
24: 8f990000 lw $t9,0($gp)
24: R_MIPS_GOT16 .text
28: 00000000 nop
2c: 27390060 addiu $t9,$t9,96
2c: R_MIPS_LO16 .text
30: 0320f809 jalr $t9
34: 00000000 nop
38: 8fdc0010 lw $gp,16($s8)
3c: 8f990000 lw $t9,0($gp)
3c: R_MIPS_GOT16 extfunc
40: 0320f809 jalr $t9
....
SPARC-ELF DATA:
On an sparc-elf (solaris), objdump -d --reloc shows:
...
4: 40 00 00 00 call 4 <foo+0x4>
4: R_SPARC_WDISP30 bar
8: 01 00 00 00 nop
c: 40 00 00 00 call c <foo+0xc>
c: R_SPARC_WDISP30 extfunc
10: 01 00 00 00 nop
...
i386-ELF DATA:
On an i386-elf (linux), objdump -d --reloc shows:
...
10: e8 fc ff ff ff call 11 <foo+0x11>
11: R_386_PLT32 bar
15: e8 fc ff ff ff call 16 <foo+0x16>
16: R_386_PLT32 extfunc
...