Re: Unable to use a variable in instruction

Frank Kotler <[email protected]> Sun, 14 Oct 2007 21:45:17 -0400
Newsgroups org.kernel.vger.linux-assembly
Message-ID <[email protected]>
A D wrote:
> I'm having strange problem accessing a variable in a gnu assembly language program.
> When i write a code:
> 
> .section .data
>    x = 4
> mm:
>    .int 1, 2
> 
> .section .text
> .globl _start
> _start:
>    nop
>    movl x, %ecx   #can't do this 

You're trying to access memory at address 4, not move the immediate 
value 4. Try "movl $x, %ecx".

Best,
Frank