gas: too many memory reference

前端 未结 3 1333
走了就别回头了
走了就别回头了 2020-11-29 13:26

When compiling the following instruction:

movl 4(%ebp), 8(%ebp)

I got: too many memory reference.

What\'s wrong wi

相关标签:
3条回答
  • 2020-11-29 13:44

    movl doesn't to memory-memory moves, you have to go by way of a register (thus with two movl instructions).

    0 讨论(0)
  • 2020-11-29 13:47

    The number before the parenthesis is a byte offset (which causes a memory reference to occur), and you cannot have two of them with movl. You need to move the value temporarily to a register first.

    movl 4(%ebp), %ecx
    movl %ecx, 8(%ebp)
    
    0 讨论(0)
  • 2020-11-29 13:52

    It is not a legal instruction. For most instructions that reference memory you must move it to/from a register.

    0 讨论(0)
提交回复
热议问题