gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > ARM GNU Toolchain and Soft Float Problem

#17310 - bogston - Sat Mar 06, 2004 3:52 am

I am attempting to build the ARM GCC Toolchain. I have found linux.gbadev.org. This site is very helpful. The following tarballs are used:

binutils-2.11.2.tar.gz
gcc-core-3.0.4.tar.gz
newlib-1.11.0.tar.gz
crtls.zip
test.tar.gz

All the versions are listed on linux.gbadev.org. Here's my problem:

I can assemble (the code is rainbow something) and execute using VisualGameBoy. Works fine.

I can not compile the test program listed on linux.gbadev.org. I get the error below. Looks like I have a floating point library problem. My guess is that I need to build gcc or newlib with -msoft-float, but this does not work. Specifically, I seem to need crtbegin.o and crtend.o compiled with -msoft-float, but I have no clue how to do this. Believe me, I have tried everything I can think of. Any suggestions? Thanks.

My compiler output from test.c:

/opt/arm/lib/gcc-lib/arm-thumb-elf/3.0.4/../../../../arm-thumb-elf/bin/ld: Error: __main.o uses hard floating point, whereas test.elf uses soft floating point
File format not recognized: failed to merge target specific data of file /opt/arm/lib/gcc-lib/arm-thumb-elf/3.0.4/libgcc.a(__main.o)

/opt/arm/lib/gcc-lib/arm-thumb-elf/3.0.4/../../../../arm-thumb-elf/bin/ld: Error: unwind-dw2-fde.o uses hard floating point, whereas test.elf uses soft floating point
File format not recognized: failed to merge target specific data of file /opt/arm/lib/gcc-lib/arm-thumb-elf/3.0.4/libgcc.a(unwind-dw2-fde.o)

/opt/arm/lib/gcc-lib/arm-thumb-elf/3.0.4/../../../../arm-thumb-elf/bin/ld: Error: /opt/arm/lib/gcc-lib/arm-thumb-elf/3.0.4/crtend.o uses hard floating point, whereas test.elf uses soft floating point
File format not recognized: failed to merge target specific data of file /opt/arm/lib/gcc-lib/arm-thumb-elf/3.0.4/crtend.o

collect2: ld returned 1 exit status

#17311 - Miked0801 - Sat Mar 06, 2004 4:45 am

The easy answer is don't ever used floats on GBA...

The harder answer is to put the -mSoftFloat or whatever the option is on the CFLAGS define within the make file you are running.

#17326 - Torlus - Sat Mar 06, 2004 12:22 pm

Quick workaround : add --no-warn-mismatch to your linker options.
But remember that you won't be able to use any libc function using floats.

The best solution seems to make you own newlib build, with -msoft-float. Or maybe to make a full build of GCC with soft float by default. It's something I'll have a look at too... Has anyone in this forum done this before ?
_________________
GBA,GC,NGPC,GP32,FPGA,DS stuff at http://torlus.com/

#17336 - bogston - Sat Mar 06, 2004 4:41 pm

>>From Torlus
>>
>>The best solution seems to make you own newlib build, with -msoft-float. Or maybe
>>to make a full build of GCC with soft float by default. It's something I'll have a look
>>at too... Has anyone in this forum done this before ?

This is my thought, too.

I can get newlib built by adding -msoft-float to CFLAGS in the top-most Makefile. Newlib doesn't seem to be the problem. It's gcc.

I can not get gcc to build with -msoft-float added any of the various CFLAGS in the top-most Makefile. GCC build fails about 25% done. I have tried add -msoft-float to the Makefile in the build/gcc/gcc. This lower gcc directory looks like the libc code, but it doesn't work either. Build fails any. It looks like the gcc Makefiles are meant to change by configure.

So, has anyone in this forum done this before? If not, I have an idea on how to do this.

bogston

#17401 - Torlus - Sun Mar 07, 2004 10:46 am

Well you don't need to compile GCC with -msoft-float (harware float on x86 works well :)).
All you have to do is to make your GCC build produce soft float operations by default. Look at that thread :
http://sources.redhat.com/ml/crossgcc/2004-01/msg00173.html
_________________
GBA,GC,NGPC,GP32,FPGA,DS stuff at http://torlus.com/

#17607 - bogston - Thu Mar 11, 2004 1:42 am

I got gcc and newlib to compile with soft-float using the message from sources.redhat.com. Now I got this message:

/opt/arm/lib/gcc-lib/arm-elf/3.3.2/../../../../arm-elf/bin/ld: section .data [02001814 -> 020020bb] overlaps section .fini [02001814 -> 0200182b]
collect2: ld returned 1 exit status

linux.gbadev.org mentions that this message occurs on gcc 3.3.2. I saw this mentioned on Google as well. I need to investigate further. Thanks for the help.