Skip to content

Commit

Permalink
llvm: Add support for LLVM libc++ C++ Standard Library
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
duda-patryk authored and carlescufi committed Oct 20, 2023
1 parent ffb4426 commit ce438da
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmake/linker/lld/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
11 changes: 11 additions & 0 deletions cmake/linker/lld/target_cpp.cmake
Original file line number Diff line number Diff line change
@@ -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()
12 changes: 12 additions & 0 deletions lib/cpp/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit ce438da

Please sign in to comment.