llvm: Add support for LLVM libc++ C++ Standard Library

LLVM toolchain provides its own C++ standard library called libc++.
This patch adds new LLVM_LIBCXX config which should be used to indicate
that libc++ is used.

Information about library can be found at https://libcxx.llvm.org

Signed-off-by: Patryk Duda <pdk@semihalf.com>
This commit is contained in:
Patryk Duda 2023-09-27 16:22:36 +02:00 committed by Carles Cufí
parent ffb4426877
commit ce438da14f
3 changed files with 24 additions and 1 deletions

View file

@ -110,6 +110,6 @@ endfunction(toolchain_ld_link_elf)
# Load toolchain_ld-family macros
include(${ZEPHYR_BASE}/cmake/linker/${LINKER}/target_base.cmake)
include(${ZEPHYR_BASE}/cmake/linker/${LINKER}/target_baremetal.cmake)
include(${ZEPHYR_BASE}/cmake/linker/ld/target_cpp.cmake)
include(${ZEPHYR_BASE}/cmake/linker/${LINKER}/target_cpp.cmake)
include(${ZEPHYR_BASE}/cmake/linker/ld/target_relocation.cmake)
include(${ZEPHYR_BASE}/cmake/linker/ld/target_configure.cmake)

View file

@ -0,0 +1,11 @@
# SPDX-License-Identifier: Apache-2.0
# See root CMakeLists.txt for description and expectations of these macros
macro(toolchain_ld_cpp)
zephyr_link_libraries(
-lc++
)
endmacro()

View file

@ -74,6 +74,7 @@ config FULL_LIBCPP_SUPPORTED
choice LIBCPP_IMPLEMENTATION
prompt "C++ Standard Library Implementation"
default EXTERNAL_LIBCPP if REQUIRES_FULL_LIBCPP && NATIVE_BUILD
default LIBCXX_LIBCPP if REQUIRES_FULL_LIBCPP && "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "llvm"
default GLIBCXX_LIBCPP if REQUIRES_FULL_LIBCPP
default MINIMAL_LIBCPP
@ -96,6 +97,17 @@ config GLIBCXX_LIBCPP
Build with GNU C++ Standard Library (libstdc++) provided by the GNU
Compiler Collection (GCC)-based toolchain.
config LIBCXX_LIBCPP
bool "LLVM C++ Standard Library"
depends on !NATIVE_APPLICATION
depends on NEWLIB_LIBC
depends on "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "llvm"
select FULL_LIBCPP_SUPPORTED
help
Build with LLVM C++ Standard Library (libc++) provided by LLVM
toolchain. Information about library can be found at
https://libcxx.llvm.org
config ARCMWDT_LIBCPP
bool "ARC MWDT C++ Library"
depends on !NATIVE_APPLICATION