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
Andreas Schwab wrote:
> Eric Christopher <echristo@redhat.com> writes:
>
> >> - Work around the problem by not using "m" constraints for (d)la in
> >> the inline assembler, that is instead of
> >>
> >> asm("dla\t%0,%1" : "=r" (result) : "m" (foo));
> >>
> >> something like
> >>
> >> asm("dla\t%0,foo" : "=r" (result));
> >
> > I like this I think the most. It fits with what people are trying to do
> > with the la instruction, i.e. load an address for a symbol that they
> > know.
>
> For "load address" and "push address" type insns there is the "p"
> constraint letter. Wouldn't that be the correct constraint here?
Interestingly, "p" causes this expansion:
lui $2,%highest(foo)
daddiu $2,$2,%higher(foo)
sll $2,$2,16
daddiu $2,$2,%hi(foo)
dsll $2,$2,16
ld $2,%lo(foo)($2)
#APP
dla $2,$2
#NO_APP
So the inline assembler gets a fully loaded register for it.
Thiemo