diff --git a/arch/arm/src/cmake/platform.cmake b/arch/arm/src/cmake/platform.cmake index 1bce5f6678..26e9adaebd 100644 --- a/arch/arm/src/cmake/platform.cmake +++ b/arch/arm/src/cmake/platform.cmake @@ -79,7 +79,7 @@ if(NOT CONFIG_LIBM) nuttx_find_toolchain_lib(libm.a) endif() -if(CONFIG_LIBSUPCXX) +if(CONFIG_LIBSUPCXX_TOOLCHAIN) nuttx_find_toolchain_lib(libsupc++.a) endif() diff --git a/arch/arm/src/common/Toolchain.defs b/arch/arm/src/common/Toolchain.defs index f1d58187f2..0601b28aef 100644 --- a/arch/arm/src/common/Toolchain.defs +++ b/arch/arm/src/common/Toolchain.defs @@ -490,7 +490,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) endif endif -ifeq ($(CONFIG_LIBSUPCXX),y) +ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif diff --git a/arch/arm64/src/Toolchain.defs b/arch/arm64/src/Toolchain.defs index faf6480b3e..84a7cb3814 100644 --- a/arch/arm64/src/Toolchain.defs +++ b/arch/arm64/src/Toolchain.defs @@ -205,7 +205,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a)) endif -ifeq ($(CONFIG_LIBSUPCXX),y) +ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif diff --git a/arch/arm64/src/cmake/platform.cmake b/arch/arm64/src/cmake/platform.cmake index 71795cda38..130f620fa8 100644 --- a/arch/arm64/src/cmake/platform.cmake +++ b/arch/arm64/src/cmake/platform.cmake @@ -48,7 +48,7 @@ if(NOT CONFIG_LIBM) OUTPUT_VARIABLE extra_library) list(APPEND EXTRA_LIB ${extra_library}) endif() -if(CONFIG_LIBSUPCXX) +if(CONFIG_LIBSUPCXX_TOOLCHAIN) execute_process( COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} --print-file-name=libsupc++.a diff --git a/arch/avr/src/avr/Toolchain.defs b/arch/avr/src/avr/Toolchain.defs index 76e236cc3b..47051a5c19 100644 --- a/arch/avr/src/avr/Toolchain.defs +++ b/arch/avr/src/avr/Toolchain.defs @@ -164,7 +164,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a)) endif -ifeq ($(CONFIG_LIBSUPCXX),y) +ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif diff --git a/arch/avr/src/avr32/Toolchain.defs b/arch/avr/src/avr32/Toolchain.defs index b2e785ac08..68c0f6799f 100644 --- a/arch/avr/src/avr32/Toolchain.defs +++ b/arch/avr/src/avr32/Toolchain.defs @@ -94,7 +94,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a)) endif -ifeq ($(CONFIG_LIBSUPCXX),y) +ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif diff --git a/arch/hc/src/Makefile b/arch/hc/src/Makefile index cbc12ffd00..907b7bd65a 100644 --- a/arch/hc/src/Makefile +++ b/arch/hc/src/Makefile @@ -80,7 +80,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif -ifeq ($(CONFIG_LIBSUPCXX),y) +ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}} endif diff --git a/arch/mips/src/mips32/Toolchain.defs b/arch/mips/src/mips32/Toolchain.defs index 819cb1ad1f..ff6083a485 100644 --- a/arch/mips/src/mips32/Toolchain.defs +++ b/arch/mips/src/mips32/Toolchain.defs @@ -309,7 +309,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a)) endif -ifeq ($(CONFIG_LIBSUPCXX),y) +ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif diff --git a/arch/misoc/src/lm32/Toolchain.defs b/arch/misoc/src/lm32/Toolchain.defs index 01a926d326..b10a35e622 100644 --- a/arch/misoc/src/lm32/Toolchain.defs +++ b/arch/misoc/src/lm32/Toolchain.defs @@ -125,7 +125,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a)) endif -ifeq ($(CONFIG_LIBSUPCXX),y) +ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif diff --git a/arch/misoc/src/minerva/Toolchain.defs b/arch/misoc/src/minerva/Toolchain.defs index efbf92a3d9..02b4714199 100644 --- a/arch/misoc/src/minerva/Toolchain.defs +++ b/arch/misoc/src/minerva/Toolchain.defs @@ -73,7 +73,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a)) endif -ifeq ($(CONFIG_LIBSUPCXX),y) +ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif diff --git a/arch/or1k/src/mor1kx/Toolchain.defs b/arch/or1k/src/mor1kx/Toolchain.defs index 346c6b7147..991c2d05b9 100644 --- a/arch/or1k/src/mor1kx/Toolchain.defs +++ b/arch/or1k/src/mor1kx/Toolchain.defs @@ -111,7 +111,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a)) endif -ifeq ($(CONFIG_LIBSUPCXX),y) +ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif diff --git a/arch/renesas/src/Makefile b/arch/renesas/src/Makefile index f2811a6313..e66ee275a2 100644 --- a/arch/renesas/src/Makefile +++ b/arch/renesas/src/Makefile @@ -73,7 +73,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif -ifeq ($(CONFIG_LIBSUPCXX),y) +ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}} endif diff --git a/arch/risc-v/src/cmake/platform.cmake b/arch/risc-v/src/cmake/platform.cmake index df38ed77d1..4199655626 100644 --- a/arch/risc-v/src/cmake/platform.cmake +++ b/arch/risc-v/src/cmake/platform.cmake @@ -52,7 +52,7 @@ if(NOT CONFIG_LIBM) list(APPEND EXTRA_LIB ${extra_library}) endif() -if(CONFIG_LIBSUPCXX) +if(CONFIG_LIBSUPCXX_TOOLCHAIN) execute_process( COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} --print-file-name=libsupc++.a diff --git a/arch/risc-v/src/common/Toolchain.defs b/arch/risc-v/src/common/Toolchain.defs index ddf814dec3..1f1871b550 100644 --- a/arch/risc-v/src/common/Toolchain.defs +++ b/arch/risc-v/src/common/Toolchain.defs @@ -401,7 +401,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a)) endif -ifeq ($(CONFIG_LIBSUPCXX),y) +ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif diff --git a/arch/x86/src/Makefile b/arch/x86/src/Makefile index 1340d16d21..e907cdf022 100644 --- a/arch/x86/src/Makefile +++ b/arch/x86/src/Makefile @@ -91,7 +91,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif -ifeq ($(CONFIG_LIBSUPCXX),y) +ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}} endif diff --git a/arch/x86_64/src/Makefile b/arch/x86_64/src/Makefile index 6468b4cb0c..ba55db152d 100644 --- a/arch/x86_64/src/Makefile +++ b/arch/x86_64/src/Makefile @@ -93,7 +93,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a}} endif -ifeq ($(CONFIG_LIBSUPCXX),y) +ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += ${wildcard ${shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a}} endif diff --git a/arch/x86_64/src/cmake/platform.cmake b/arch/x86_64/src/cmake/platform.cmake index 8d2bab0010..414deb5c32 100644 --- a/arch/x86_64/src/cmake/platform.cmake +++ b/arch/x86_64/src/cmake/platform.cmake @@ -52,7 +52,7 @@ if(CONFIG_LIBM_TOOLCHAIN) list(APPEND EXTRA_LIB ${extra_library}) endif() -if(CONFIG_LIBSUPCXX) +if(CONFIG_LIBSUPCXX_TOOLCHAIN) execute_process( COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} --print-file-name=libsupc++.a diff --git a/arch/xtensa/src/lx6/Toolchain.defs b/arch/xtensa/src/lx6/Toolchain.defs index 37faf06370..9f89d1600a 100644 --- a/arch/xtensa/src/lx6/Toolchain.defs +++ b/arch/xtensa/src/lx6/Toolchain.defs @@ -193,7 +193,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a)) endif -ifeq ($(CONFIG_LIBSUPCXX),y) +ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif diff --git a/arch/xtensa/src/lx7/Toolchain.defs b/arch/xtensa/src/lx7/Toolchain.defs index 7cf31413af..495ece81e7 100644 --- a/arch/xtensa/src/lx7/Toolchain.defs +++ b/arch/xtensa/src/lx7/Toolchain.defs @@ -197,7 +197,7 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a)) endif -ifeq ($(CONFIG_LIBSUPCXX),y) +ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif diff --git a/libs/libc/machine/arm/CMakeLists.txt b/libs/libc/machine/arm/CMakeLists.txt index 6dba16de12..387be1d42c 100644 --- a/libs/libc/machine/arm/CMakeLists.txt +++ b/libs/libc/machine/arm/CMakeLists.txt @@ -46,7 +46,7 @@ elseif(CONFIG_ARCH_ARMV8M) # All ARMv8-M add_subdirectory(armv8-m) endif() -if(NOT CONFIG_LIBSUPCXX) +if(NOT CONFIG_LIBSUPCXX_TOOLCHAIN) list(APPEND SRCS aeabi_atexit.c) endif() diff --git a/libs/libc/machine/arm/Make.defs b/libs/libc/machine/arm/Make.defs index 73b41ad4dc..63a319eb4a 100644 --- a/libs/libc/machine/arm/Make.defs +++ b/libs/libc/machine/arm/Make.defs @@ -44,7 +44,7 @@ else ifeq ($(CONFIG_ARCH_ARMV8M),y) # All ARMv8-M include $(TOPDIR)/libs/libc/machine/arm/armv8-m/Make.defs endif -ifneq ($(CONFIG_LIBSUPCXX),y) +ifneq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) CSRCS += aeabi_atexit.c endif diff --git a/libs/libxx/Kconfig b/libs/libxx/Kconfig index 7c2728fa89..62618e15bb 100644 --- a/libs/libxx/Kconfig +++ b/libs/libxx/Kconfig @@ -67,11 +67,11 @@ config ETL Implements C++ templates such as containers, string singleton math without C++ STL libraries -if LIBCXX || UCLIBCXX +if !LIBCXXMINI choice prompt "C++ low level library select" - default LIBSUPCXX + default LIBSUPCXX_TOOLCHAIN config LIBCXXABI bool "LLVM low level C++ Library" @@ -81,21 +81,27 @@ config LIBCXXABI Select if your use libc++abi as lower level c++ library config LIBSUPCXX + bool "GNU compile low level libsupc++" + ---help--- + Select if your compile libsupc++ and use libsupc++ as lower + level c++ library. + +config LIBSUPCXX_TOOLCHAIN bool "GNU low level libsupc++" ---help--- - Select if your toolchain provides libsupc++ and use libsupc++ as lower + Select if your toolchain provides libsupc++ and use toolchain libsupc++ as lower level c++ library. endchoice +endif + config LIBCXXABI_VERSION string "Select libcxxabi version" depends on LIBCXXABI default LIBCXX_VERSION if LIBCXX default "17.0.6" if !LIBCXX -endif - config CXX_STANDARD string "Language standard" default "gnu++20" if LIBCXX diff --git a/libs/libxx/libcxx.cmake b/libs/libxx/libcxx.cmake index 1d7e79e4be..9b4c3fee88 100644 --- a/libs/libxx/libcxx.cmake +++ b/libs/libxx/libcxx.cmake @@ -73,6 +73,10 @@ set_property( PROPERTY NUTTX_CXX_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/include/libcxx) add_compile_definitions(_LIBCPP_BUILDING_LIBRARY) +if(CONFIG_LIBSUPCXX_TOOLCHAIN) + add_compile_definitions(__GLIBCXX__) +endif() + if(CONFIG_LIBSUPCXX) add_compile_definitions(__GLIBCXX__) endif() diff --git a/libs/libxx/libcxx.defs b/libs/libxx/libcxx.defs index 730b898b23..717af3489e 100644 --- a/libs/libxx/libcxx.defs +++ b/libs/libxx/libcxx.defs @@ -54,7 +54,11 @@ endif CXXFLAGS += ${DEFINE_PREFIX}_LIBCPP_BUILDING_LIBRARY CXXFLAGS += ${INCDIR_PREFIX}$(CURDIR)/libcxx/src -ifeq ($(CONFIG_LIBSUPCXX), y) +ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) +CXXFLAGS += ${DEFINE_PREFIX}__GLIBCXX__ +endif + +ifeq ($(CONFIG_LIBSUPCXX),y) CXXFLAGS += ${DEFINE_PREFIX}__GLIBCXX__ endif