From 955d85aa6707cb4ce67d79508ea51856a9113f80 Mon Sep 17 00:00:00 2001 From: Al Semjonovs Date: Mon, 2 Oct 2023 11:55:05 -0600 Subject: [PATCH] libc: picolibc: Fix picolibc to allow third party CPP Picolibc dependencies limit ability to use third party minimal implementations of CPP when enablng PICOLIBC_USE_MODULE. Signed-off-by: Al Semjonovs --- cmake/linker/ld/target_cpp.cmake | 8 +++++--- lib/cpp/Kconfig | 7 ++++++- lib/libc/Kconfig | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cmake/linker/ld/target_cpp.cmake b/cmake/linker/ld/target_cpp.cmake index 057bb02bc6d..a6601347172 100644 --- a/cmake/linker/ld/target_cpp.cmake +++ b/cmake/linker/ld/target_cpp.cmake @@ -4,8 +4,10 @@ macro(toolchain_ld_cpp) - zephyr_link_libraries( - -lstdc++ - ) + if(NOT CONFIG_EXTERNAL_MODULE_LIBCPP) + zephyr_link_libraries( + -lstdc++ + ) + endif() endmacro() diff --git a/lib/cpp/Kconfig b/lib/cpp/Kconfig index 52084fbe690..696df05102a 100644 --- a/lib/cpp/Kconfig +++ b/lib/cpp/Kconfig @@ -107,7 +107,12 @@ config ARCMWDT_LIBCPP config EXTERNAL_LIBCPP bool "External C++ standard library" help - Build with an external/user-provided C++ standard library. + Build and link with an external/user-provided C++ standard library. + +config EXTERNAL_MODULE_LIBCPP + bool "External C++ standard library module" + help + Build an external/user-provided C++ standard library. endchoice # LIBCPP_IMPLEMENTATION diff --git a/lib/libc/Kconfig b/lib/libc/Kconfig index 7febf1574d4..3bb83af5b1e 100644 --- a/lib/libc/Kconfig +++ b/lib/libc/Kconfig @@ -36,7 +36,7 @@ config PICOLIBC_SUPPORTED bool depends on !NATIVE_APPLICATION depends on ("$(TOOLCHAIN_HAS_PICOLIBC)" = "y") || (NATIVE_LIBRARY) - depends on !(CPP && ("$(TOOLCHAIN_HAS_PICOLIBC)" = "y")) + depends on !REQUIRES_FULL_LIBCPP || ("$(TOOLCHAIN_HAS_PICOLIBC)" = "y") default y select FULL_LIBC_SUPPORTED help