Toolchain

Jeff Johnston jjohnstn@redhat.com
Thu Apr 13 20:17:00 GMT 2006


Niklaus wrote:
> On 4/11/06, Michael Ambrus <ambrmi09@yahoo.com> wrote:
> 
>>Niklaus,
>>try following the instructions over at GNUARM
>>(http://www.gnuarm.org/support.html). I just tried
>>them on my SUSE 9.2 and it builds fine for mips-elf.
>>
>>(Replace all occurrences of arm-elf with mips-elf
>>first  though).
>>
> 
> I tried building newlib  with
> ~/newlib-1.14.0/configure --target=mips-elf --prefix=/home/pro/new/
> 
> But when i compile a c program i get. Actually i can do a mips-elf-gcc
> -c hello.c to get hello.o. Then mips-elf-ld --entry=main hello.o .
> 
> But do we need to use with-sysroot options or somethnig similar so
> that it understands everything and doesn't ask for anything like -I
> and -lc
> 
> 
> pro@deb:~/builde/gcc$ mips-elf-gcc hello.c
> /home/pro/new/bin/../lib/gcc/mips-elf/3.4.6/../../../../mips-elf/bin/ld:
> warning: cannot find entry symbol _start; defaulting to
> 0000000000400040
> /tmp/cc4nAc7V.o: In function `main':
> hello.c:(.text+0x14): undefined reference to `printf'
> collect2: ld returned 1 exit status
> pro@deb:~/builde/gcc$
>

Niklaus,

   GCC compilers differ from platform to platform.  A number of them 
require you specify a linkage script on the compile.  This is due to the 
fact that multiple board configurations exist.  If you look at 
libgloss/mips, you will see that there a number of .ld scripts.  You 
specify them using the gcc -T option.  One of those existing scripts 
might apply to your particular situation and if not, one might be close 
enough for you to modify to your specific board.  Here is an example:

e.g. mips-elf-gcc -Tidt.ld hello.c

   It is highly recommended that you compile and link in a single step. 
  This is because multilib support builds multiple versions of the 
newlib and libgloss libraries with permutated options.  When compiled 
and linked in a single step, gcc knows which subdirectory to fetch 
newlib and libgloss libraries from.  The libraries will have been 
compiled with compatible options.  If you link it yourself with 
mips-elf-ld, you have to manually specify the library path after 
figuring out the correct location.

   For example, if a board can support little-endian and big-endian then 
at least two builds of the library would be done (once with each 
option).  When you compile and link specifying -mlittle-endian, you want 
the link to find the library that was also built with -mlittle-endian.

   If you build gcc and newlib together in a unified source tree, you 
don't have to do anything special when you compile/link.  If newlib is 
built elsewhere, you should install it and add the following to your 
compilation:

   -B<YOUR_NEWLIB_INSTALL_PATH>/mips-elf/lib

The installation directory can be specified when you configure.  I 
usually just specify --prefix=`pwd` when I configure newlib so it 
installs in the build tree and not in the default system directories. 
You can also wait and override when you make install:

   make install exec_prefix=<YOUR_NEWLIB_INSTALL_PATH>

 From the -B directory specification, the gcc multilib options will 
dictate which subdirectory gcc will fetch the linker scripts etc. from.

-- Jeff J.

> 
> 
> 
>>Good luck
>>/Michael Ambrus
>>
>>
>>--- Niklaus <niklaus@gmail.com> wrote:
>>
>>
>>>Hi,
>>> I have built binutils and mips-elf-gcc (bootstrap
>>>without-headers)
>>>with target as mips-elf.
>>> When i build newlib with the mips-elf-gcc i am
>>>getting errors. I
>>>tried building it with normal gcc (i686) it worked.
>>>How do i do build
>>>the newlib for the target mips-elf and how do i use
>>>it along with gcc
>>>to product a mips-elf executable like compiling
>>>hello world.
>>>
>>>It would be great if you can help me in this regard.
>>>
>>>I have found lots of docs on glibc .
>>>
>>>Regards
>>>Nik
>>>
>>
>>
>>__________________________________________________
>>Do You Yahoo!?
>>Tired of spam?  Yahoo! Mail has the best spam protection around
>>http://mail.yahoo.com
>>



More information about the Newlib mailing list