ARM-software / LLVM-embedded-toolchain-for-Arm

A project dedicated to building LLVM toolchain for Arm and AArch64 embedded targets.
Apache License 2.0
419 stars 98 forks source link

[libcxx] Add downstream patch to enable `char8_t` related functions #549

Closed vhscampos closed 1 week ago

vhscampos commented 2 weeks ago

LLVM libcxx does not define the char8_t related functions, instead delegating their definitions to the underlying C library.

libcxx defines a macro called _LIBCPP_HAS_C8RTOMB_MBRTOC8 when it infers that the underlying C library provides these functions.

picolibc provides the char8_t related functions regardless of the C++ version used, but this support only landed after version 1.8.8 and, at the time of writing, has not made into any released version yet.

This is a temporary fix and should be removed when a picolibc release includes the support for char8_t and its related functions. When it's time to implement a proper solution, one needs to create logic to detect the picolibc version and define the macro accordingly. The macros that govern picolibc version are in picolibc.h.