Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gas: too many memory reference

When compiling the following instruction:

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

I got: too many memory reference.

What's wrong with it?

like image 869
freenight Avatar asked Mar 28 '10 02:03

freenight


1 Answers

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)
like image 179
Marc W Avatar answered Sep 21 '22 01:09

Marc W