diff --git a/CMakeLists.txt b/CMakeLists.txt index fce86072c04..f01e5ca00d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -481,15 +481,17 @@ if(WIN32) else() add_compile_options( # system wide warnings - -Wall - $<$:-Wstrict-prototypes> - -Wshadow - -Wundef + -Wall $<$:-Wstrict-prototypes> -Wshadow -Wundef # system wide options - $<$:-nostdinc++> $<$:-D__ASSEMBLY__>) endif() +if(NOT CONFIG_LIBCXXTOOLCHAIN) + add_compile_options($<$:-nostdinc++>) +else() + add_compile_options($<$:-D_STDLIB_H_>) +endif() + if(NOT CONFIG_CXX_EXCEPTION) add_compile_options($<$:-fno-exceptions> $<$:-fcheck-new>) diff --git a/arch/arm/src/cmake/Toolchain.cmake b/arch/arm/src/cmake/Toolchain.cmake index 7f812dae8be..0ba3fdf239c 100644 --- a/arch/arm/src/cmake/Toolchain.cmake +++ b/arch/arm/src/cmake/Toolchain.cmake @@ -184,7 +184,12 @@ if(CONFIG_DEBUG_SYMBOLS) endif() set(ARCHCFLAGS "-Wstrict-prototypes") -set(ARCHCXXFLAGS "-nostdinc++") + +if(NOT CONFIG_LIBCXXTOOLCHAIN) + set(ARCHCXXFLAGS "${ARCHCXXFLAGS} -nostdinc++") +else() + set(ARCHCXXFLAGS "${ARCHCXXFLAGS} -D_STDLIB_H_") +endif() if(NOT CONFIG_CXX_EXCEPTION) string(APPEND ARCHCXXFLAGS " -fno-exceptions -fcheck-new") diff --git a/arch/arm/src/common/Toolchain.defs b/arch/arm/src/common/Toolchain.defs index 1e0184abc5c..6ac51393f5a 100644 --- a/arch/arm/src/common/Toolchain.defs +++ b/arch/arm/src/common/Toolchain.defs @@ -289,12 +289,18 @@ endif # Architecture flags ARCHCFLAGS += -Wstrict-prototypes -Wno-attributes -Wno-unknown-pragmas -ARCHCXXFLAGS += -nostdinc++ -Wno-attributes -Wno-unknown-pragmas +ARCHCXXFLAGS += -Wno-attributes -Wno-unknown-pragmas # When all C++ code is built using GCC 7.1 or a higher version, # we can safely disregard warnings of the type "parameter passing for X changed in GCC 7.1." # Refer to : https://stackoverflow.com/questions/48149323/what-does-the-gcc-warning-project-parameter-passing-for-x-changed-in-gcc-7-1-m +ifneq ($(CONFIG_LIBCXXTOOLCHAIN),y) + ARCHCXXFLAGS += -nostdinc++ +else + ARCHCXXFLAGS += -D_STDLIB_H_ +endif + ifneq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y) ARCHCFLAGS += -Wno-psabi ARCHCXXFLAGS += -Wno-psabi @@ -386,6 +392,10 @@ ifeq ($(CONFIG_ARCH_COVERAGE),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a)) endif +ifeq ($(CONFIG_LIBCXXTOOLCHAIN),y) + EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libstdc++.a)) +endif + # Zig toolchain include $(TOPDIR)/tools/Zig.defs diff --git a/arch/arm64/src/Toolchain.defs b/arch/arm64/src/Toolchain.defs index 214b481d5e1..cbe55788b4e 100644 --- a/arch/arm64/src/Toolchain.defs +++ b/arch/arm64/src/Toolchain.defs @@ -96,7 +96,7 @@ ifeq ($(CONFIG_ARCH_FPU),y) endif ARCHCFLAGS += -fno-common -ARCHCXXFLAGS += -fno-common -nostdinc++ +ARCHCXXFLAGS += -fno-common ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Werror -Wno-attributes -Wno-unknown-pragmas ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas @@ -105,6 +105,12 @@ ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas # we can safely disregard warnings of the type "parameter passing for X changed in GCC 7.1." # Refer to : https://stackoverflow.com/questions/48149323/what-does-the-gcc-warning-project-parameter-passing-for-x-changed-in-gcc-7-1-m +ifneq ($(CONFIG_LIBCXXTOOLCHAIN),y) + ARCHCXXFLAGS += -nostdinc++ +else + ARCHCXXFLAGS += -D_STDLIB_H_ +endif + ifneq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y) ARCHCFLAGS += -Wno-psabi ARCHCXXFLAGS += -Wno-psabi diff --git a/arch/arm64/src/cmake/Toolchain.cmake b/arch/arm64/src/cmake/Toolchain.cmake index 4cd2f958ea9..e6069a30abf 100644 --- a/arch/arm64/src/cmake/Toolchain.cmake +++ b/arch/arm64/src/cmake/Toolchain.cmake @@ -123,8 +123,14 @@ set(ARCHCFLAGS "-Wstrict-prototypes -fno-common -Wall -Wshadow -Werror -Wundef -Wno-attributes -Wno-unknown-pragmas" ) set(ARCHCXXFLAGS - "-nostdinc++ -fno-common -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas" -) + "-fno-common -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas") + +if(NOT CONFIG_LIBCXXTOOLCHAIN) + set(ARCHCXXFLAGS "${ARCHCXXFLAGS} -nostdinc++") +else() + set(ARCHCXXFLAGS "${ARCHCXXFLAGS} -D_STDLIB_H_") +endif() + if(NOT ${CONFIG_ARCH_TOOLCHAIN_CLANG}) string(APPEND ARCHCFLAGS " -Wno-psabi") string(APPEND ARCHCXXFLAGS " -Wno-psabi") diff --git a/arch/avr/src/avr/Toolchain.defs b/arch/avr/src/avr/Toolchain.defs index ea98f72bcbf..6ed29966faa 100644 --- a/arch/avr/src/avr/Toolchain.defs +++ b/arch/avr/src/avr/Toolchain.defs @@ -99,11 +99,17 @@ else endif ARCHCFLAGS += -fno-common -ARCHCXXFLAGS += -fno-common -nostdinc++ +ARCHCXXFLAGS += -fno-common ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas +ifneq ($(CONFIG_LIBCXXTOOLCHAIN),y) + ARCHCXXFLAGS += -nostdinc++ +else + ARCHCXXFLAGS += -D_STDLIB_H_ +endif + ifneq ($(CONFIG_CXX_STANDARD),) ARCHCXXFLAGS += -std=$(CONFIG_CXX_STANDARD) endif diff --git a/arch/avr/src/avr32/Toolchain.defs b/arch/avr/src/avr32/Toolchain.defs index 8c9d19510ce..fe8a6edc011 100644 --- a/arch/avr/src/avr32/Toolchain.defs +++ b/arch/avr/src/avr32/Toolchain.defs @@ -46,11 +46,17 @@ else endif ARCHCFLAGS += -fno-common -ARCHCXXFLAGS += -fno-common -nostdinc++ +ARCHCXXFLAGS += -fno-common ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas +ifneq ($(CONFIG_LIBCXXTOOLCHAIN),y) + ARCHCXXFLAGS += -nostdinc++ +else + ARCHCXXFLAGS += -D_STDLIB_H_ +endif + ifneq ($(CONFIG_CXX_STANDARD),) ARCHCXXFLAGS += -std=$(CONFIG_CXX_STANDARD) endif diff --git a/arch/ceva/src/xc5/Toolchain.defs b/arch/ceva/src/xc5/Toolchain.defs index 966851da06b..63d52a76e71 100644 --- a/arch/ceva/src/xc5/Toolchain.defs +++ b/arch/ceva/src/xc5/Toolchain.defs @@ -65,11 +65,17 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y) endif ARCHCFLAGS += -fno-common -ARCHCXXFLAGS += -fno-common -nostdinc++ +ARCHCXXFLAGS += -fno-common ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas +ifneq ($(CONFIG_LIBCXXTOOLCHAIN),y) + ARCHCXXFLAGS += -nostdinc++ +else + ARCHCXXFLAGS += -D_STDLIB_H_ +endif + ARCHCPUFLAGS = -mrtl-version-$(RTL_VERSION) -Wa,-rtl$(RTL_VERSION) ARCHCPUFLAGS += -Wa,-p -mmsg-full-path -TARG:arch=cevaxc5 -Wa,-vdiv4 -Wno-unused diff --git a/arch/ceva/src/xm6/Toolchain.defs b/arch/ceva/src/xm6/Toolchain.defs index 256d4dec3ca..e85becdfe13 100644 --- a/arch/ceva/src/xm6/Toolchain.defs +++ b/arch/ceva/src/xm6/Toolchain.defs @@ -65,11 +65,17 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y) endif ARCHCFLAGS += -fno-common -ARCHCXXFLAGS += -fno-common -nostdinc++ +ARCHCXXFLAGS += -fno-common ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas +ifneq ($(CONFIG_LIBCXXTOOLCHAIN),y) + ARCHCXXFLAGS += -nostdinc++ +else + ARCHCXXFLAGS += -D_STDLIB_H_ +endif + ARCHCPUFLAGS = -mrtl-version-$(RTL_VERSION) -Wa,-rtl$(RTL_VERSION) ARCHCPUFLAGS += -Wa,-p diff --git a/arch/mips/src/mips32/Toolchain.defs b/arch/mips/src/mips32/Toolchain.defs index 9f852c354ac..2b37f35be5e 100644 --- a/arch/mips/src/mips32/Toolchain.defs +++ b/arch/mips/src/mips32/Toolchain.defs @@ -260,11 +260,17 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y) endif ARCHCFLAGS += -fno-common -ARCHCXXFLAGS += -fno-common -nostdinc++ +ARCHCXXFLAGS += -fno-common ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas +ifneq ($(CONFIG_LIBCXXTOOLCHAIN),y) + ARCHCXXFLAGS += -nostdinc++ +else + ARCHCXXFLAGS += -D_STDLIB_H_ +endif + ifneq ($(CONFIG_CXX_STANDARD),) ARCHCXXFLAGS += -std=$(CONFIG_CXX_STANDARD) endif diff --git a/arch/misoc/src/lm32/Toolchain.defs b/arch/misoc/src/lm32/Toolchain.defs index bde979f0053..7a8e89918df 100644 --- a/arch/misoc/src/lm32/Toolchain.defs +++ b/arch/misoc/src/lm32/Toolchain.defs @@ -72,11 +72,17 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y) endif ARCHCFLAGS += -fno-common -ARCHCXXFLAGS += -fno-common -nostdinc++ +ARCHCXXFLAGS += -fno-common ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas +ifneq ($(CONFIG_LIBCXXTOOLCHAIN),y) + ARCHCXXFLAGS += -nostdinc++ +else + ARCHCXXFLAGS += -D_STDLIB_H_ +endif + ifneq ($(CONFIG_CXX_STANDARD),) ARCHCXXFLAGS += -std=$(CONFIG_CXX_STANDARD) endif diff --git a/arch/misoc/src/minerva/Toolchain.defs b/arch/misoc/src/minerva/Toolchain.defs index 2848a979689..f7401aa499b 100644 --- a/arch/misoc/src/minerva/Toolchain.defs +++ b/arch/misoc/src/minerva/Toolchain.defs @@ -44,7 +44,7 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y) endif ARCHCFLAGS += -fno-common -ARCHCXXFLAGS += -fno-common -nostdinc++ +ARCHCXXFLAGS += -fno-common ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas @@ -65,6 +65,12 @@ OBJDUMP = $(CROSSDEV)objdump EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-libgcc-file-name)) +ifneq ($(CONFIG_LIBCXXTOOLCHAIN),y) + ARCHCXXFLAGS += -nostdinc++ +else + ARCHCXXFLAGS += -D_STDLIB_H_ +endif + ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libm.a)) endif diff --git a/arch/or1k/src/mor1kx/Toolchain.defs b/arch/or1k/src/mor1kx/Toolchain.defs index e048f115832..3baa1ab927b 100644 --- a/arch/or1k/src/mor1kx/Toolchain.defs +++ b/arch/or1k/src/mor1kx/Toolchain.defs @@ -55,11 +55,17 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y) endif ARCHCFLAGS += -fno-common -ARCHCXXFLAGS += -fno-common -nostdinc++ +ARCHCXXFLAGS += -fno-common ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas +ifneq ($(CONFIG_LIBCXXTOOLCHAIN),y) + ARCHCXXFLAGS += -nostdinc++ +else + ARCHCXXFLAGS += -D_STDLIB_H_ +endif + ifneq ($(CONFIG_CXX_STANDARD),) ARCHCXXFLAGS += -std=$(CONFIG_CXX_STANDARD) endif diff --git a/arch/risc-v/src/cmake/Toolchain.cmake b/arch/risc-v/src/cmake/Toolchain.cmake index 46abf64f284..f25efc04a74 100644 --- a/arch/risc-v/src/cmake/Toolchain.cmake +++ b/arch/risc-v/src/cmake/Toolchain.cmake @@ -113,8 +113,13 @@ set(ARCHCFLAGS "-Wstrict-prototypes -fno-common -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas" ) set(ARCHCXXFLAGS - "-nostdinc++ -fno-common -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas" -) + "-fno-common -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas") + +if(NOT CONFIG_LIBCXXTOOLCHAIN) + set(ARCHCXXFLAGS "${ARCHCXXFLAGS} -nostdinc++") +else() + set(ARCHCXXFLAGS "${ARCHCXXFLAGS} -D_STDLIB_H_") +endif() if(NOT ${CONFIG_ARCH_TOOLCHAIN_CLANG}) string(APPEND ARCHCFLAGS " -Wno-psabi") diff --git a/arch/risc-v/src/common/Toolchain.defs b/arch/risc-v/src/common/Toolchain.defs index 94462b07c1e..44852e69543 100644 --- a/arch/risc-v/src/common/Toolchain.defs +++ b/arch/risc-v/src/common/Toolchain.defs @@ -78,7 +78,7 @@ ifeq ($(CONFIG_ARCH_COVERAGE_ALL),y) endif ARCHCFLAGS += -fno-common -ARCHCXXFLAGS += -fno-common -nostdinc++ +ARCHCXXFLAGS += -fno-common ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas @@ -87,6 +87,12 @@ ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas # we can safely disregard warnings of the type "parameter passing for X changed in GCC 7.1." # Refer to : https://stackoverflow.com/questions/48149323/what-does-the-gcc-warning-project-parameter-passing-for-x-changed-in-gcc-7-1-m +ifneq ($(CONFIG_LIBCXXTOOLCHAIN),y) + ARCHCXXFLAGS += -nostdinc++ +else + ARCHCXXFLAGS += -D_STDLIB_H_ +endif + ifneq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y) ARCHCFLAGS += -Wno-psabi ARCHCXXFLAGS += -Wno-psabi diff --git a/arch/sim/src/cmake/Toolchain.cmake b/arch/sim/src/cmake/Toolchain.cmake index c3af008a264..ab079990339 100644 --- a/arch/sim/src/cmake/Toolchain.cmake +++ b/arch/sim/src/cmake/Toolchain.cmake @@ -99,7 +99,12 @@ if(CONFIG_CXX_STANDARD) endif() set(ARCHCFLAGS "-Wstrict-prototypes") -set(ARCHCXXFLAGS "-nostdinc++") + +if(NOT CONFIG_LIBCXXTOOLCHAIN) + set(ARCHCXXFLAGS "${ARCHCXXFLAGS} -nostdinc++") +else() + set(ARCHCXXFLAGS "${ARCHCXXFLAGS} -D_STDLIB_H_") +endif() if(NOT CONFIG_CXX_EXCEPTION) string(APPEND ARCHCXXFLAGS " -fno-exceptions -fcheck-new") diff --git a/arch/sparc/src/sparc_v8/Toolchain.defs b/arch/sparc/src/sparc_v8/Toolchain.defs index b6c199e8d06..cd72f0ffb28 100644 --- a/arch/sparc/src/sparc_v8/Toolchain.defs +++ b/arch/sparc/src/sparc_v8/Toolchain.defs @@ -77,11 +77,17 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y) endif ARCHCFLAGS += -fno-common -ARCHCXXFLAGS += -fno-common -nostdinc++ +ARCHCXXFLAGS += -fno-common ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas +ifneq ($(CONFIG_LIBCXXTOOLCHAIN),y) + ARCHCXXFLAGS += -nostdinc++ +else + ARCHCXXFLAGS += -D_STDLIB_H_ +endif + ifneq ($(CONFIG_CXX_STANDARD),) ARCHCXXFLAGS += -std=$(CONFIG_CXX_STANDARD) endif diff --git a/arch/x86_64/src/cmake/Toolchain.cmake b/arch/x86_64/src/cmake/Toolchain.cmake index 1718b486cb5..b752eb5a86d 100644 --- a/arch/x86_64/src/cmake/Toolchain.cmake +++ b/arch/x86_64/src/cmake/Toolchain.cmake @@ -89,8 +89,13 @@ set(ARCHCFLAGS "-Wstrict-prototypes -fno-common -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas" ) set(ARCHCXXFLAGS - "-nostdinc++ -fno-common -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas" -) + "-fno-common -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas") + +if(NOT CONFIG_LIBCXXTOOLCHAIN) + set(ARCHCXXFLAGS "${ARCHCXXFLAGS} -nostdinc++") +else() + set(ARCHCXXFLAGS "${ARCHCXXFLAGS} -D_STDLIB_H_") +endif() if(CONFIG_CXX_EXCEPTION) string(APPEND ARCHCXXFLAGS " -fno-exceptions -fcheck-new") diff --git a/arch/xtensa/src/lx6/Toolchain.defs b/arch/xtensa/src/lx6/Toolchain.defs index 686dc700877..ce0567f37ba 100644 --- a/arch/xtensa/src/lx6/Toolchain.defs +++ b/arch/xtensa/src/lx6/Toolchain.defs @@ -102,7 +102,7 @@ ifeq ($(CONFIG_ARCH_INSTRUMENT_ALL),y) endif ARCHCFLAGS += -fno-common -ARCHCXXFLAGS += -fno-common -nostdinc++ +ARCHCXXFLAGS += -fno-common ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas @@ -111,6 +111,12 @@ ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas # we can safely disregard warnings of the type "parameter passing for X changed in GCC 7.1." # Refer to : https://stackoverflow.com/questions/48149323/what-does-the-gcc-warning-project-parameter-passing-for-x-changed-in-gcc-7-1-m +ifneq ($(CONFIG_LIBCXXTOOLCHAIN),y) + ARCHCXXFLAGS += -nostdinc++ +else + ARCHCXXFLAGS += -D_STDLIB_H_ +endif + ifneq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y) ARCHCFLAGS += -Wno-psabi ARCHCXXFLAGS += -Wno-psabi diff --git a/arch/xtensa/src/lx7/Toolchain.defs b/arch/xtensa/src/lx7/Toolchain.defs index 6d5da909cf9..fc45c457569 100644 --- a/arch/xtensa/src/lx7/Toolchain.defs +++ b/arch/xtensa/src/lx7/Toolchain.defs @@ -106,7 +106,7 @@ ifeq ($(CONFIG_ARCH_INSTRUMENT_ALL),y) endif ARCHCFLAGS += -fno-common -ARCHCXXFLAGS += -fno-common -nostdinc++ +ARCHCXXFLAGS += -fno-common ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas @@ -115,6 +115,12 @@ ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas # we can safely disregard warnings of the type "parameter passing for X changed in GCC 7.1." # Refer to : https://stackoverflow.com/questions/48149323/what-does-the-gcc-warning-project-parameter-passing-for-x-changed-in-gcc-7-1-m +ifneq ($(CONFIG_LIBCXXTOOLCHAIN),y) + ARCHCXXFLAGS += -nostdinc++ +else + ARCHCXXFLAGS += -D_STDLIB_H_ +endif + ifneq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y) ARCHCFLAGS += -Wno-psabi ARCHCXXFLAGS += -Wno-psabi diff --git a/boards/sim/sim/sim/scripts/Make.defs b/boards/sim/sim/sim/scripts/Make.defs index efc9dd93831..b74ec9a0891 100644 --- a/boards/sim/sim/sim/scripts/Make.defs +++ b/boards/sim/sim/sim/scripts/Make.defs @@ -102,7 +102,7 @@ endif # Add -fno-common because macOS "ld -r" doesn't seem to pick objects # for common symbols. ARCHCFLAGS += -fno-common -ARCHCXXFLAGS += -fno-common -nostdinc++ +ARCHCXXFLAGS += -fno-common # Add -fvisibility=hidden # Because we don't want export nuttx's symbols to share libraries @@ -116,6 +116,12 @@ ARCHCXXFLAGS += -ffunction-sections -fdata-sections ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas +ifneq ($(CONFIG_LIBCXXTOOLCHAIN),y) + ARCHCXXFLAGS += -nostdinc++ +else + ARCHCXXFLAGS += -D_STDLIB_H_ +endif + ifneq ($(CONFIG_CXX_STANDARD),) ARCHCXXFLAGS += -std=$(CONFIG_CXX_STANDARD) endif diff --git a/libs/libxx/Kconfig b/libs/libxx/Kconfig index 4e52b2f1473..05f73e95850 100644 --- a/libs/libxx/Kconfig +++ b/libs/libxx/Kconfig @@ -26,6 +26,11 @@ choice prompt "C++ Library" default LIBCXXMINI +config LIBCXXTOOLCHAIN + bool "Toolchain C++ support" + ---help--- + Use Standard C++ library from toolchain. + config LIBCXXMINI bool "Basic C++ support" ---help---