Mail Archives: djgpp/2001/01/05/12:21:35.1
From: | Tom St Denis <stdenis AT compmore DOT net>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Nasm & Gcc. HELP!
|
Date: | Fri, 05 Jan 2001 17:00:58 GMT
|
Organization: | Deja.com
|
Lines: | 76
|
Message-ID: | <934uk4$po1$1@nnrp1.deja.com>
|
References: | <934tdg$oj0$1 AT nnrp1 DOT deja DOT com>
|
NNTP-Posting-Host: | 24.156.37.224
|
X-Article-Creation-Date: | Fri Jan 05 17:00:58 2001 GMT
|
X-Http-User-Agent: | Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
|
X-Http-Proxy: | 1.1 x60.deja.com:80 (Squid/1.1.22) for client 24.156.37.224
|
X-MyDeja-Info: | XMYDJUIDtomstdenis
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
In article <934tdg$oj0$1 AT nnrp1 DOT deja DOT com>,
pixelpajas AT my-deja DOT com wrote:
>
>
> Hi .. I'm trying to learn how to use nasm
> assembler code with gcc but i get an error when i
> link the objects. Below are the source files and
> command compile/link entries.
>
> - 4k.c ----------------------------------------
>
> extern unsigned int keyget(unsigned int);
>
> void main(void)
> {
> keyget(1);
> }
>
> -----------------------------------------------
>
> - lib.asm -------------------------------------
>
> [BITS 32]
> [GLOBAL _key]
> [SECTION .text]
>
> _key: MOV CX,1
>
> keyloop: MOV AH,01h
> INT 16h
>
> JZ keyloop
> MOV AH,00h
> INT 16h
>
> MOV AH,0Ah
> INT 10h
>
> CMP AL,0Dh
> JNE keyloop
>
> MOV AH,4Ch // clean exit
> INT 21h // ----------
>
> -----------------------------------------------
>
> first i build lib.asm -> nasm -f coff lib.asm
>
> then i compile 4k.c -> gxx -nostdlib -nostdinc -
> fno-builtin -fno-exceptions -c -O3 4k.c -r
>
> and at last i try to link -> ld -nostdlib -
> nostdinc -fno-builtin -fno-exceptions -e _main -
> oformat binary -o 4k.com 4k.o lib.o
>
> but in the last step i get -> " 4k.o
> (.text+0x6):4k.c: undefined reference to `_keyget
> (unsigned int)' "
>
> Is there anyone out there that can help me and
> tell me what im doing wrong???
My only suggsetion is to put the "global" declaration inside your
section .ie
[section .text]
[global _keyget]
...
perhaps?
Tom
Sent via Deja.com
http://www.deja.com/
- Raw text -