need help with gcc 4.1.0 crosscompiler for arm

Niklaus niklaus@gmail.com
Fri Apr 14 06:18:00 GMT 2006


On 4/14/06, marty fouts <mf.danger@gmail.com> wrote:
> On 4/13/06, Niklaus <niklaus@gmail.com> wrote:
>
> [much snippage]
>
> > > Basically, if I tell arm-elf-gcc which arm processor I'm using, it
> > > recognizes that the processor has no floating point, so arm-elf-ld
> > > fails, as it should, with the messages:
>
> > > sponge:sf 500:arm/bin/arm-elf-gcc -mthumb-interwork -msoft-float
> > > -mcpu=arm926ej-s -c demo.c
> > > if I remove '-mcpu=arm926ej-s' from the compile, then the ld will
> > > work, but i'll end up with floating point instructions on an arm
> > > processor that has no fp.
> > >
>
> > pro@deb:~/armenv/bin$ ./arm-elf-gcc -c foo.c
> > pro@deb:~/armenv/bin$ file foo.o
> > foo.o: ELF 32-bit LSB relocatable, ARM, version 1 (ARM), not stripped
> > pro@deb:~/armenv/bin$ ./arm-elf-ld -o demo.elf foo.o
> > ../lib/gcc/arm-elf/4.1.0/libgcc.a
>
> > Does this help you ? If not ask for more. You can add newlib or glibc
> > after gcc bootstrap.
>
> Thanks very much for taking the time to look at this.  Sorry, but it
> doesn't help. If you leave off the -mcpu=arm96ej-s option, than you
> get an elf binary with floating point.
>

Yeah you are right, i got the same error that you got when doing it
with mcpu=arm96ej-s.

Now i built gcc --with-cpu.see below it seems to work fine.

pro@deb:~/armenv/bin$ cat foo.c
int _start()
{
               double f = 1.23;
                      return f;
}
pro@deb:~/armenv/bin$ ./arm-elf-gcc -v
Using built-in specs.
Target: arm-elf
Configured with: /home/pro/gcc-newlib/configure --target=arm-elf
--prefix=/home/pro/armenv/ --with-cpu=arm926ej-s --with-newlib
--disable-nls --disable-shared --disable-thread --enable-languages=c
--disable-libssp
Thread model: single
gcc version 4.1.0
pro@deb:~/armenv/bin$ ./arm-elf-gcc -msoft-float -mcpu=arm926ej-s -c foo.c
cc1: error: unrecognized command line option "-mcput=arm926ej-s"
pro@deb:~/armenv/bin$ ./arm-elf-gcc -msoft-float -mcpu=arm926ej-s -c foo.c
pro@deb:~/armenv/bin$ ./arm-elf-ld -o demo.elf foo.o
../lib/gcc/arm-elf/4.1.0/libgcc.a
pro@deb:~/armenv/bin$


> What I really need is instructions for building libgcc.a for arm w/o
> any FP instructions in it, and especially, without the FP based
> calling sequences.  In particular, why did this work in 3.4 but not
> 4.1?
I think there are not FP instructions in libgcc.a in this case.
Let me know if you have any problems.
>

Well this also works
pro@deb:~/armenv/bin$ ./arm-elf-gcc -msoft-float -mcpu=arm926ej-s -c foo.c
pro@deb:~/armenv/bin$ ./arm-elf-ld -o demo.elf foo.o ../lib/gcc/arm-elf/4.1.0/
crtbegin.o     crti.o         include/       libgcc.a       thumb/
crtend.o       crtn.o         install-tools/ libgcov.a
pro@deb:~/armenv/bin$ ./arm-elf-ld -o demo.elf foo.o
../lib/gcc/arm-elf/4.1.0/libgcc.a
pro@deb:~/armenv/bin$ ./arm-elf-gcc -v
Using built-in specs.
Target: arm-elf
Configured with: /home/pro/gcc-newlib/configure --target=arm-elf
--prefix=/home/pro/armenv/ --with-cpu=arm926ej-s --with-newlib
--disable-nls --disable-shared --disable-thread --disable-libssp
--enable-languages=c --with-float=soft
Thread model: single
gcc version 4.1.0
pro@deb:~/armenv/bin$ cat foo.c
int _start()
{
               double f = 1.23;
                      return f;
}
pro@deb:~/armenv/bin$



More information about the Gcc-help mailing list