[cfe-dev] variable length argument functions in AMD64 arch

Zhi Wang beiyuw at gmail.com
Mon Aug 17 14:12:16 PDT 2009


On Mon, Aug 17, 2009 at 4:16 PM, Eli Friedman <eli.friedman at gmail.com>wrote:

> On Mon, Aug 17, 2009 at 12:25 PM, Zhi Wang<beiyuw at gmail.com> wrote:
> > BTW, it seems clang can't handle the "=rm" inline assembly code as in the
> > following:
> > static inline struct pcpu_gs *percpu ()
> > {
> >         struct pcpu_gs         *gs;
> >
> >         asm volatile ("movq %%gs:gs_self, %0" : "=rm" (gs));
> >         return gs;
> > }
> >
> > clang will generate code like:
> >
> > movq %gs:gs_self, -8(%rbp)
> >
> > leading gas to complain: Error: too many memory references for `movq'
>
> The code is wrong... the constraint should be "=r", not "=rm".
>
> -Eli
>
Indeed, thanks again.

--Zhi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090817/5df43de7/attachment.html>


More information about the cfe-dev mailing list