[uClibc] -msoft-float and kernel emulated floats both broken for mipsel, uClibc-0.9.20

David Wuertele dave-gnus at bfnet.com
Sat Aug 9 17:22:59 UTC 2003


I have discovered a difference between -msoft-float and kernel
emulated floats, but they are still *BOTH* wrong.  This time I'm using
uClibc-0.9.20! (still using gcc-3.3)

Here is my new test program:

  #include <stdio.h>
  int main ()
  {
    double thisdub = 0.1;
    if (thisdub != 0.1) { fprintf (stderr, "doubles are hosed!\n"); return 0;  } 
    fprintf (stderr, "if %f and %f don't both equal 0.100000, suspect fprintf\n",thisdub, 0.1);
    unsigned long height1 = 120;
    unsigned long height2 = 1200;
    float scale1 = (float)height1 / (float)height2;
    double scale2 = (double)height1 / (double)height2;
    double height3 = height2 * scale1;
    unsigned long height4 = (unsigned long) height3;
    fprintf (stderr, "if %f and %d aren't close to %d, suspect float operations\n",
             height3, height4, height1);  
    return 0;
  }

Here's what I do on the build host:

  $ build_mipsel/staging_dir/bin/mipsel-uclibc-g++ -mips2 -o test-kernelemu test.cpp
  $ build_mipsel/staging_dir/bin/mipsel-uclibc-g++ -mips2 -o test-kernelemu-static test.cpp -static
  $ build_mipsel/staging_dir/bin/mipsel-uclibc-g++ -mips2 -o test-softfloat test.cpp -msoft-float
  $ build_mipsel/staging_dir/bin/mipsel-uclibc-g++ -mips2 -o test-softfloat-static test.cpp -msoft-float -static
  $ g++ -o test-g++ test.cpp
  $ ./test-g++ 
  if 0.100000 and 0.100000 don't both equal 0.100000, suspect fprintf
  if 120.000002 and 120 aren't close to 120, suspect float operations
  $ 

Here's what I see on the target:

  / # ./test-softfloat
  doubles are hosed!
  / # ./test-softfloat-static
  doubles are hosed!
  / # ./test-kernelemu
  if nan and nan don't both equal 0.100000, suspect fprintf
  if nan and 120 aren't close to 120, suspect float operations
  / # ./test-kernelemu-static
  if nan and nan don't both equal 0.100000, suspect fprintf
  if nan and 120 aren't close to 120, suspect float operations
  / # 

Am I doing something wrong?  How could this go unnoticed?  Here is my
uClibc-0.9.20/.confg file:

#
# Automatically generated make config: don't edit
#

#
# Target Architecture Features and Options
#
HAVE_ELF=y
ARCH_CFLAGS="-mno-split-addresses"
UCLIBC_HAS_MMU=y
UCLIBC_HAS_FLOATS=y
# HAS_FPU is not set
UCLIBC_HAS_SOFT_FLOAT=y
DO_C99_MATH=y
WARNINGS="-Wall"
KERNEL_SOURCE="/home/dave/C/perforce/source/deschutes/buildroot-M14.0-X225/build_mipsel/roku-linux"
C_SYMBOL_PREFIX=""
HAVE_DOT_CONFIG=y

#
# General Library Settings
#
DOPIC=y
HAVE_SHARED=y
ADD_LIBGCC_FUNCTIONS=y
BUILD_UCLIBC_LDSO=y
LDSO_LDD_SUPPORT=y
UCLIBC_CTOR_DTOR=y
# UCLIBC_PROFILING is not set
UCLIBC_HAS_THREADS=y
PTHREADS_DEBUG_SUPPORT=y
UCLIBC_HAS_LFS=y
# MALLOC is not set
MALLOC_930716=y
UCLIBC_DYNAMIC_ATEXIT=y
HAS_SHADOW=y
UCLIBC_HAS_REGEX=y
UNIX98PTY_ONLY=y
ASSUME_DEVPTS=y
UCLIBC_HAS_TM_EXTENSIONS=y

#
# Networking Support
#
# UCLIBC_HAS_IPV6 is not set
UCLIBC_HAS_RPC=y
# UCLIBC_HAS_FULL_RPC is not set

#
# String and Stdio Support
#
UCLIBC_HAS_WCHAR=y
# UCLIBC_HAS_LOCALE is not set
# USE_OLD_VFPRINTF is not set

#
# Library Installation Options
#
SHARED_LIB_LOADER_PATH="/lib"
DEVEL_PREFIX="/home/dave/C/perforce/source/deschutes/buildroot-M14.0-X225/build_mipsel/staging_dir"
SYSTEM_DEVEL_PREFIX="/home/dave/C/perforce/source/deschutes/buildroot-M14.0-X225/build_mipsel/staging_dir"
DEVEL_TOOL_PREFIX="/home/dave/C/perforce/source/deschutes/buildroot-M14.0-X225/build_mipsel/staging_dir/usr"

#
# uClibc hacking options
#
# DODEBUG is not set
# DOASSERTS is not set
# SUPPORT_LD_DEBUG is not set
# SUPPORT_LD_DEBUG_EARLY is not set




More information about the uClibc mailing list