fenv() support broken with GCC 10 on ARM

Sebastian Huber sebastian.huber@embedded-brains.de
Wed Jul 8 17:41:00 GMT 2020


On 08/07/2020 19:26, Sebastian Huber wrote:

> On 08/07/2020 15:00, Sebastian Huber wrote:
>
>> Hello,
>>
>> I get the following linker errors with GCC and the latest Newlib on ARM:
>>
>> /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
>
> Affected are ARM and MIPS:
>
> grep -r 'int __softfloat_float_' .
> newlib/libc/machine/arm/machine/fenv-softfloat.h:int 
> __softfloat_float_exception_flags;
> newlib/libc/machine/arm/machine/fenv-softfloat.h:int 
> __softfloat_float_exception_mask;
> newlib/libc/machine/arm/machine/fenv-softfloat.h:int 
> __softfloat_float_rounding_mode;
> newlib/libc/machine/mips/machine/fenv-softfloat.h:int 
> __softfloat_float_exception_flags;
> newlib/libc/machine/mips/machine/fenv-softfloat.h:int 
> __softfloat_float_exception_mask;
> newlib/libc/machine/mips/machine/fenv-softfloat.h:int 
> __softfloat_float_rounding_mode;
>
> There needs to be a declaration only in the header file and a 
> definition somewhere else. 

No, this is a different issue. These header files are only included in 
source files:

newlib/libm/machine/arm/fenv.c:#include <machine/fenv-softfloat.h>
newlib/libm/machine/mips/fenv.c:#include <machine/fenv-softfloat.h>

On ARM (not in MIPS) this source file is included in two source files:

newlib/libm/machine/arm/fenv-vfp.c:#include "fenv.c"
newlib/libm/machine/arm/fenv-softfp.c:#include "fenv.c"

Does this make sense? I am not sure what the overall logic is supposed 
to be.



More information about the Newlib mailing list