About mips-elf-ld (newlib)

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


Hello,all:

I build the GNU toolchain for mips (--target=mips-elf)

Now, i have built the binutils, gcc, newlib.

After building, i try to write a simple C porgram (see below) to test my tools
(mips-elf-gcc)

I encounter some problems.

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
/cygdrive/c/DOCUME~1/libra/LOCALS~1/Temp/ccYfspyO.o(.text+0x3c): In function 
`main':
: undefined reference to `printf'
collect2: ld returned 1 exit status

I try to find out what's going wrong.
I find that it lacks something to produce these errors.

crt0.o ==> warning: cannot find entry symbol _start; defaulting to 
0000000000400040

-lc ==>undefined reference to `printf

When add these two option, the other error message appear.

Anyone have ideas to solve this problem.

Maybe, this is a bug in newlib,or anyone call tell me where i can find the 
maillist for newlib.

                                              thanks a lot!!

C program:

#include <stdio.h>
int main()
{
   int a=1,b=2;
   printf("the result is %d\n",a+b);
   return 0;
}



More information about the Newlib mailing list