This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: __main undefined symbol


Matthew Majka writes:
 > I was under the impression that the only reason that a file named crt0.o
 > was only needed because it was specified in one of the default linker
 > scripts installed with the compiler and using a different startup/boot
 > file was simply a matter of writing your own linker script.  Can someone
 > confirm this for me?

Close.  For many ports crt0 is passed to ld from gcc on the command line.
By that I mean gcc passes crt0 to linker as an argument, it appears
in ld's argv[].  That doesn't mean the _user_ has to specify crt0 when
invoking gcc.

"gcc -v" can reveal a plethora of information on what gcc is doing.
Try it on your target and see how it is invoking ld.
[Add -v to what you normally pass to gcc.]

So if you wanted to specify crt0 in a linker script you'd also
have to pass -nostartfiles.  You may instead want to specify -nostdlib,
it omits crt0.o as well as all standard libraries, usually libc and
libgcc.  And, just for fun, if you want to omit libc and libgcc but
keep crt0 then you would use -nodefaultlibs.  Blech.

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]