zephyr/lib/libc
Keith Packard 13dfbaebd1 libc/picolibc: Clean up Picolibc Kconfig for C++
libstdc++ is supported with Picolibc only when the toolchain version of
Picolibc is use -- libstdc++ must be built using a specific Picolibc build
and libstdc++ is included with the toolchain.

Ideally, we'd allow the use of the Picolibc module whenever we weren't
using the GNU libstdc++, including when using the minimal libc++. However,
the obvious dependency settings create a loop:

config PICOLIBC
    depends on PICOLIBC_SUPPORTED

config PICOLIBC_SUPPORTED
    depends on !(GLIBCXX_LIBCPP && "$(ZEPHYR_TOOCHAIN_VARIANT" = "zephyr")

config GLIBCXX_LIBCPP
    depends on NEWLIB_LIBC || PICOLIBC

To break this loop, we replace GLIBCXX_LIBCPP in the second block with
CPP:

config PICOLIBC_SUPPORTED
    depends on !(CPP && "$(ZEPHYR_TOOCHAIN_VARIANT" = "zephyr")

This means that picolibc cannot be used with any C++ apps when using the
Zephyr SDK, even when not using the GNU libstdc++. However, Zephyr SDK 0.16
will come with an additional Kconfig file that includes:

config PICOLIBC_SUPPORTED
    def_bool y
    depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "zephyr"

This will override the Kconfig bits included in Zephyr and allow use of the
Picolibc module with C++ code, including using the minimal libc++ bits.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-01-20 09:03:25 +01:00
..
arcmwdt lib: migrate includes to <zephyr/...> 2022-05-06 19:58:09 +02:00
armstdc lib: migrate includes to <zephyr/...> 2022-05-06 19:58:09 +02:00
minimal libc: minimal: stdio.h: define SEEK_SET, SEEK_CUR, SEEK_END 2023-01-10 09:02:21 +09:00
newlib libc: minimal: include: move sys/stat.h to posix 2023-01-10 09:02:21 +09:00
picolibc libc/picolibc: Clean up Picolibc Kconfig for C++ 2023-01-20 09:03:25 +01:00
CMakeLists.txt lib: libc: Clean up CMake script to use add_subdirectory_ifdef 2022-12-08 15:09:55 -05:00
Kconfig libc/picolibc: Clean up Picolibc Kconfig for C++ 2023-01-20 09:03:25 +01:00