gcc/picolibc: Disable -fprintf-return-value when printf is not complete

GCC will compute expected sprintf (et al) return values internally and use
them in place of the actual return value. When the printf implementation
has reduced functionality, gcc may compute a different value.

For picolibc, this means disabling the optimization unless floating point
output is enabled.

Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Keith Packard 2022-10-13 15:04:00 -07:00 committed by Stephanos Ioannidis
commit b3073f0099
3 changed files with 9 additions and 0 deletions

View file

@ -111,6 +111,8 @@ if (NOT CONFIG_NEWLIB_LIBC AND
set_compiler_property(APPEND PROPERTY nostdinc_include ${NOSTDINC})
endif()
set_compiler_property(PROPERTY no_printf_return_value -fno-printf-return-value)
set_compiler_property(TARGET compiler-cpp PROPERTY nostdincxx "-nostdinc++")
# Required C++ flags when using gcc