diff --git a/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/Make.defs b/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/Make.defs index e00c4d3a7a..bb3a31d72b 100644 --- a/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/Make.defs +++ b/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/Make.defs @@ -83,7 +83,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y) endif ARCHCFLAGS = -fno-builtin -ifeq ($(CONFIG_LIBCXX_EXCEPTION),y) +ifeq ($(CONFIG_CXX_EXCEPTION),y) ARCHCPUFLAGSXX = -fno-builtin else ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fcheck-new diff --git a/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/Make.defs b/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/Make.defs index c58f7d5dcf..4cd50d9c82 100644 --- a/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/Make.defs +++ b/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/Make.defs @@ -83,7 +83,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y) endif ARCHCFLAGS = -fno-builtin -ifeq ($(CONFIG_LIBCXX_EXCEPTION),y) +ifeq ($(CONFIG_CXX_EXCEPTION),y) ARCHCPUFLAGSXX = -fno-builtin else ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fcheck-new diff --git a/boards/arm/lpc43xx/bambino-200e/configs/netnsh/Make.defs b/boards/arm/lpc43xx/bambino-200e/configs/netnsh/Make.defs index 724e68e7b6..a12e39fbe5 100644 --- a/boards/arm/lpc43xx/bambino-200e/configs/netnsh/Make.defs +++ b/boards/arm/lpc43xx/bambino-200e/configs/netnsh/Make.defs @@ -90,7 +90,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y) endif ARCHCFLAGS = -fno-builtin -ifeq ($(CONFIG_LIBCXX_EXCEPTION),y) +ifeq ($(CONFIG_CXX_EXCEPTION),y) ARCHCPUFLAGSXX = -fno-builtin else ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fcheck-new diff --git a/boards/arm/stm32/stm32f4discovery/README.txt b/boards/arm/stm32/stm32f4discovery/README.txt index 328a1bde73..18dfb7dac5 100644 --- a/boards/arm/stm32/stm32f4discovery/README.txt +++ b/boards/arm/stm32/stm32f4discovery/README.txt @@ -1357,7 +1357,7 @@ Configuration Sub-directories arm-none-eabi-ar.exe rcs libsupc++.a vterminate.o - 3. Exceptions are enabled and workking (CONFIG_UCLIBCXX_EXCEPTION=y) + 3. Exceptions are enabled and workking (CONFIG_CXX_EXCEPTION=y) elf: --- @@ -1393,8 +1393,8 @@ Configuration Sub-directories CONFIG_HAVE_CXXINITIALIZE=y CONFIG_UCLIBCXX=y - CONFIG_UCLIBCXX_EXCEPTION=y - CONFIG_UCLIBCXX_HAVE_LIBSUPCXX=y + CONFIG_CXX_EXCEPTION=y + CONFIG_CXX_LIBSUPCXX=y CONFIG_UCLIBCXX_IOSTREAM_BUFSIZE=32 CONFIG_EXAMPLES_ELF_CXX=y diff --git a/boards/arm/stm32/stm32f4discovery/configs/cxxtest/Make.defs b/boards/arm/stm32/stm32f4discovery/configs/cxxtest/Make.defs index 954f5e6c7b..a10f3bf75f 100644 --- a/boards/arm/stm32/stm32f4discovery/configs/cxxtest/Make.defs +++ b/boards/arm/stm32/stm32f4discovery/configs/cxxtest/Make.defs @@ -62,7 +62,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y) endif ARCHCFLAGS = -fno-builtin -ifeq ($(CONFIG_UCLIBCXX_EXCEPTION),y) +ifeq ($(CONFIG_CXX_EXCEPTION),y) ARCHCPUFLAGSXX = -fno-builtin else ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fcheck-new diff --git a/boards/arm/stm32/stm32f4discovery/configs/testlibcxx/Make.defs b/boards/arm/stm32/stm32f4discovery/configs/testlibcxx/Make.defs index dfeaffaa2c..a1a51092e8 100644 --- a/boards/arm/stm32/stm32f4discovery/configs/testlibcxx/Make.defs +++ b/boards/arm/stm32/stm32f4discovery/configs/testlibcxx/Make.defs @@ -81,7 +81,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y) endif ARCHCFLAGS = -fno-builtin -ifeq ($(CONFIG_LIBCXX_EXCEPTION),y) +ifeq ($(CONFIG_CXX_EXCEPTION),y) ARCHCPUFLAGSXX = -fno-builtin else ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fcheck-new diff --git a/boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs b/boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs index 867c0e1fef..5f58ee0be3 100644 --- a/boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs +++ b/boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs @@ -80,7 +80,7 @@ ifeq ($(CONFIG_LIBCXX),y) CXXFLAGS += -std=c++14 -D__NuttX__ -D__GLIBCXX__ -DMB_LEN_MAX=8 -DHAVE_DEPENDENT_EH_ABI=0 \ -fno-builtin -D_DEBUG -D_LIBCPP_BUILD_STATIC -D_LIBCPP_STD_VER=14 - ifneq ($(CONFIG_LIBCXX_EXCEPTION),y) + ifneq ($(CONFIG_CXX_EXCEPTION),y) CXXFLAGS += -fno-exceptions -fno-rtti -fcheck-new -D_LIBCPP_NO_EXCEPTIONS endif diff --git a/boards/sim/sim/sim/README.txt b/boards/sim/sim/sim/README.txt index b1793d10a9..8ee4e9e08c 100644 --- a/boards/sim/sim/sim/README.txt +++ b/boards/sim/sim/sim/README.txt @@ -561,7 +561,7 @@ cxxtest on how to install uClibc++ 2. At present (2012/11/02), exceptions are disabled in this example - (CONFIG_UCLIBCXX_EXCEPTION=n). It is probably not necessary to disable + (CONFIG_CXX_EXCEPTION=n). It is probably not necessary to disable exceptions. 3. Unfortunately, this example will not run now. diff --git a/boards/sim/sim/sim/configs/cxxtest/Make.defs b/boards/sim/sim/sim/configs/cxxtest/Make.defs index 3a967ce5d9..e6d5258d2f 100644 --- a/boards/sim/sim/sim/configs/cxxtest/Make.defs +++ b/boards/sim/sim/sim/configs/cxxtest/Make.defs @@ -32,7 +32,7 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y) endif ARCHCPUFLAGS = -fno-builtin -ifeq ($(CONFIG_UCLIBCXX_EXCEPTION),y) +ifeq ($(CONFIG_CXX_EXCEPTION),y) ARCHCPUFLAGSXX = -fno-builtin else ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fcheck-new diff --git a/boards/sim/sim/sim/configs/cxxtest/defconfig b/boards/sim/sim/sim/configs/cxxtest/defconfig index 48325b92a4..217551a2e9 100644 --- a/boards/sim/sim/sim/configs/cxxtest/defconfig +++ b/boards/sim/sim/sim/configs/cxxtest/defconfig @@ -5,7 +5,7 @@ # You can then do "make savedefconfig" to generate a new defconfig file that includes your # modifications. # -# CONFIG_UCLIBCXX_EXCEPTION is not set +# CONFIG_CXX_EXCEPTION is not set CONFIG_ARCH="sim" CONFIG_ARCH_BOARD="sim" CONFIG_ARCH_BOARD_SIM=y diff --git a/libs/libxx/Kconfig b/libs/libxx/Kconfig index 2079617efe..0d84e23dce 100644 --- a/libs/libxx/Kconfig +++ b/libs/libxx/Kconfig @@ -31,10 +31,15 @@ config HAVE_CXXINITIALIZE toolchain (via up_cxxinitialize()). config CXX_EXCEPTION - bool + bool "Enable Exception Support" + default LIBCXX || UCLIBCXX config CXX_LIBSUPCXX - bool + bool "Have libsupc++ (required)" + default LIBCXX || UCLIBCXX + ---help--- + Select if your toolchain provides libsupc++. This option is required + at present because the built-in libsupc++ support is incomplete. comment "LLVM C++ Library (libcxx)" @@ -49,23 +54,6 @@ config LIBCXX be built by selecting this option. See the README.txt file in the libcxx package for information on installing libcxx. -if LIBCXX - -config LIBCXX_EXCEPTION - bool "Enable Exception Support" - default y - select CXX_EXCEPTION - -config LIBCXX_HAVE_LIBSUPCXX - bool "Have libsupc++ (required)" - default y - select CXX_LIBSUPCXX - ---help--- - Select if your toolchain provides libsupc++. This option is required - at present because the built-in libsupc++ support is incomplete. - -endif - comment "uClibc++ Standard C++ Library" config UCLIBCXX @@ -78,22 +66,9 @@ config UCLIBCXX if UCLIBCXX -config UCLIBCXX_EXCEPTION - bool "Enable Exception Support" - default y - select CXX_EXCEPTION - config UCLIBCXX_IOSTREAM_BUFSIZE int "IO Stream Buffer Size" default 32 -config UCLIBCXX_HAVE_LIBSUPCXX - bool "Have libsupc++ (required)" - default y - select CXX_LIBSUPCXX - ---help--- - Select if your toolchain provides libsupc++. This option is required - at present because the built-in libsupc++ support is incomplete. - endif endif diff --git a/libs/libxx/Makefile b/libs/libxx/Makefile index 423e6599b5..03d11a1530 100644 --- a/libs/libxx/Makefile +++ b/libs/libxx/Makefile @@ -35,17 +35,7 @@ include $(TOPDIR)/Make.defs -CXXSRCS = libxx_cxapurevirtual.cxx libxx_eabi_atexit.cxx libxx_cxa_atexit.cxx -CXXSRCS += libxx_cxa_guard.cxx - -# Some of the libs/libxx/ files are not need if uClibc++ or libcxx is installed -# because uClibx++ or libcxx will replace them - -ifeq (,$(findstring y,$(CONFIG_UCLIBCXX) $(CONFIG_LIBCXX))) -CXXSRCS += libxx_delete.cxx libxx_delete_sized.cxx libxx_deletea.cxx -CXXSRCS += libxx_deletea_sized.cxx libxx_new.cxx libxx_newa.cxx -CXXSRCS += libxx_stdthrow.cxx -endif +CXXSRCS = libxx_cxa_atexit.cxx libxx_eabi_atexit.cxx # Include the uClibc++ Make.defs file if selected. If it is included, # the uClibc++/Make.defs file will add its files to the source file list, @@ -59,10 +49,10 @@ endif ifeq ($(CONFIG_UCLIBCXX),y) include uClibc++/Make.defs -endif - -ifeq ($(CONFIG_LIBCXX),y) +else ifeq ($(CONFIG_LIBCXX),y) include libcxx/Make.defs +else +include cxx.defs endif # Object Files diff --git a/libs/libxx/cxx.defs b/libs/libxx/cxx.defs new file mode 100644 index 0000000000..547b61cffd --- /dev/null +++ b/libs/libxx/cxx.defs @@ -0,0 +1,24 @@ +############################################################################ +# libs/libxx/cxx.defs +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +########################################################################### + +CXXSRCS += libxx_cxa_guard.cxx libxx_cxapurevirtual.cxx +CXXSRCS += libxx_delete.cxx libxx_delete_sized.cxx libxx_deletea.cxx +CXXSRCS += libxx_deletea_sized.cxx libxx_new.cxx libxx_newa.cxx +CXXSRCS += libxx_stdthrow.cxx