Re: fenv() support broken with GCC 10 on ARM

Sebastian Huber <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On 09/07/2020 19:16, Eshan Dhawan wrote:

> Hi Sebastian,
> Could you please tell the steps to recreate the error :)

You have to build a GCC 10 for ARM. For example using the latest RTEMS 
Source Builder:

arm-rtems6-gcc --version
arm-rtems6-gcc (GCC) 10.1.1 20200703 (RTEMS 6, RSB 
5ab61d2e8c7ced8c685541509a7ac4eba704e69e, Newlib f095752)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Then compile the following test program:

#include <fenv.h>

int main()
{
     return fesetenv( FE_DFL_ENV );
}

arm-rtems6-gcc init.c -mthumb -mcpu=cortex-m3 -lm -Wl,-Map,map.txt
/build/rtems/6/lib/gcc/arm-rtems6/10.1.1/../../../../arm-rtems6/bin/ld: 
/build/rtems/6/lib/gcc/arm-rtems6/10.1.1/../../../../arm-rtems6/lib/thumb/cortex-m3/libm.a(lib_a-fenv-vfp.o):/scratch/git-rtems-source-builder/rtems/build/arm-rtems6-gcc-50666d2-newlib-f095752-x86_64-linux-gnu-1/build/arm-rtems6/thumb/cortex-m3/newlib/targ-include/machine/fenv-softfloat.h:61: 
multiple definition of `__softfloat_float_rounding_mode'; 
/build/rtems/6/lib/gcc/arm-rtems6/10.1.1/../../../../arm-rtems6/lib/thumb/cortex-m3/libm.a(lib_a-fenv-softfp.o):/scratch/git-rtems-source-builder/rtems/build/arm-rtems6-gcc-50666d2-newlib-f095752-x86_64-linux-gnu-1/build/arm-rtems6/thumb/cortex-m3/newlib/targ-include/machine/fenv-softfloat.h:61: 
first defined here
/build/rtems/6/lib/gcc/arm-rtems6/10.1.1/../../../../arm-rtems6/bin/ld: 
/build/rtems/6/lib/gcc/arm-rtems6/10.1.1/../../../../arm-rtems6/lib/thumb/cortex-m3/libm.a(lib_a-fenv-vfp.o):/scratch/git-rtems-source-builder/rtems/build/arm-rtems6-gcc-50666d2-newlib-f095752-x86_64-linux-gnu-1/build/arm-rtems6/thumb/cortex-m3/newlib/targ-include/machine/fenv-softfloat.h:60: 
multiple definition of `__softfloat_float_exception_mask'; 
/build/rtems/6/lib/gcc/arm-rtems6/10.1.1/../../../../arm-rtems6/lib/thumb/cortex-m3/libm.a(lib_a-fenv-softfp.o):/scratch/git-rtems-source-builder/rtems/build/arm-rtems6-gcc-50666d2-newlib-f095752-x86_64-linux-gnu-1/build/arm-rtems6/thumb/cortex-m3/newlib/targ-include/machine/fenv-softfloat.h:60: 
first defined here
/build/rtems/6/lib/gcc/arm-rtems6/10.1.1/../../../../arm-rtems6/bin/ld: 
/build/rtems/6/lib/gcc/arm-rtems6/10.1.1/../../../../arm-rtems6/lib/thumb/cortex-m3/libm.a(lib_a-fenv-vfp.o):/scratch/git-rtems-source-builder/rtems/build/arm-rtems6-gcc-50666d2-newlib-f095752-x86_64-linux-gnu-1/build/arm-rtems6/thumb/cortex-m3/newlib/targ-include/machine/fenv-softfloat.h:59: 
multiple definition of `__softfloat_float_exception_flags'; 
/build/rtems/6/lib/gcc/arm-rtems6/10.1.1/../../../../arm-rtems6/lib/thumb/cortex-m3/libm.a(lib_a-fenv-softfp.o):/scratch/git-rtems-source-builder/rtems/build/arm-rtems6-gcc-50666d2-newlib-f095752-x86_64-linux-gnu-1/build/arm-rtems6/thumb/cortex-m3/newlib/targ-include/machine/fenv-softfloat.h:59: 
first defined here
/build/rtems/6/lib/gcc/arm-rtems6/10.1.1/../../../../arm-rtems6/bin/ld: 
warning: cannot find entry symbol _start; defaulting to 0000000000008000

In the linker map file you will find this dependency chain:

/build/rtems/6/lib/gcc/arm-rtems6/10.1.1/../../../../arm-rtems6/lib/thumb/cortex-m3/libm.a(lib_a-fenv.o)
                               /tmp/cclZauID.o (fesetenv)
/build/rtems/6/lib/gcc/arm-rtems6/10.1.1/../../../../arm-rtems6/lib/thumb/cortex-m3/libm.a(lib_a-fenv-softfp.o)
/build/rtems/6/lib/gcc/arm-rtems6/10.1.1/../../../../arm-rtems6/lib/thumb/cortex-m3/libm.a(lib_a-fenv.o) 
(__softfp_feclearexcept)
/build/rtems/6/lib/gcc/arm-rtems6/10.1.1/../../../../arm-rtems6/lib/thumb/cortex-m3/libm.a(lib_a-fenv-vfp.o)
/build/rtems/6/lib/gcc/arm-rtems6/10.1.1/../../../../arm-rtems6/lib/thumb/cortex-m3/libm.a(lib_a-fenv.o) 
(__vfp_feclearexcept)

You have the following symbols:

nm 
/build/rtems/6/lib/gcc/arm-rtems6/10.1.1/../../../../arm-rtems6/lib/thumb/cortex-m3/libm.a 
--defined-only | grep -C 3 __soft
lib_a-feholdexcept.o:

lib_a-fenv-softfp.o:
00000000 B __softfloat_float_exception_flags
00000000 B __softfloat_float_exception_mask
00000000 B __softfloat_float_rounding_mode
00000000 T __softfp_feclearexcept
00000000 T __softfp_fedisableexcept
00000000 T __softfp_feenableexcept
00000000 T __softfp_fegetenv
00000000 T __softfp_fegetexcept
00000000 T __softfp_fegetexceptflag
00000000 T __softfp_fegetround
00000000 T __softfp_feholdexcept
00000000 T __softfp_feraiseexcept
00000000 T __softfp_fesetenv
00000000 T __softfp_fesetexceptflag
00000000 T __softfp_fesetround
00000000 T __softfp_fetestexcept
00000000 T __softfp_feupdateenv

lib_a-fenv-vfp.o:
00000000 B __softfloat_float_exception_flags
00000000 B __softfloat_float_exception_mask
00000000 B __softfloat_float_rounding_mode
00000000 T __vfp_feclearexcept
00000000 T __vfp_fedisableexcept
00000000 T __vfp_feenableexcept
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.