This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]