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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-15-2004, 12:12 PM
|
#1
|
LQ Newbie
Registered: Mar 2004
Posts: 2
Rep:
|
/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,
|
|
|
03-15-2004, 01:13 PM
|
#2
|
Senior Member
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246
Rep:
|
Try compiling with just: gcc -Wall -ansi foo.c -o foo
|
|
|
03-15-2004, 01:29 PM
|
#3
|
Member
Registered: May 2002
Posts: 964
Rep:
|
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.
|
|
|
03-15-2004, 01:31 PM
|
#4
|
LQ Newbie
Registered: Mar 2004
Posts: 2
Original Poster
Rep:
|
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,
|
|
|
10-31-2010, 03:21 PM
|
#5
|
LQ Newbie
Registered: Oct 2010
Posts: 2
Rep:
|
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
|
|
|
11-01-2010, 08:22 AM
|
#6
|
Senior Member
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821
Rep: 
|
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/
|
|
|
All times are GMT -5. The time now is 09:41 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|