LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Closed Thread
 
Search this Thread
Old 03-15-2004, 01:12 PM   #1
ravig
LQ Newbie
 
Registered: Mar 2004
Posts: 2

Rep: Reputation: 0
Question /usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 08048184


Hi All,
I have a very simple program at this point

#include <string.h>

int main()
{

return 1;
}

I compile using
gcc -Wall -ansi -c -o foo.c.o foo.c

and try to link using

/usr/bin/ld -o ld.o foo.c.o -lc

and I get

/usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 08048100

Could someone please help me with what's going on, so that I could move on to writing some real code. I have about a few hundred object files to link and using "ld" is my only option at this time.

Thanks,
 
Old 03-15-2004, 02:13 PM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 58
Try compiling with just: gcc -Wall -ansi foo.c -o foo
 
Old 03-15-2004, 02:29 PM   #3
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 34
The symbol you are missing is part of a default library, crt0.o.
Using the gcc command itsme86 gave you automatically links that symbol into your program for you.
 
Old 03-15-2004, 02:31 PM   #4
ravig
LQ Newbie
 
Registered: Mar 2004
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks. This seems to help. Could you please let me kow what's the difference here?

Also -- one problem I have is, if I have references to other functions, say, I am compiling and linking multiple modules, how could I avoid the linker errors while compiling?

Thanks,
 
Old 10-31-2010, 04:21 PM   #5
centurion-21
LQ Newbie
 
Registered: Oct 2010
Posts: 2

Rep: Reputation: 0
Using JWASM and /usr/bin/LD in ubuntu 10.10

Dear People using JWASM,
I got the same error as above unable to find _start when I called the linker and it was caused by putting an underscore on the definition of the start label i.e. using _start: instead of using start:
Quote:
;Helloworld.asm date 31 Oct 2010
;jwasm -elf -Fo helloworld.o helloworld.asm
;/usr/bin/ld -o ./helloworld ./helloworld.o

.486
.model flat,c
option casemap:none
public start
;include ./include/jwasm.inc
stdout equ 1
SYS_EXIT equ 1
SYS_WRITE equ 4
.data

string db "Hello, world!",10

.code
start:

call main

mov eax, SYS_EXIT
int 80h
ret
main proc
mov ecx, offset string
mov edx, sizeof string
mov ebx, stdout
mov eax, SYS_WRITE
int 80h
ret
main endp

end start

END
The above is the sample code for helloworld.asm
try it out with the jwasm compiler for linux and ld which is in /usr/bin/ld

I found the error by looking at the object table with the command

objdump -hrt helloworld.o and that showed that start was being given an underscore at some point by the assembler when producing the object file helloworld.o
 
Old 11-01-2010, 09:22 AM   #6
crabboy
Moderator
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
centruion-21, you'll have much better luck creating a new post than tacking onto a post from '04. In addition, you've created a duplicate post on another thread which is not allowed. I've split your other thread into a new thread.

http://www.linuxquestions.org/questi...0-10-a-841667/
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
warning : /usr/lib64/libavcodec.so: undefined symbol: awt586 Suse/Novell 2 07-19-2005 05:18 PM
path in services wrong for clamav updated frm 0.75 to 0.80 usr/bin vs usr/local/bin Emmanuel_uk Linux - Newbie 3 04-22-2005 02:02 AM
Is '/usr/bin/find' reliable if '/bin/ls' has been replaced? DigaMe Linux - Security 2 11-12-2004 11:42 PM
/usr/bin/ld: cannot find -lselinux masand Linux - Software 6 09-03-2004 07:19 AM
/usr/bin/ld: cannot find -lc aa2bi Linux - Newbie 2 06-09-2004 07:32 AM


All times are GMT -5. The time now is 10:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration