libcxx: optional localization.

Signed-off-by: jihandong <jihandong@xiaomi.com>
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
This commit is contained in:
jihandong 2024-07-12 17:31:45 +08:00 committed by Xiang Xiao
parent 100c43c8c3
commit 444ba4caa4
23 changed files with 89 additions and 4 deletions

View File

@ -24,6 +24,8 @@ CONFIG_ARMV7A_WAYSIZE_64KB=y
CONFIG_BOARD_LOOPSPERMSEC=99369
CONFIG_BOOT_RUNFROMSDRAM=y
CONFIG_BUILTIN=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEFAULT_TASK_STACKSIZE=4096
CONFIG_DEV_ZERO=y
@ -37,6 +39,7 @@ CONFIG_IMX_DDR_SIZE=1073741824
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_MAX_EXITFUNS=1
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y

View File

@ -15,6 +15,8 @@ CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=20000
CONFIG_BUILTIN=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_IDLETHREAD_STACKSIZE=2048
@ -22,6 +24,7 @@ CONFIG_IMXRT_LPUART1=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_LOCALTIME=y
CONFIG_LIBM=y
CONFIG_LPUART1_SERIAL_CONSOLE=y

View File

@ -15,6 +15,8 @@ CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=20000
CONFIG_BUILTIN=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_IDLETHREAD_STACKSIZE=2048
@ -22,6 +24,7 @@ CONFIG_IMXRT_LPUART1=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_LOCALTIME=y
CONFIG_LIBM=y
CONFIG_LPUART1_SERIAL_CONSOLE=y

View File

@ -15,6 +15,8 @@ CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=20000
CONFIG_BUILTIN=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_IDLETHREAD_STACKSIZE=2048
@ -22,6 +24,7 @@ CONFIG_IMXRT_LPUART1=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_LOCALTIME=y
CONFIG_LIBM=y
CONFIG_LPUART1_SERIAL_CONSOLE=y

View File

@ -15,6 +15,8 @@ CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=20000
CONFIG_BUILTIN=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_IDLETHREAD_STACKSIZE=2048
@ -22,6 +24,7 @@ CONFIG_IMXRT_LPUART1=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_LOCALTIME=y
CONFIG_LIBM=y
CONFIG_LPUART1_SERIAL_CONSOLE=y

View File

@ -24,7 +24,9 @@ CONFIG_ARM_MPU=y
CONFIG_BOARD_LOOPSPERMSEC=159972
CONFIG_BUILTIN=y
CONFIG_CXX_EXCEPTION=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_RTTI=y
CONFIG_CXX_WCHAR=y
CONFIG_EXAMPLES_BUTTONS=y
CONFIG_EXAMPLES_HELLOXX=y
CONFIG_EXAMPLES_INA219=y
@ -40,6 +42,7 @@ CONFIG_INPUT=y
CONFIG_INPUT_BUTTONS_LOWER=y
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBC_LOCALE=y
CONFIG_MX8MP_I2C4=y
CONFIG_MX8MP_I2C=y
CONFIG_MX8MP_UART4=y

View File

@ -15,14 +15,16 @@ CONFIG_ARCH_CHIP_STM32F407VG=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_DISABLE_MOUNTPOINT=y
CONFIG_EXAMPLES_HELLOXX=y
CONFIG_HAVE_CXX=y
CONFIG_HOST_WINDOWS=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBC_FLOATINGPOINT=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_LOCALTIME=y
CONFIG_LIBC_MAX_EXITFUNS=4
CONFIG_LIBM=y

View File

@ -34,6 +34,8 @@ CONFIG_BL602_TIMER0=y
CONFIG_BOARDCTL_ROMDISK=y
CONFIG_BOARD_LOOPSPERMSEC=10000
CONFIG_BUILTIN=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
@ -55,6 +57,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=8192
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_LIBM=y

View File

@ -19,6 +19,8 @@ CONFIG_ARCH_RISCV=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=15000
CONFIG_BUILTIN=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_DEV_ZERO=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
@ -26,6 +28,7 @@ CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_MAX_EXITFUNS=1
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y

View File

@ -40,6 +40,8 @@ CONFIG_ARCH_USE_S_MODE=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=54000
CONFIG_BUILD_KERNEL=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_FULLOPT=y
@ -60,6 +62,7 @@ CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_HOSTNAME="icicle"
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_MAX_EXITFUNS=16
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y

View File

@ -39,6 +39,8 @@ CONFIG_CM_MM_TEST=y
CONFIG_CM_PTHREAD_TEST=y
CONFIG_CM_SCHED_TEST=y
CONFIG_CM_TIME_TEST=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_FULLOPT=y
@ -74,6 +76,7 @@ CONFIG_IOB_NCHAINS=4
CONFIG_LIBCXX=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_LOCALE_CATALOG=y
CONFIG_LIBC_LOCALTIME=y
CONFIG_LIBC_MAX_EXITFUNS=32

View File

@ -28,6 +28,8 @@ CONFIG_ARCH_RISCV=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=6366
CONFIG_BUILTIN=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEV_ZERO=y
@ -42,6 +44,7 @@ CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_LIBM=y

View File

@ -28,6 +28,8 @@ CONFIG_ARCH_RISCV=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=6366
CONFIG_BUILTIN=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEV_ZERO=y
@ -42,6 +44,7 @@ CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_LIBM=y

View File

@ -28,6 +28,8 @@ CONFIG_CM_MM_TEST=y
CONFIG_CM_PTHREAD_TEST=y
CONFIG_CM_SCHED_TEST=y
CONFIG_CM_TIME_TEST=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_SYMBOLS=y
@ -72,6 +74,7 @@ CONFIG_LIBC_DLFCN=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_FLOATINGPOINT=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_LOCALE_CATALOG=y
CONFIG_LIBC_LOCALE_GETTEXT=y
CONFIG_LIBC_LOCALTIME=y

View File

@ -18,7 +18,9 @@ CONFIG_BOARD_LOOPSPERMSEC=0
CONFIG_BOOT_RUNFROMEXTSRAM=y
CONFIG_BUILTIN=y
CONFIG_CXX_EXCEPTION=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_RTTI=y
CONFIG_CXX_WCHAR=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_BINFMT=y
CONFIG_DEBUG_BINFMT_ERROR=y
@ -46,6 +48,7 @@ CONFIG_IOB_NOTIFIER=y
CONFIG_LIBCXX=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_MAX_EXITFUNS=1
CONFIG_MM_FILL_ALLOCATIONS=y
CONFIG_NET=y

View File

@ -18,6 +18,8 @@ CONFIG_BOARD_LOOPSPERMSEC=0
CONFIG_BOOT_RUNFROMEXTSRAM=y
CONFIG_BUILTIN=y
CONFIG_CRYPTO_MBEDTLS=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEV_GPIO=y
CONFIG_DEV_LOOP=y
@ -51,6 +53,7 @@ CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_GAISTRERROR=y
CONFIG_LIBC_GAISTRERROR_ERRNUM=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_MAX_EXITFUNS=1
CONFIG_LIBC_NUMBERED_ARGS=y
CONFIG_LIBM=y

View File

@ -19,6 +19,8 @@ CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_XTENSA=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_ESP32_UART0=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
@ -27,6 +29,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_MAX_EXITFUNS=1
CONFIG_LIBM=y
CONFIG_MM_REGIONS=3

View File

@ -19,6 +19,8 @@ CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_XTENSA=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_ESP32S2_UART0=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
@ -27,6 +29,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_MAX_EXITFUNS=1
CONFIG_LIBM=y
CONFIG_NSH_ARCHINIT=y

View File

@ -20,6 +20,8 @@ CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_XTENSA=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_ESP32S3_UART0=y
@ -29,6 +31,7 @@ CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_MAX_EXITFUNS=1
CONFIG_LIBM=y
CONFIG_NSH_ARCHINIT=y

View File

@ -43,7 +43,6 @@ config LIBCXXMINI
config LIBCXX
bool "LLVM libc++ C++ Standard Library"
select HAVE_CXXINITIALIZE
select LIBC_LOCALE
select PTHREAD_MUTEX_TYPES
depends on TLS_NELEM > 0
---help---
@ -115,6 +114,10 @@ config CXX_RTTI
config CXX_WCHAR
bool "Enable Wide Character Support"
config CXX_LOCALIZATION
bool "Enable Locale and Stream Support"
depends on LIBC_LOCALE
if UCLIBCXX
config UCLIBCXX_BUFSIZE

View File

@ -27,9 +27,11 @@
/* #undef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION */
/* #undef _LIBCPP_HAS_NO_FILESYSTEM */
/* #undef _LIBCPP_HAS_NO_RANDOM_DEVICE */
/* #undef _LIBCPP_HAS_NO_LOCALIZATION */
#ifndef CONFIG_CXX_LOCALIZATION
# define _LIBCPP_HAS_NO_LOCALIZATION
#endif
#ifndef CONFIG_CXX_WCHAR
#define _LIBCPP_HAS_NO_WIDE_CHARACTERS
# define _LIBCPP_HAS_NO_WIDE_CHARACTERS
#endif
#define _LIBCPP_ENABLE_ASSERTIONS_DEFAULT 0

View File

@ -92,6 +92,19 @@ list(APPEND SRCS ${SRCSTMP})
file(GLOB SRCSTMP ${CMAKE_CURRENT_LIST_DIR}/libcxx/src/ryu/*.cpp)
list(APPEND SRCS ${SRCSTMP})
if(NOT CONFIG_CXX_LOCALIZATION)
file(
GLOB
SRCSTMP
${CMAKE_CURRENT_LIST_DIR}/libcxx/src/ios.cpp
${CMAKE_CURRENT_LIST_DIR}/libcxx/src/ios.instantiations.cpp
${CMAKE_CURRENT_LIST_DIR}/libcxx/src/iostream.cpp
${CMAKE_CURRENT_LIST_DIR}/libcxx/src/locale.cpp
${CMAKE_CURRENT_LIST_DIR}/libcxx/src/regex.cpp
${CMAKE_CURRENT_LIST_DIR}/libcxx/src/strstream.cpp)
list(REMOVE_ITEM SRCS ${SRCSTMP})
endif()
set(FLAGS -Wno-attributes -Wno-deprecated-declarations -Wno-shadow
-Wno-sign-compare)

View File

@ -69,3 +69,14 @@ CPPSRCS += $(wildcard libcxx/src/*.cpp)
CPPSRCS += $(wildcard libcxx/src/experimental/*.cpp)
CPPSRCS += $(wildcard libcxx/src/filesystem/*.cpp)
CPPSRCS += $(wildcard libcxx/src/ryu/*.cpp)
ifeq ($(CONFIG_CXX_LOCALIZATION),)
LOCALE_CPPSRCS := libcxx/src/ios.cpp
LOCALE_CPPSRCS += libcxx/src/ios.instantiations.cpp
LOCALE_CPPSRCS += libcxx/src/iostream.cpp
LOCALE_CPPSRCS += libcxx/src/locale.cpp
LOCALE_CPPSRCS += libcxx/src/regex.cpp
LOCALE_CPPSRCS += libcxx/src/strstream.cpp
CPPSRCS := $(filter-out $(LOCALE_CPPSRCS), $(CPPSRCS))
endif