About mips-elf-ld (newlib)

libra mr924352@cs.nthu.edu.tw
Wed Jul 7 16:07:00 GMT 2004

At first, thanks for your reply.

1. I do not write my own crt0.c
2. I compile my program by "mips-elf-gcc t.c"
   then i get the following error message:
   warning: cannot find entry symbol _start and
   undefined reference to `printf'

I have an experience that to build arm toolchain successfully (--target=arm-
I use the same method to build the mips toolchain (--target=mips-elf).

I can use the mips-elf-gcc option "-v" to see which file(object) do it links 
for mips executable file.

>From the information, i compare it with arm gcc (arm-elf-gcc -v t.c),
i find that it lacks to link crt0.o and -lc option.
So, i get the above error message.

Maybe, i build the mips toolchain with wrong method (especially newlib part).
Therefore, i get the wrong result.

Anyone has the experience to build the mips toolchain (--target=mips-elf) 
(binutils gcc newlib gdb)successfully can get me some ideas!!

                                                   thanks a lot !!

----- Original Message ----- 
From: "Alexander Stante" <mrpac@gmx.de>
To: "libra" <mr924352@cs.nthu.edu.tw>
Cc: <newlib@sources.redhat.com>
Sent: Wednesday, July 07, 2004 5:33 PM
Subject: Re: About mips-elf-ld (newlib)

> libra wrote:
> > The error message is that:
> > /tools/mips/H-i686-pc-cygwin/lib/gcc/mips-elf/3.5.0/../../../../mips-
> > elf/bin/ld: warning: cannot find entry symbol _start; defaulting to 
> > 0000000000400040
> Did you wrote your own crt0? Check if there is the entry point _start in
> it. You can also change the entry point in your linkskript with
> ENTRY(_MyEntryPoint)
> > /cygdrive/c/DOCUME~1/libra/LOCALS~1/Temp/ccYfspyO.o(.text+0x3c): In 
> > `main':
> > : undefined reference to `printf'
> > collect2: ld returned 1 exit status
> It is a bit hard to tell what cause this problem because you didn't
> supplied the command line with which you compiled you program. You used
> the -lc switch to use libc but maybe at the wrong position. Try using it
> at last argument.
> Bye
> Alex

More information about the Newlib mailing list