newlib build fails, gcc option -fshort-double no longer supported ?

Asked by Michael Schewe on 2018-05-31

my own build script (used since gcc 5.3.1 20160307 (release) [ARM/embedded-5-branch revision 234589] build from source) fails with error:

make[6]: Verzeichnis „/home/michael/software/src/gcc_cm4/rev4/build/newlib/arm-none-eabi/newlib/libc/argz“ wird betreten
arm-none-eabi-gcc -B/home/michael/software/src/gcc_cm4/rev4/build/newlib/arm-none-eabi/newlib/ -isystem /home/michael/software/src/gcc_cm4/rev4/build/newlib/arm-none-eabi/newlib/targ-include -isystem /home/michael/software/src/gcc_cm4/rev4/src/newlib-2.0.0/newlib/libc/include -B/home/michael/software/src/gcc_cm4/rev4/build/newlib/arm-none-eabi/libgloss/arm -L/home/michael/software/src/gcc_cm4/rev4/build/newlib/arm-none-eabi/libgloss/libnosys -L/home/michael/software/src/gcc_cm4/rev4/src/newlib-2.0.0/libgloss/arm -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"2.0.0\" -DPACKAGE_STRING=\"newlib\ 2.0.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I. -I../../../../../../src/newlib-2.0.0/newlib/libc/argz -Os -D__NO_SYSCALLS__ -fno-builtin -D_IEEE_LIBM -ffunction-sections -fdata-sections -fomit-frame-pointer -fconserve-stack --param large-stack-frame=4 --param large-stack-frame-growth=4 -Os --param case-values-threshold=3 -fno-unwind-tables -fno-exceptions -fshort-double -fsingle-precision-constant -ffast-math -mslow-flash-data -c -o lib_a-dummy.o `test -f 'dummy.c' || echo '../../../../../../src/newlib-2.0.0/newlib/libc/argz/'`dummy.c
arm-none-eabi-gcc: error: unrecognized command line option '-fshort-double'; did you mean '-fshort-enums'?

Is the gcc option -fshort-double no longer supported ? since when and why ?
I cannot find any info about it and an alternative how to build a custom toolchain where all floating point arithmetic (C-types float and double) uses 32bit single precision IEEE format to get full FPU performance for Cortex-M4F ?

Question information

Language:
English Edit question
Status:
Answered
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
2018-05-31
Last reply:
2018-05-31
Tejas Belagod (belagod-tejas) said : #1

-fshort-double was removed as part of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60410.

When it was removed, I don't think we had a use-case to put an equivalent -m option to replace -fshort-enums. None of our multilibs used this option either.

I don't think there is another backend option that equivalent.

David Brown (davidbrown) said : #2

My preference when compiling for microcontrollers with single-precision FPU hardware is to be explicit in the code when I want floats, and when I want doubles. Then I enable the gcc options and warnings that will identify unintentional use of double:

-Wdouble-promotion

Don't forget the explicit maths optimisation flags, needed to get much more efficient results (but losing some IEEE details):

-ffast-math

You may also want

-fsingle-precision-constant

Ideally, you should add "f" suffixes explicitly to single-precision constants. "-Wdouble-promotion" will warn you if you have written something like "float x; x += 1.5;".

Can you help with this problem?

Provide an answer of your own, or ask Michael Schewe for more information if necessary.

To post a message you must log in.