Search code examples
floating-pointarmembeddedelftoolchain

How to build soft-float newlib in cygwin?


I can't change default value of -mfloat-abi from hard to soft for newlib.

Here is how did I configure bintutils

 ../configure --target=$ARMTARGET --prefix=$TOOLPATH 
 --enable-interwork --enable-multilib --with-gnu-as 
 --with-gnu-ld --disable-nls --disable-werror --with-float=soft
 --enable-soft-float

gcc

 ../configure --target=$ARMTARGET --prefix=$TOOLPATH
 --enable-interwork --enable-multilib --enable-languages="c,c++"
 --with-newlib --without-headers --disable-shared
 --with-gnu-as --with-gnu-ld --with-float=soft  --enable-soft-float 
 --disable-nls --with-gmp=$TOOLPATH --with-mpfr=$TOOLPATH
 --with-mpc=$TOOLPATH --enable-obsolete

and newlib

 ../configure --target=$ARMTARGET --prefix=$TOOLPATH 
  --enable-interwork --disable-newlib-supplied-syscalls
  --with-gnu-ld --with-gnu-as --disable-shared
  --with-float=soft --enable-soft-float --disable-nls 
  --enable-newlib-io-long-long --enable-newlib-io-long-double 
  --enable-newlib-io-c99-formats

Error log

 ..........
arm-softfloat-elf-gcc -B/home/Shadmanov_D/newlib-1.20.0/build/arm-softfloat-      elf/fpu/newlib/ 
-isystem /home/Shadmanov_D/newlib-1.20.0/build/arm-softfloat-elf/fpu/newlib/targ-include -isystem /home/Shadmanov_D/newlib-1.20.0/newlib/libc/include
-B/home/Shadmanov_D/newlib-1.20.0/build/arm-softfloat-elf/fpu/libgloss/arm
-L/home/Shadmanov_D/newlib-1.20.0/build/arm-softfloat-elf/fpu/libgloss/libnosys -L/home/Shadmanov_D/newlib-1.20.0/libgloss/arm 
-mfloat-abi=hard -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"1.20.0\" -DPACKAGE_STRING=\"newlib\ 1.20.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I. 
-I../../../../../../newlib/libc/argz -D__NO_SYSCALLS__ 
-fno-builtin      -g -O2  -mfloat-abi=hard -c -o lib_a-dummy.o 
`test -f 'dummy.c' || echo '../../../../../../newlib/libc/argz/'`dummy.c    

Assembler messages:

Error: hard-float conflicts with specified fpu

Any help appreciated!!


Solution

  • Check the multilib configuration file for arm-elf targets, which is located at ${GCC_SRC_DIR}/gcc/config/arm/t-arm-elf

    Change the following lines (they start on line 56 on the GCC version I have, 4.6.4):

    MULTILIB_OPTIONS       += mfloat-abi=hard
    MULTILIB_DIRNAMES      += fpu
    MULTILIB_EXCEPTIONS    += *mthumb/*mfloat-abi=hard*
    

    to:

    MULTILIB_OPTIONS       += mfloat-abi=soft
    MULTILIB_DIRNAMES      += soft
    

    After the change, reconfigure and recompile gcc.

    If this procedure doesn't fix the issue, please provide

    • GCC version you're using
    • Your t-arm-elf file
    • The output of the command arm-softfloat-elf-gcc -print-multi-lib