This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Question about MIPS elf-rel7
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: binutils at sources dot redhat dot com
- Date: Sun, 4 May 2003 17:20:17 -0400
- Subject: Question about MIPS elf-rel7
I'm looking at elf-rel7.s:
.global frob
.section .barsec,"aM",@progbits,8
.word 0,1
bar: .word 2,3
frob: .word 4,5
.text
foo: lw $4,bar
lw $4,bar+4
lw $4,bar+8
lw $4,frob
lw $4,frob+4
lw $4,frob+16
The first few lines of expected output:
0+00 <.*> lui a0,0x0
0: R_MIPS_HI16 .barsec
0+04 <.*> lw a0,8\(a0\)
4: R_MIPS_LO16 .barsec
0+08 <.*> lui a0,0x0
8: R_MIPS_HI16 bar
0+0c <.*> lw a0,4\(a0\)
c: R_MIPS_LO16 bar
Why should the first relocation be section-relative instead of
symbol-relative? It happens because bar isn't global; but it can still be
moved around by merging. It looks to me like the linker does the right
thing anyway, but I don't understand why gas treats bar and frob
differently.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer