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

Eli Friedman eli.friedman at gmail.com
Mon Aug 17 13:16:42 PDT 2009


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




More information about the cfe-dev mailing list