nuttx: Add LIBSUPCXX_TOOLCHAIN to link the prebuilt library provide by toolchain.

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
This commit is contained in:
cuiziwei 2024-09-25 18:24:18 +08:00 committed by Xiang Xiao
parent 134ecf380b
commit 12fd5ec472
24 changed files with 41 additions and 27 deletions

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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