This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit b33283a61d052f60357198b1f15f75e691c7ef4b Author: zhangyuan29 <[email protected]> AuthorDate: Thu Jan 9 15:11:30 2025 +0800 arch/tricore: use cxx toolchain for tricore Allow linking against the toolchain C++ libraries with GCC: - pass -nostdlib to the linker as well, the libraries are added explicitly - with CONFIG_LIBCXXTOOLCHAIN define _STDLIB_H_ for C++ so the toolchain <cstdlib> uses the NuttX stdlib.h - pick the toolchain libsupc++ with CONFIG_LIBSUPCXX_TOOLCHAIN (the toolchain variant) instead of CONFIG_LIBSUPCXX (built from source), as the other architectures do Signed-off-by: zhangyuan29 <[email protected]> --- arch/tricore/src/cmake/ToolchainGnuc.cmake | 3 +++ arch/tricore/src/cmake/platform.cmake | 2 +- arch/tricore/src/common/ToolchainGnuc.defs | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/tricore/src/cmake/ToolchainGnuc.cmake b/arch/tricore/src/cmake/ToolchainGnuc.cmake index 627d9ba6e5c..655ddfdd06a 100644 --- a/arch/tricore/src/cmake/ToolchainGnuc.cmake +++ b/arch/tricore/src/cmake/ToolchainGnuc.cmake @@ -63,6 +63,7 @@ set(CMAKE_ASM_ARCHIVE_CREATE "<CMAKE_AR> rcs <TARGET> <LINK_FLAGS> <OBJECTS>") add_compile_options(-fno-common) add_compile_options(-Wall -Wshadow -Wundef) add_compile_options(-nostdlib) +add_link_options(-nostdlib) if(CONFIG_DEBUG_CUSTOMOPT) add_compile_options(${CONFIG_DEBUG_OPTLEVEL}) @@ -138,6 +139,8 @@ endif() if(NOT CONFIG_LIBCXXTOOLCHAIN) add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-nostdinc++>) +else() + add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-D_STDLIB_H_>) endif() if(NOT CONFIG_CXX_EXCEPTION) diff --git a/arch/tricore/src/cmake/platform.cmake b/arch/tricore/src/cmake/platform.cmake index 3fe49137a8a..cf7d502c2c5 100644 --- a/arch/tricore/src/cmake/platform.cmake +++ b/arch/tricore/src/cmake/platform.cmake @@ -48,7 +48,7 @@ if(CONFIG_TRICORE_TOOLCHAIN_GNU) if(CONFIG_LIBM_TOOLCHAIN) nuttx_find_toolchain_lib(libm.a) endif() - if(CONFIG_LIBSUPCXX) + if(CONFIG_LIBSUPCXX_TOOLCHAIN) nuttx_find_toolchain_lib(libsupc++.a) endif() if(CONFIG_LIBCXXTOOLCHAIN) diff --git a/arch/tricore/src/common/ToolchainGnuc.defs b/arch/tricore/src/common/ToolchainGnuc.defs index ea6c1bf7ff7..34355601e49 100644 --- a/arch/tricore/src/common/ToolchainGnuc.defs +++ b/arch/tricore/src/common/ToolchainGnuc.defs @@ -182,7 +182,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
