libxx: Unify uClibc++ and libc++ config

code just need check CONFIG_CXX_EXCEPTION/CONFIG_CXX_LIBSUPCXX now,
instead uClibc++/libc++ specific config

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I3b00a5a6701b8bf1c70de89f2d924592ca3e38b0
This commit is contained in:
Xiang Xiao 2020-06-28 23:03:57 +08:00 committed by Alan Carvalho de Assis
parent 9db5d2aeea
commit 6abd03d53f
13 changed files with 47 additions and 58 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

24
libs/libxx/cxx.defs Normal file
View file

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