diff --git a/CMakeLists.txt b/CMakeLists.txt index 549c2a4f297..da959c0f521 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -282,7 +282,7 @@ endif() # @Intent: Set compiler specific macro inclusion of AUTOCONF_H zephyr_compile_options("SHELL: $ ${AUTOCONF_H}") -if(NOT CONFIG_PICOLIBC) +if(CONFIG_COMPILER_FREESTANDING) # @Intent: Set compiler specific flag for bare metal freestanding option zephyr_compile_options($<$:$>) zephyr_compile_options($<$:$>) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 8fa4faec87c..827b19a6ce4 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -320,6 +320,15 @@ config NATIVE_APPLICATION Build as a native application that can run on the host and using 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 prompt "Optimization level" default NO_OPTIMIZATIONS if COVERAGE diff --git a/lib/libc/Kconfig b/lib/libc/Kconfig index 4e55388bf27..c33a87e7aaf 100644 --- a/lib/libc/Kconfig +++ b/lib/libc/Kconfig @@ -37,6 +37,7 @@ config MINIMAL_LIBC depends on !NATIVE_APPLICATION depends on !REQUIRES_FULL_LIBC depends on SUPPORT_MINIMAL_LIBC + imply COMPILER_FREESTANDING help Build with minimal C library.