MIPS md_apply_fix()(?) problem.

cgd@broadcom.com cgd@broadcom.com
Wed Nov 7 04:14:00 GMT 2001


"H . J . Lu" <hjl@lucon.org> writes:
> On Thu, Nov 15, 2001 at 06:27:14PM -0800, cgd@broadcom.com wrote:
> > "H . J . Lu" <hjl@lucon.org> writes:
> > > I don't understand what you meant. I just compiled the test you
> > > provided.
> > 
> > again, _with what version of tools_?
> 
> Today's CVS as of 6:50pm PST.

I poked at the flags a bit more, and with -G 0 the current sources
assemble the code fragment correctly.

Without -G 0 they do not.

(I'm pretty sure that with the source date I was starting with,
neither did, but that's not particularly important at this point.
I just looked at the changelogs, and it looks like the code which
makes -G 0 work came in in rev 1.82 of tc-mips.c, which was committed
at 2001/10/10 01:08:35 (UTC).  I had started with 2001-10-10 00:00
UTC.  grr.  8-)


To remove any possible confusion about sizes vs. -G 0 (not that there
should have been, in the code I provided), I changed the code be:

        .text

        .ent    fn                              # unneeded
        .type   fn,@function                    # unneeded
fn:                                             # unneeded
        lw      $5,boot_mem_map+12($17)
        .end    fn                              # unneeded

        .data
        .align  2

spacer:   
        .space  100


        .globl  boot_mem_map
boot_mem_map:   
        .space  100


There's no way 'spacer' or 'boot_mem_map' should be in any way
confused with small data, as far as I know.

Again, -G 0 produces correct assembly code and w/o -G does not.

w/o -g you get:

   0:   3c050000        lui     a1,0x0
                        0: R_MIPS_HI16  boot_mem_map
   4:   00b12821        addu    a1,a1,s1
   8:   8ca50070        lw      a1,112(a1)
                        8: R_MIPS_LO16  boot_mem_map

When linked that produces:

[ ... ]
10000064 g     O .data  00000000 boot_mem_map
[ ... ]
  4000b0:       3c051000        lui     a1,0x1000
  4000b4:       00b12821        addu    a1,a1,s1
  4000b8:       8ca500d4        lw      a1,212(a1)
  4000bc:       00000000        nop

"not the right thing."


Am I missing something here?  AFAIK this should work just fine even
w/o -G 0, and it obviously doesn't.  The only reason that it works w/
-G 0 is that that variant frag crud is (now) avoided entirely for -G
0...



cgd



More information about the Binutils mailing list