LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 12: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, 01:13 PM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

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

Rep: Reputation: 36
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, 01: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, 03: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, 08:22 AM   #6
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
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 / openSUSE 2 07-19-2005 04: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 01:02 AM
Is '/usr/bin/find' reliable if '/bin/ls' has been replaced? DigaMe Linux - Security 2 11-12-2004 10:42 PM
/usr/bin/ld: cannot find -lselinux masand Linux - Software 6 09-03-2004 06:19 AM
/usr/bin/ld: cannot find -lc aa2bi Linux - Newbie 2 06-09-2004 06:32 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:41 AM.

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
Open Source Consulting | Domain Registration