This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: About mips-elf-ld (newlib)
- From: libra <mr924352 at cs dot nthu dot edu dot tw>
- To: newlib at sources dot redhat dot com
- Date: Thu, 8 Jul 2004 10:36:21 +0800
- Subject: Re: About mips-elf-ld (newlib)
>From your reply, i think that maybe when i build the newlib , i use the wrong
options.
Therefore, i list my step: (i use the GNU toolchain that is binutils gcc
newlib gdb)
After building the binutils and gcc, i start to build newlib.The following is
my step for buinding newlib.
1. newlib-1.12/configure --target=mips-elf \
--prefix=/tools/mips \
--exec-prefix=/tools/mips/H-i686-pc-cygwin \
-v 2>&1 | tee configure.out
2. make -w all install 2>&1 | tee make.out
I will use the gdb(--target-mips-elf) for my target debugger(simulator).
After compiling successfully, i use the command like this "mips-elf-gcc -v t.c"
then the following is the process of compiling message:
[/cygdrive/c/cygwin/tmp/mips/newlib] mips-elf-gcc -v t.c
Reading specs from /tools/mips/H-i686-pc-cygwin/lib/gcc/mips-elf/3.5.0/specs
Configured with: /src/gcc/gcc-3.5/configure --target=mips-elf --
prefix=/tools/mips --exec-prefix=/tools/mip
s/H-i686-pc-cygwin -with-gnu-as --with-gnu-ld -v
Thread model: single
gcc version 3.5.0 20040704 (experimental)
/tools/mips/H-i686-pc-cygwin/libexec/gcc/mips-elf/3.5.0/cc1.exe -quiet -v
t.c -quiet -dumpbase t.c -auxbas
e t -version -o /cygdrive/c/DOCUME~1/libra/LOCALS~1/Temp/cc1DzCnE.s
ignoring nonexistent directory "/tools/mips/H-i686-pc-cygwin/lib/gcc/mips-
elf/3.5.0/../../../../mips-elf/sy
s-include"
#include "..." search starts here:
#include <...> search starts here:
/tools/mips/H-i686-pc-cygwin/lib/gcc/mips-elf/3.5.0/include
/tools/mips/H-i686-pc-cygwin/lib/gcc/mips-elf/3.5.0/../../../../mips-
elf/include
End of search list.
GNU C version 3.5.0 20040704 (experimental) (mips-elf)
compiled by GNU C version 3.3.1 (cygming special).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
/tools/mips/H-i686-pc-cygwin/lib/gcc/mips-elf/3.5.0/../../../../mips-
elf/bin/as.exe -EB -no-mdebug -32 -v
-
o /cygdrive/c/DOCUME~1/libra/LOCALS~1/Temp/ccvV2BiR.o /cygdrive/c/DOCUME~1/libr
a/LOCALS~1/Temp/cc1DzCnE.s
GNU assembler version 2.14 (mips-elf) using BFD version 2.14 20030612
/tools/mips/H-i686-pc-cygwin/libexec/gcc/mips-elf/3.5.0/collect2.exe -
EB /tools/mips/H-i686-pc-cygwin/lib/
gcc/mips-elf/3.5.0/crti.o /tools/mips/H-i686-pc-cygwin/lib/gcc/mips-
elf/3.5.0/crtbegin.o -L/tools/mips/H-i6
86-pc-cygwin/lib/gcc/mips-elf/3.5.0 -L/tools/mips/H-i686-pc-
cygwin/lib/gcc/mips-elf/3.5.0/../../../../mips-
elf/lib /cygdrive/c/DOCUME~1/libra/LOCALS~1/Temp/ccvV2BiR.o -lgcc -
lgcc /tools/mips/H-i686-pc-cygwin/lib/gc
c/mips-elf/3.5.0/crtend.o /tools/mips/H-i686-pc-cygwin/lib/gcc/mips-
elf/3.5.0/crtn.o
/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/ccvV2BiR.o(.text+0x3c): In function
`main':
: undefined reference to `printf'
collect2: ld returned 1 exit status
>From the above message, we can find that it lacks crt0.o and -lc options,so it
produce the error message.
Anyone can give ideas for me..
thanks a lot!!
----- Original Message -----
From: "Jeff Johnston" <jjohnstn@redhat.com>
To: "libra" <mr924352@cs.nthu.edu.tw>
Cc: <newlib@sources.redhat.com>
Sent: Thursday, July 08, 2004 12:07 AM
Subject: Re: About mips-elf-ld (newlib)
> libra wrote:
> > 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-
> > elf).
> > 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.
> >
>
> The gcc compiler does not operate the same for every platform. In some cases
> gcc adds linking info under the covers. In other cases, you have to manually
> specify an ld script. If you look in libgloss/mips you will see a number
of .ld
> scripts. Pick the one appropriate for your board and add -Txxxx.ld to your
> compile/link statement (where xxxx.ld is the ld script you chose). If none
of
> the .ld scripts are appropriate, you will have to copy the closest one and
make
> whatever modifications are needed.
>
> > Maybe, i build the mips toolchain with wrong method (especially newlib
part).
> > Therefore, i get the wrong result.
> >
>
> Just make sure you built libgloss as well. If you built all, you are fine.
If
> you just specified all-target-newlib install-target-newlib, then you need to
add
> all-target-libgloss install-target-libgloss
>
> > 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 !!
> >
> >
> >