This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 7f48d13c47e5d8334b725f9996faa6519bb1baa5
Author: zhuyanlin <[email protected]>
AuthorDate: Thu Aug 19 17:11:50 2021 +0800

    libc:libxx: add new low level c++ standard library support
    
    LLVM libc++abi is a new implementation of low level support for
    a standard C++ library.
    
    Change-Id: Ica9c81bd96fd27b169a06e352b0c394d47aed5b6
---
 libs/libxx/.gitignore     |  2 ++
 libs/libxx/Kconfig        | 26 +++++++++++++++++------
 libs/libxx/Makefile       |  4 ++++
 libs/libxx/libcxxabi.defs | 54 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 79 insertions(+), 7 deletions(-)

diff --git a/libs/libxx/.gitignore b/libs/libxx/.gitignore
index bdb8fd8..b0fcbb5 100644
--- a/libs/libxx/.gitignore
+++ b/libs/libxx/.gitignore
@@ -1,3 +1,5 @@
 /uClibc++
 /libcxx
+/libcxxabi
 /libcxx-*.src.tar.xz
+/libcxxabi-*.src.tar.xz
diff --git a/libs/libxx/Kconfig b/libs/libxx/Kconfig
index bee4d4e..5cdfc5d 100644
--- a/libs/libxx/Kconfig
+++ b/libs/libxx/Kconfig
@@ -50,6 +50,25 @@ config UCLIBCXX
 
 endchoice
 
+choice
+       prompt "C++ low level library select"
+       default CXX_LIBSUPCXX
+
+config LIBCXXABI
+       bool "LLVM low level C++ Library"
+       ---help---
+               LLVM "libc++abi" C++ Standard Library
+               https://libcxxabi.llvm.org/
+               Select if your use libc++abi as lower level c++ library
+
+config CXX_LIBSUPCXX
+       bool "GNU low level libsupc++"
+       ---help---
+               Select if your toolchain provides libsupc++ and use libsupc++ 
as lower
+               level c++ library.
+
+endchoice
+
 config HAVE_CXXINITIALIZE
        bool "Have C++ initialization"
        default LIBCXX || UCLIBCXX
@@ -62,13 +81,6 @@ config CXX_EXCEPTION
        bool "Enable Exception Support"
        default LIBCXX || UCLIBCXX
 
-config CXX_LIBSUPCXX
-       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.
-
 if UCLIBCXX
 
 config UCLIBCXX_BUFSIZE
diff --git a/libs/libxx/Makefile b/libs/libxx/Makefile
index 8b7ce21..d3fba0c 100644
--- a/libs/libxx/Makefile
+++ b/libs/libxx/Makefile
@@ -45,6 +45,10 @@ else
 include cxx.defs
 endif
 
+ifeq ($(CONFIG_LIBCXXABI),y)
+include libcxxabi.defs
+endif
+
 # Object Files
 
 AOBJS = $(ASRCS:.S=$(OBJEXT))
diff --git a/libs/libxx/libcxxabi.defs b/libs/libxx/libcxxabi.defs
new file mode 100644
index 0000000..c378d72
--- /dev/null
+++ b/libs/libxx/libcxxabi.defs
@@ -0,0 +1,54 @@
+############################################################################
+# libs/libxx/libcxxabi.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.
+#
+###########################################################################
+
+VERSION=12.0.0
+
+libcxxabi-$(VERSION).src.tar.xz:
+       $(Q) curl -O -L 
https://github.com/llvm/llvm-project/releases/download/llvmorg-$(VERSION)/libcxxabi-$(VERSION).src.tar.xz
+
+libcxxabi: libcxxabi-$(VERSION).src.tar.xz
+       $(Q) tar -xf libcxxabi-$(VERSION).src.tar.xz
+       $(Q) mv libcxxabi-$(VERSION).src libcxxabi
+       $(Q) touch $@
+
+distclean::
+       $(Q) $(DELFILE) libcxxabi-$(VERSION).src.tar.xz
+       $(call DELDIR, libcxxabi)
+
+context:: libcxxabi
+
+# C++ABI files
+CPPSRCS += cxa_aux_runtime.cpp cxa_default_handlers.cpp cxa_demangle.cpp 
cxa_exception_storage.cpp
+CPPSRCS += cxa_guard.cpp cxa_handlers.cpp cxa_thread_atexit.cpp cxa_vector.cpp 
cxa_virtual.cpp
+# C++ STL files
+CPPSRCS += stdlib_exception.cpp stdlib_new_delete.cpp stdlib_stdexcept.cpp 
stdlib_typeinfo.cpp
+# Internal files
+CPPSRCS += abort_message.cpp fallback_malloc.cpp private_typeinfo.cpp
+
+ifeq ($(CONFIG_CXX_EXCEPTION), y)
+CXXFLAGS += ${shell $(DEFINE) "$(CC)" LIBCXXABI_ENABLE_EXCEPTIONS}
+CPPSRCS += cxa_exception.cpp cxa_personality.cpp
+else
+CPPSRCS += cxa_noexception.cpp
+endif
+
+DEPPATH += --dep-path libcxxabi/src
+VPATH += libcxxabi/src
+

Reply via email to