www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2008/01/14/05:15:32

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Mon, 14 Jan 2008 11:14:20 +0100
From: linus <linus AT yahoo DOT com>
User-Agent: Thunderbird 2.0.0.6 (X11/20071022)
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: gcc as a linker....
Lines: 41
Message-ID: <478b3603$0$36444$4fafbaef@reader5.news.tin.it>
Organization: TIN.IT (http://www.tin.it)
X-Comments: Please send technical notifications to newsmaster AT tin DOT it
NNTP-Posting-Host: 79.18.42.24
X-Trace: 1200305667 reader5.news.tin.it 36444 79.18.42.24:3597
X-Complaints-To: Please send abuse reports to abuse AT retail DOT telecomitalia DOT it
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I 've compiled with nasm the code below and linked with your gcc...
What does it mean these errors ? (the environment is Win XP ).
Sorry, I am a beginner...gcc can be used as a linker ?
Thanks a lot.

C:\> gcc -oEXE hello.obj
c:/djgpp/lib/crt0.o:crt0.s:(.data+0xc2): undefined reference to `_main'
c:/djgpp/lib/libc.a(crt1.o):crt1.c:(.text+0x404): undefined reference to 
`_main'

collect2: ld returned 1 exit status



************************************************************************************
  	



SECTION .data		; data section
msg:	db "Hello World",10	; the string to print, 10=cr
len:	equ $-msg		; "$" means "here"
				; len is a value, not an address

	SECTION .text		; code section
       ;  global main		; make label available to linker
;main:				; standard  gcc  entry point
	
	mov	edx,len		; arg3, length of string to print
	mov	ecx,msg		; arg2, pointer to string
	mov	ebx,1		; arg1, where to write, screen
	mov	eax,4		; write sysout command to int 80 hex
	int	0x80		; interrupt 80 hex, call kernel
	
	mov	ebx,0		; exit code, 0=normal
	mov	eax,1		; exit command to kernel
	int	0x80		; interrupt 80 hex, call kernel




- Raw text -


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