Problem with mips toolchain under linux x86
Jeff Johnston
jjohnstn@redhat.com
Tue Aug 1 14:17:00 GMT 2006
Manuel,
You should be configuring for mips-elf.
Once you reconfigure and rebuild, look in the libgloss/mips
directory. There, you'll see a number of .ld scripts representing
different bsp's (board support packages). If one matches your board,
compile as follows:
mips-elf-gcc -Txxx.ld manu.c
where xxx.ld is one of the linker scripts in libgloss/mips.
The .ld script will bring in crt0.o (which provides the missing _start
reference) and it will also bring in the correct libraries to link with.
For example, there is nullmon.ld which has the following note in
Makefile.in.
# nullmon.a , This is what you want if you want crt0 but NO mon services
# Supports GDB sim testing, board bringups, ICE operation.
If none match your board you can try tweaking one of the existing
scripts to meet your needs.
-- Jeff J.
Manuel Barros Reyes wrote:
> Hi, last week I started to investigate about building a toolchain
> with mips as the target. Its for a work we are doing in my university.
> I managed to compile gcc 3.4 and binutils 2.15 with the
> "--target=mips" option without problems and then managed to compile
> newlib for the same target (apparently without any problems). However
> when I try to compile a simple "Hello world!" program in C the
> compiler doesn't link with the libraries. GCC returns with the
> following message:
>
> manu@Jaco:~/src$ mips-gcc manu.c
> /opt/toolchain/bin/../lib/gcc/mips/3.4.3/../../../../mips/bin/ld:
> warning: cannot find entry symbol _start; defaulting to
> 0000000000400040
> /tmp/ccIzcIx2.o(.text+0x14): In function `main':
> : undefined reference to `printf'
> collect2: ld returned 1 exit status
> manu@Jaco:~/src$
>
>
> Please understand that I'm a complete novice in the subject and its
> probable that I'm missing some important detail. What I've done so far
> was with the little bits of information I found around the internet.
> Maybe you also need more details about my current configuration, if so
> just tell me.
>
> Thanks in advance, Manuel.
More information about the Newlib
mailing list