Re: gcc compile with asm
From: Bo Sun (b0s6067_at_cs.tamu.edu)
Date: 02/23/04
- Previous message: Tobias Wolff: "Problems with automake not detecting dependencies"
- In reply to: Gerhard W. Gruber: "Re: gcc compile with asm"
- Next in thread: Grant Edwards: "Re: gcc compile with asm"
- Reply: Grant Edwards: "Re: gcc compile with asm"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 23 Feb 2004 16:20:38 -0600 To: "Gerhard W. Gruber" <sparhawk@gmx.at>
the sample program asm_test.c is:
#include <stdio.h>
unsigned long sp(void)
{
_asm_("mov1 %esp, %eax"); // return stack ptr
}
int main()
{
printf("%x\n", sp());
return 0;
}
when I use
gcc asm_test.c
I got
Undefined first referenced
symbol in file
_asm_ /var/tmp//ccQyonpr.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
thanks,
bo
On Mon, 23 Feb 2004, Gerhard W. Gruber wrote:
> On Mon, 23 Feb 2004 09:49:57 -0600 wrote Bo Sun <b0s6067@cs.tamu.edu> in
> comp.os.linux.development.system with
> <Pine.GSO.4.58.0402230948350.10260@unix.cs.tamu.edu>
>
> >I have written a program using "_asm_". I would like to know what is the
> >command line I can use to compile and link it.
> >
> >Suppose the file name is file.c
> >
> >gcc file.c
> >
> >does not work.
>
> If your asm code is inlined, then the command for compiling is the same as
> compiling a normal C program, because it IS a normal C program.
>
> If you have a complete sourcecode in asm then it depends on which assembler
> you wrote it for, but from what you posted (which is not much) gcc should work
> just like normal.
>
> It would be enlightening if you could have at least included the errormessage
> you get when you try to compile.
>
> --
> Gerhard Gruber
> Maintainer of
> SoftICE for Linux - http://pice.sourceforge.net/
> Fast application launcher - http://sourceforge.net/projects/launchmenu
>
- Previous message: Tobias Wolff: "Problems with automake not detecting dependencies"
- In reply to: Gerhard W. Gruber: "Re: gcc compile with asm"
- Next in thread: Grant Edwards: "Re: gcc compile with asm"
- Reply: Grant Edwards: "Re: gcc compile with asm"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|