From ac7e5de5ae2548914c74b39fe2903c8f33a900bf Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sat, 27 Jun 2020 17:20:25 +0800 Subject: [PATCH] libxx: Integrate uClibc++ latest official release Signed-off-by: Xiang Xiao Change-Id: I05377a0a7674f1cbe461ce67960bd3dc62729337 --- boards/arm/stm32/stm32f4discovery/README.txt | 2 +- libs/libxx/.gitignore | 1 + libs/libxx/Kconfig | 4 +- libs/libxx/Makefile | 8 +- libs/libxx/system_configuration.h | 104 +++++++++++++++++++ libs/libxx/uClibc++.defs | 48 +++++++++ tools/Makefile.unix | 1 + tools/Makefile.win | 1 + 8 files changed, 163 insertions(+), 6 deletions(-) create mode 100644 libs/libxx/system_configuration.h create mode 100644 libs/libxx/uClibc++.defs diff --git a/boards/arm/stm32/stm32f4discovery/README.txt b/boards/arm/stm32/stm32f4discovery/README.txt index 18dfb7dac5..37b07a83bd 100644 --- a/boards/arm/stm32/stm32f4discovery/README.txt +++ b/boards/arm/stm32/stm32f4discovery/README.txt @@ -1395,7 +1395,7 @@ Configuration Sub-directories CONFIG_UCLIBCXX=y CONFIG_CXX_EXCEPTION=y CONFIG_CXX_LIBSUPCXX=y - CONFIG_UCLIBCXX_IOSTREAM_BUFSIZE=32 + CONFIG_UCLIBCXX_BUFSIZE=32 CONFIG_EXAMPLES_ELF_CXX=y diff --git a/libs/libxx/.gitignore b/libs/libxx/.gitignore index 94aaae4d8e..1c8d3b1e24 100644 --- a/libs/libxx/.gitignore +++ b/libs/libxx/.gitignore @@ -1,2 +1,3 @@ /uClibc++ /libcxx +uClibc++.tar.gz diff --git a/libs/libxx/Kconfig b/libs/libxx/Kconfig index 0d84e23dce..798ce4bed7 100644 --- a/libs/libxx/Kconfig +++ b/libs/libxx/Kconfig @@ -66,8 +66,8 @@ config UCLIBCXX if UCLIBCXX -config UCLIBCXX_IOSTREAM_BUFSIZE - int "IO Stream Buffer Size" +config UCLIBCXX_BUFSIZE + int "IO Stream/Container Buffer Size" default 32 endif diff --git a/libs/libxx/Makefile b/libs/libxx/Makefile index 03d11a1530..99ac158631 100644 --- a/libs/libxx/Makefile +++ b/libs/libxx/Makefile @@ -48,7 +48,7 @@ CXXSRCS = libxx_cxa_atexit.cxx libxx_eabi_atexit.cxx # in the NuttX uClibc++ GIT repository for more information ifeq ($(CONFIG_UCLIBCXX),y) -include uClibc++/Make.defs +include uClibc++.defs else ifeq ($(CONFIG_LIBCXX),y) include libcxx/Make.defs else @@ -68,7 +68,7 @@ OBJS = $(AOBJS) $(COBJS) $(CXXOBJS) $(CPPOBJS) BIN = libxx$(LIBEXT) all: $(BIN) -.PHONY: depend clean distclean +.PHONY: depend clean distclean dirlinks $(AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -85,6 +85,8 @@ $(CPPOBJS): %$(OBJEXT): %.cpp $(BIN): $(OBJS) $(call ARCHIVE, $@, $(OBJS)) +dirlinks:: + .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(DEPPATH) "$(CXX)" -- $(CXXFLAGS) -- $(SRCS) >Make.dep $(Q) touch $@ @@ -95,7 +97,7 @@ clean: $(call DELFILE, $(BIN)) $(call CLEAN) -distclean: clean +distclean:: clean $(call DELFILE, Make.dep) $(call DELFILE, .depend) diff --git a/libs/libxx/system_configuration.h b/libs/libxx/system_configuration.h new file mode 100644 index 0000000000..ea575e4173 --- /dev/null +++ b/libs/libxx/system_configuration.h @@ -0,0 +1,104 @@ +/**************************************************************************** + * libs/libxx/system_configuration.h + * + * 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. + * + ****************************************************************************/ + +#ifndef SYSTEM_CONFIGURATION_H +#define SYSTEM_CONFIGURATION_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Version Number */ + +#define __UCLIBCXX_MAJOR__ 0 +#define __UCLIBCXX_MINOR__ 2 +#define __UCLIBCXX_SUBLEVEL__ 6-git + +/* Target Features and Options */ + +#ifdef CONFIG_HAVE_FLOAT +# define __UCLIBCXX_HAS_FLOATS__ 1 +#endif +#ifdef CONFIG_HAVE_LONG_DOUBLE +# define __UCLIBCXX_HAS_LONG_DOUBLE__ 1 +#endif +#undef __UCLIBCXX_HAS_TLS__ +#define __UCLIBCXX_WARNINGS__ "-Wall" +#define __BUILD_EXTRA_LIBRARIES__ "" +#define __HAVE_DOT_CONFIG__ 1 + +/* String and I/O Stream Support */ + +#ifdef CONFIG_LIBC_WCHAR +# define __UCLIBCXX_HAS_WCHAR__ 1 +#endif +#define __UCLIBCXX_IOSTREAM_BUFSIZE__ CONFIG_UCLIBCXX_BUFSIZE +#undef __UCLIBCXX_HAS_LFS__ +#define __UCLIBCXX_SUPPORT_CDIR__ 1 +#define __UCLIBCXX_SUPPORT_CIN__ 1 +#define __UCLIBCXX_SUPPORT_COUT__ 1 +#define __UCLIBCXX_SUPPORT_CERR__ 1 +#define __UCLIBCXX_SUPPORT_CLOG__ 1 +#ifdef CONFIG_LIBC_WCHAR +# define __UCLIBCXX_SUPPORT_WCIN__ 1 +# define __UCLIBCXX_SUPPORT_WCOUT__ 1 +# define __UCLIBCXX_SUPPORT_WCERR__ 1 +# define __UCLIBCXX_SUPPORT_WCLOG__ 1 +#endif + +/* STL and Code Expansion */ + +#define __UCLIBCXX_STL_BUFFER_SIZE__ CONFIG_UCLIBCXX_BUFSIZE +#define __UCLIBCXX_CODE_EXPANSION__ 1 +#define __UCLIBCXX_EXPAND_CONSTRUCTORS_DESTRUCTORS__ 1 +#define __UCLIBCXX_EXPAND_STRING_CHAR__ 1 +#define __UCLIBCXX_EXPAND_VECTOR_BASIC__ 1 +#define __UCLIBCXX_EXPAND_IOS_CHAR__ 1 +#define __UCLIBCXX_EXPAND_STREAMBUF_CHAR__ 1 +#define __UCLIBCXX_EXPAND_ISTREAM_CHAR__ 1 +#define __UCLIBCXX_EXPAND_OSTREAM_CHAR__ 1 +#define __UCLIBCXX_EXPAND_FSTREAM_CHAR__ 1 +#define __UCLIBCXX_EXPAND_SSTREAM_CHAR__ 1 + +/* Library Installation Options */ + +#define __UCLIBCXX_RUNTIME_PREFIX__ "/usr/uClibc++" +#define __UCLIBCXX_RUNTIME_INCLUDE_SUBDIR__ "/include" +#define __UCLIBCXX_RUNTIME_LIB_SUBDIR__ "/lib" +#define __UCLIBCXX_RUNTIME_BIN_SUBDIR__ "/bin" +#ifdef CONFIG_CXX_EXCEPTION +# define __UCLIBCXX_EXCEPTION_SUPPORT__ 1 +#endif +#undef __IMPORT_LIBSUP__ +#undef __IMPORT_LIBGCC_EH__ +#define __BUILD_STATIC_LIB__ 1 +#define __BUILD_ONLY_STATIC_LIB__ +#ifdef CONFIG_DEBUG_ASSERTIONS +# define __DODEBUG__ 1 +#endif + +#endif /* SYSTEM_CONFIGURATION_H */ diff --git a/libs/libxx/uClibc++.defs b/libs/libxx/uClibc++.defs new file mode 100644 index 0000000000..c0f80add79 --- /dev/null +++ b/libs/libxx/uClibc++.defs @@ -0,0 +1,48 @@ +############################################################################ +# libs/libxx/libcxx.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=0.2.5 + +$(TOPDIR)/include/uClibc++: + $(Q) wget https://git.busybox.net/uClibc++/snapshot/uClibc++-$(VERSION).tar.gz -O uClibc++.tar.gz + $(Q) tar -xzf uClibc++.tar.gz + $(Q) mv uClibc++-$(VERSION) uClibc++ + $(Q) $(DIRLINK) $(CURDIR)/uClibc++/include $(TOPDIR)/include/uClibc++ + $(Q) $(COPYFILE) $(CURDIR)/system_configuration.h $(TOPDIR)/include/uClibc++ + +dirlinks:: $(TOPDIR)/include/uClibc++ + +distclean:: + $(Q) $(DELFILE) $(TOPDIR)/include/uClibc++/system_configuration.h + $(Q) $(DIRUNLINK) $(TOPDIR)/include/uClibc++ + $(Q) $(DELFILE) uClibc++.tar.gz + +CPPSRCS += algorithm.cpp associative_base.cpp bitset.cpp char_traits.cpp +CPPSRCS += complex.cpp del_op.cpp del_opnt.cpp del_ops.cpp del_opv.cpp +CPPSRCS += del_opvnt.cpp del_opvs.cpp deque.cpp exception.cpp fstream.cpp +CPPSRCS += func_exception.cpp iomanip.cpp ios.cpp iostream.cpp istream.cpp +CPPSRCS += iterator.cpp limits.cpp list.cpp locale.cpp map.cpp new_handler.cpp +CPPSRCS += new_op.cpp new_opnt.cpp new_opv.cpp new_opvnt.cpp numeric.cpp +CPPSRCS += ostream.cpp queue.cpp set.cpp sstream.cpp stack.cpp stdexcept.cpp +CPPSRCS += streambuf.cpp string.cpp typeinfo.cpp utility.cpp valarray.cpp +CPPSRCS += vector.cpp + +DEPPATH += --dep-path uClibc++/src +VPATH += uClibc++/src diff --git a/tools/Makefile.unix b/tools/Makefile.unix index b9a44d04fc..6f0e00c74d 100644 --- a/tools/Makefile.unix +++ b/tools/Makefile.unix @@ -313,6 +313,7 @@ ifneq ($(CONFIG_ARCH_CHIP),) endif dirlinks: include/arch include/arch/board include/arch/chip $(ARCH_SRC)/board $(ARCH_SRC)/chip drivers/platform + $(Q) $(MAKE) -C libs/libxx dirlinks TOPDIR="$(TOPDIR)" $(Q) $(MAKE) -C boards dirlinks TOPDIR="$(TOPDIR)" $(Q) $(MAKE) -C openamp dirlinks TOPDIR="$(TOPDIR)" $(Q) $(MAKE) -C $(CONFIG_APPS_DIR) dirlinks TOPDIR="$(TOPDIR)" diff --git a/tools/Makefile.win b/tools/Makefile.win index 4681093265..4c55deb873 100644 --- a/tools/Makefile.win +++ b/tools/Makefile.win @@ -292,6 +292,7 @@ ifneq ($(CONFIG_ARCH_CHIP),) endif dirlinks: include\arch include\arch\board include\arch\chip $(ARCH_SRC)\board $(ARCH_SRC)\chip drivers\platform + $(Q) $(MAKE) -C libs/libxx dirlinks TOPDIR="$(TOPDIR)" $(Q) $(MAKE) -C boards dirlinks TOPDIR="$(TOPDIR)" $(Q) $(MAKE) -C openamp dirlinks TOPDIR="$(TOPDIR)" $(Q) $(MAKE) -C $(CONFIG_APPS_DIR) dirlinks TOPDIR="$(TOPDIR)"