MIPS Cross Compiler
Sun Oct 14 13:42:00 GMT 2001
> -----Original Message-----
> From: email@example.com
> [ mailto:firstname.lastname@example.org]On Behalf Of Ken Rose
> Sent: 13 October 2001 00:24
> To: email@example.com
> Cc: firstname.lastname@example.org; Matt Welsford
> Subject: RE: MIPS Cross Compiler
> On 12-Oct-01, Matt Welsford wrote:
> >Using the following invocation of the compiler:
> > $ mips-elf-gcc main.c crt0.S -nostdlib -I../include
> >I get the following error:
> >/cygdrive/c/WINNT/TEMP/ccEsdqTG.o: In function `main':
> >main.c(.text+0xc): undefined reference to `__main'
> It's the -nostdlib that's getting you. __main is defined in libgcc.a, and
> --nostdlib tells the compiler to omit that from the link.
> Depending on the
> target, __main will run constructors and the like.
> Hope that helps,
> - ken
Yip, that did help!
The reason I was using -nostdlib was so that I could reduce the number of
errors I was getting. My first thought was that newlib had not built
correctly so I was trying to eliminate all possible sources of problems.
With your advice I see now that that opens a whole new can of worms. In the
end, after a lot of tears, I found that with mips-gcc and the standard cross
build, you need to override the default linker script with one of the debug
stub monitor scripts, (-T). As I'm not using a remote debug stub, I chose
the nullmon.ld script and Bob's your auntie my code compiled!
I am still to check the executable is valid!
Thanks for your help...
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to email@example.com
More information about the crossgcc