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:
parent
cb5c440525
commit
b3073f0099
3 changed files with 9 additions and 0 deletions
|
@ -275,6 +275,11 @@ if(NOT CONFIG_PICOLIBC)
|
||||||
zephyr_compile_options($<$<COMPILE_LANGUAGE:ASM>:$<TARGET_PROPERTY:compiler,freestanding>>)
|
zephyr_compile_options($<$<COMPILE_LANGUAGE:ASM>:$<TARGET_PROPERTY:compiler,freestanding>>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (CONFIG_PICOLIBC AND NOT CONFIG_PICOLIBC_IO_FLOAT)
|
||||||
|
# @Intent: Set compiler specific flag to disable printf-related optimizations
|
||||||
|
zephyr_compile_options($<$<COMPILE_LANGUAGE:C>:$<TARGET_PROPERTY:compiler,no_printf_return_value>>)
|
||||||
|
endif()
|
||||||
|
|
||||||
# @Intent: Set compiler specific flag for tentative definitions, no-common
|
# @Intent: Set compiler specific flag for tentative definitions, no-common
|
||||||
zephyr_compile_options($<TARGET_PROPERTY:compiler,no_common>)
|
zephyr_compile_options($<TARGET_PROPERTY:compiler,no_common>)
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,8 @@ set_property(TARGET compiler-cpp PROPERTY no_exceptions)
|
||||||
# Flag for disabling rtti in C++
|
# Flag for disabling rtti in C++
|
||||||
set_property(TARGET compiler-cpp PROPERTY no_rtti)
|
set_property(TARGET compiler-cpp PROPERTY no_rtti)
|
||||||
|
|
||||||
|
# Flag for disabling optimizations around printf return value
|
||||||
|
set_compiler_property(PROPERTY no_printf_return_value)
|
||||||
|
|
||||||
###################################################
|
###################################################
|
||||||
# This section covers all remaining C / C++ flags #
|
# This section covers all remaining C / C++ flags #
|
||||||
|
|
|
@ -111,6 +111,8 @@ if (NOT CONFIG_NEWLIB_LIBC AND
|
||||||
set_compiler_property(APPEND PROPERTY nostdinc_include ${NOSTDINC})
|
set_compiler_property(APPEND PROPERTY nostdinc_include ${NOSTDINC})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set_compiler_property(PROPERTY no_printf_return_value -fno-printf-return-value)
|
||||||
|
|
||||||
set_compiler_property(TARGET compiler-cpp PROPERTY nostdincxx "-nostdinc++")
|
set_compiler_property(TARGET compiler-cpp PROPERTY nostdincxx "-nostdinc++")
|
||||||
|
|
||||||
# Required C++ flags when using gcc
|
# Required C++ flags when using gcc
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue