This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [patch] MIPS gas problems with gcc's explicit relocs
Paul Koning wrote:
[snip]
> Thiemo> Interestingly, "p" causes this expansion:
>
> Thiemo> lui $2,%highest(foo) daddiu $2,$2,%higher(foo) sll $2,$2,16
> Thiemo> daddiu $2,$2,%hi(foo) dsll $2,$2,16 ld $2,%lo(foo)($2) #APP
> Thiemo> dla $2,$2 #NO_APP
>
> Thiemo> So the inline assembler gets a fully loaded register for it.
>
> That sounds like a bug -- it does not match what the documentation
> says it should do, and it doesn't make any real sense either.
>
> My view is that the built-in macro stuff of the MIPS assembler is a
> mistake,
Well, I disagree. It's nice for hand-written assembler code. :-)
> and the compiler should always do the job, not the
> assembler, because the compiler can do it better. So for the compiler
> to expand the multiple steps needed to load an address is correct.
Sure, as far as no hand-written (inline) assembler code is affected.
> For example, if I use an "m" constraint, I'd expect the corresponding
> %x operand to become an offset and base register pair with a valid
> offset and the base register loaded with the rest of the address.
That's not the way gcc up to 3.3 works for mips. So far, it was
possible to write
asm("ld\t%0,%1(%2)" : "=r" (foo) : "m" (bar), "r" (baz));
and get something like
#APP
ld $2,bar($2)
#NO_APP
but now this results in
#APP
ld $2,%lo(bar)($3)($2)
#NO_APP
which is of course invalid.
Thiemo