Assembler Error: Expression Too Complex

I am trying to make a simple asm built-in command Cand compile it with gcc. I want to push a variable numonto the stack:

asm (
    "push %0"
    :          //output
    : "r"(num) //input
    :          //clobber
);

The above error:

Error: expression too complex -- `push r3'

I am following this tutorial and I have not found anything about the team push.

I also tried:

asm ( "push %num" ); //Assembler Error: expression too complex -- `push %num'

and

asm ( "push %[num]" ); //gcc error: undefined named operand 'num'

But no one worked.

change

I use this compiler: arm-linux-gnueabihf-gcc

+4
source share
1 answer

ARM push stmdb. . , , :

asm("push {%0}" : : "r"(num) : );
+7

All Articles