From mboxrd@z Thu Jan 1 00:00:00 1970 From: Frank Kotler Subject: Re: Unable to use a variable in instruction Date: Sun, 14 Oct 2007 21:45:17 -0400 Message-ID: <4712C62D.70604@verizon.net> References: Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-reply-to: Sender: linux-assembly-owner@vger.kernel.org List-Id: Content-Type: text/plain; charset="us-ascii"; format="flowed" To: A D Cc: "linux-assembly@vger.kernel.org" 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