toolchain: Add COMPILER_FREESTANDING to control use of -ffreestanding
Add an explicit compiler configuration, COMPILER_FREESTANDING, which controls whether the compiler should operate in freestanding or hosted mode (according to the C and C++ language specifications. This depends on having a C library which conforms with the language specification, and the minimal C library does not. Have the minimal C library select COMPILER_FREESTANDING to continue using freestanding mode with that library. For other C libraries, leave this disabled by default while allowing users to enable it if they want to go back to the previous configuration. Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
e9ee6388f6
commit
6c5d806bcb
|
@ -282,7 +282,7 @@ endif()
|
||||||
# @Intent: Set compiler specific macro inclusion of AUTOCONF_H
|
# @Intent: Set compiler specific macro inclusion of AUTOCONF_H
|
||||||
zephyr_compile_options("SHELL: $<TARGET_PROPERTY:compiler,imacros> ${AUTOCONF_H}")
|
zephyr_compile_options("SHELL: $<TARGET_PROPERTY:compiler,imacros> ${AUTOCONF_H}")
|
||||||
|
|
||||||
if(NOT CONFIG_PICOLIBC)
|
if(CONFIG_COMPILER_FREESTANDING)
|
||||||
# @Intent: Set compiler specific flag for bare metal freestanding option
|
# @Intent: Set compiler specific flag for bare metal freestanding option
|
||||||
zephyr_compile_options($<$<COMPILE_LANGUAGE:C>:$<TARGET_PROPERTY:compiler,freestanding>>)
|
zephyr_compile_options($<$<COMPILE_LANGUAGE:C>:$<TARGET_PROPERTY:compiler,freestanding>>)
|
||||||
zephyr_compile_options($<$<COMPILE_LANGUAGE:ASM>:$<TARGET_PROPERTY:compiler,freestanding>>)
|
zephyr_compile_options($<$<COMPILE_LANGUAGE:ASM>:$<TARGET_PROPERTY:compiler,freestanding>>)
|
||||||
|
|
|
@ -320,6 +320,15 @@ config NATIVE_APPLICATION
|
||||||
Build as a native application that can run on the host and using
|
Build as a native application that can run on the host and using
|
||||||
resources and libraries provided by the host.
|
resources and libraries provided by the host.
|
||||||
|
|
||||||
|
config COMPILER_FREESTANDING
|
||||||
|
bool "Build in a freestanding compiler mode"
|
||||||
|
help
|
||||||
|
Configure the compiler to operate in freestanding mode according to
|
||||||
|
the C and C++ language specifications. Freestanding mode reduces the
|
||||||
|
requirements of the compiler and language environment, which can
|
||||||
|
negatively impact the ability for the compiler to detect errors and
|
||||||
|
perform optimizations.
|
||||||
|
|
||||||
choice COMPILER_OPTIMIZATIONS
|
choice COMPILER_OPTIMIZATIONS
|
||||||
prompt "Optimization level"
|
prompt "Optimization level"
|
||||||
default NO_OPTIMIZATIONS if COVERAGE
|
default NO_OPTIMIZATIONS if COVERAGE
|
||||||
|
|
|
@ -37,6 +37,7 @@ config MINIMAL_LIBC
|
||||||
depends on !NATIVE_APPLICATION
|
depends on !NATIVE_APPLICATION
|
||||||
depends on !REQUIRES_FULL_LIBC
|
depends on !REQUIRES_FULL_LIBC
|
||||||
depends on SUPPORT_MINIMAL_LIBC
|
depends on SUPPORT_MINIMAL_LIBC
|
||||||
|
imply COMPILER_FREESTANDING
|
||||||
help
|
help
|
||||||
Build with minimal C library.
|
Build with minimal C library.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue