delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/11/08:09:51

From: Sengan DOT Short AT durham DOT ac DOT uk
Message-Id: <28741.9606111202@ws-ai5.dur.ac.uk>
Subject: Re: Inline ASM and variable
To: djgpp AT delorie DOT com
Date: Tue, 11 Jun 1996 13:02:43 +0100 (BST)
In-Reply-To: <4phi3n$ajc@vidar.diku.dk> from "Morten Welinder" at Jun 10, 96 04:22:15 pm
Mime-Version: 1.0

> 
> Brian Drum <drum AT ix DOT netcom DOT com> writes:
> 
> >For eaxample:
> 
> >void foo(int x) {
> >  __asm__ __volatile__ ("
> >    movl _x, %%eax"
> >    :
> >    :
> >    :"eax" );
> >}
> 
> >Won't work.  I get the following linker error:
> >test_asm.c(.text+0x4): undefined reference to `x'

I would think that's because your x parameter is not a static location in
memory but a place on the stack, but _x refers to a static location in memory.
(ie if you had static int x; it would work) Thus, gas assembles it wrong.

Sengan

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019