Commit Graph

51 Commits

Author SHA1 Message Date
Alin Jerpelea 9dd35d8d83 libcxx: : Author Gregory Nutt: update licenses to Apache
Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-25 01:44:30 -08:00
chao.an 37b5b7137f libs/libxx: use built-in __aeabi_atexit() if LIBSUPCXX is enabled
ld error caused by multiple definition:

ld: arm-none-eabi/lib/thumb/v8-m.main+fp/hard/libsupc++.a(atexit_arm.o): in function `__aeabi_atexit':
atexit_arm.cc:(.text.__aeabi_atexit+0x0): multiple definition of `__aeabi_atexit';
nuttx/staging/libxx.a(libxx_eabi_atexit.o):nuttx/libs/libxx/libxx_eabi_atexit.cxx:75: first defined here

Signed-off-by: chao.an <anchao@xiaomi.com>
2021-01-16 11:15:01 -08:00
Masayuki Ishikawa 6626420e46 libs: libxx: Fix compile errors with CONFIG_DEBUG_ERROR=y
Summary:
- This commit fixes compile errors in libxx_new.cxx and libxx_newa.cxx

Impact:
- None

Testing:
- Build with spresense:nsh with CONFIG_DEBUG_ERROR=y

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-01-14 20:14:40 -06:00
dingxintong c618d0447b Add placement new and new[] function.
Signed-off-by: dingxintong <dingddding@163.com>
2021-01-14 08:35:32 -06:00
YAMAMOTO Takashi b41524f0e6 libcxx: -Wno-shadow for files including filesystem_common.h
This might be specific to gcc or Linux
as I didn't see it with clang + macOS.
2020-12-24 21:57:39 -06:00
YAMAMOTO Takashi 6481b774e4 libcxx: Disable -Wshadow for locale.cpp
This might be specific to gcc or Linux
as I didn't see it with clang + macOS.

libcxx/src/locale.cpp: In member function 'void std::__1::locale::__install_ctor(const std::__1::locale&, std::__1::locale::facet*, long int)':
libcxx/src/locale.cpp:576:62: warning: declaration of 'id' shadows a member of 'std::__1::locale' [-Wshadow]
  576 | locale::__install_ctor(const locale& other, facet* f, long id)
      |                                                              ^
In file included from /Users/yamamoto/git/nuttx/nuttx/include/libcxx/locale:181,
                 from libcxx/src/locale.cpp:16:
/Users/yamamoto/git/nuttx/nuttx/include/libcxx/__locale:203:32: note: shadowed declaration is here
  203 | class _LIBCPP_TYPE_VIS locale::id
      |                                ^~
2020-12-24 21:57:39 -06:00
YAMAMOTO Takashi 884882501c libcxx: Disable -Wshadow for barrier.cpp
This might be specific to gcc or Linux
as I didn't see it with clang + macOS.

libcxx/src/barrier.cpp: In constructor 'std::__1::__barrier_algorithm_base::__barrier_algorithm_base(ptrdiff_t&)':
libcxx/src/barrier.cpp:35:9: warning: declaration of '__expected' shadows a member of 'std::__1::__barrier_algorithm_base' [-Wshadow]
   35 |         : __expected(__expected)
      |         ^
libcxx/src/barrier.cpp:29:24: note: shadowed declaration is here
   29 |     ptrdiff_t&         __expected;
      |                        ^~~~~~~~~~
libcxx/src/barrier.cpp: In constructor 'std::__1::__barrier_algorithm_base::__barrier_algorithm_base(ptrdiff_t&)':
libcxx/src/barrier.cpp:44:5: warning: declaration of '__expected' shadows a member of 'std::__1::__barrier_algorithm_base' [-Wshadow]
   44 |     }
      |     ^
libcxx/src/barrier.cpp:29:24: note: shadowed declaration is here
   29 |     ptrdiff_t&         __expected;
      |                        ^~~~~~~~~~
libcxx/src/barrier.cpp: In constructor 'std::__1::__barrier_algorithm_base::__barrier_algorithm_base(ptrdiff_t&)':
libcxx/src/barrier.cpp:44:5: warning: declaration of '__expected' shadows a member of 'std::__1::__barrier_algorithm_base' [-Wshadow]
   44 |     }
      |     ^
libcxx/src/barrier.cpp:29:24: note: shadowed declaration is here
   29 |     ptrdiff_t&         __expected;
      |                        ^~~~~~~~~~
CXX:  libcxx/src/new.cpp
In file included from libcxx/src/new.cpp:19:
/usr/include/c++/9/cxxabi.h: In member function 'virtual bool __cxxabiv1::__pbase_type_info::__pointer_catch(const __cxxabiv1::__pbase_type_info*, void**, unsigned int) const':
/usr/include/c++/9/cxxabi.h:308:23: error: 'const class std::type_info' has no member named '__do_catch'
  308 |     return __pointee->__do_catch (thrown_type->__pointee, thr_obj, outer + 2);
      |                       ^~~~~~~~~~
2020-12-24 21:57:39 -06:00
Huang Qi 073912e232 Replace all wget with curl
wget is missing from some system (like macOS and Windows native),
it's better to use curl to simplify build environment.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2020-12-22 03:36:10 -06:00
YAMAMOTO Takashi b1878fe099 libcxx: Don't remove the downloaded file eagerly
It's convenient during development.
Also, it can be useful for offline builds.
2020-12-20 23:16:11 -06:00
YAMAMOTO Takashi dfa2949b69 libcxx: Make download+patch a separate target
So that it doesn't need to be done on every sethost.sh.
2020-12-20 23:16:11 -06:00
Matias N d5b6ec450f Parallelize depend file generation 2020-11-22 09:02:59 -03:00
Xiang Xiao b827565396 [libc++] Move the toolchain's macros undefinition to Make.defs
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-15 08:28:36 -03:00
Xiang Xiao 8bc4a5b08a [libc++] Cherry pick patches from mainline to fix warnings
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-15 08:28:36 -03:00
Xiang Xiao b23bca5cb3 libcxx: Update 0001-libcxx-Port-to-NuttX-https-nuttx.apache.org-RTOS.patch
All changes come from:
from YAMAMOTO Takashi <yamamoto@midokura.com>

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-08 13:04:43 -03:00
YAMAMOTO Takashi ff3fa805a4 libxx: Use Kconfig "choice" to specify an implemenetation
It doesn't make sense to enable both of LIBCXX and UCLIBCXX.
This commit reflects it to Kconfig.
2020-10-28 14:10:30 -03:00
YAMAMOTO Takashi 07fc24ba99 libxx: Suppress -Wmissing-exception-spec on operator new 2020-10-26 22:08:40 -07:00
YAMAMOTO Takashi 4c7bf29e35 libxx: Add exception specifier to operator delete
CXX:  libxx_delete.cxx
libxx_delete.cxx:52:6: error: 'operator delete' is missing exception
      specification 'throw()' [-Werror,-Wmissing-exception-spec]
void operator delete(FAR void *ptr)
     ^
                                    throw()
1 error generated.
2020-10-26 22:08:40 -07:00
YAMAMOTO Takashi 6aef245523 libxx: Stop mentioning libs not integrated with this version of libxx 2020-10-26 22:07:39 -07:00
YAMAMOTO Takashi caf67c817f libxx: Update README
This doc seems a bit outdated to me.
This commit is my best attempt to update it.
2020-10-26 22:07:39 -07:00
Xiang Xiao c67da1d2b5 libxx: Switch the package downloading from 11.0.0.rc1 to 11.0.0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-10-12 20:33:55 +01:00
Xiang Xiao 79d476e423 Fix libsupc++.a(vterminate.o): undefined reference to `_impure_ptr'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ibbd9d980aa642b5a23016b54de8a7808db7b3b9f
2020-08-17 13:45:56 -03:00
Xiang Xiao 6039fb48ae libxx: Integrate libc++ latest official release
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic0a5f6dd8504382c49546c05399c2ea6470cd528
2020-08-17 13:45:56 -03:00
Xiang Xiao 4ebaf12b4b libxx: Ensure uClibc++ distclean clear
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-17 13:45:56 -03:00
SPRESENSE e249a2f82f Makefile: Fix Make.dep not updated by config changes
Make.dep file should be updated by .config changed after first make.
There are 2 cases affected for this problem:

 1) Add source files by config symbol
 2) Include header files in #ifdef directive

These 2 cases may not be included in Make.dep and this may prevent the
differential build from working correctly.
2020-07-28 03:59:45 -05:00
Xiang Xiao ac7e5de5ae libxx: Integrate uClibc++ latest official release
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I05377a0a7674f1cbe461ce67960bd3dc62729337
2020-07-17 21:40:34 +01:00
Xiang Xiao 6abd03d53f 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
2020-07-13 15:08:13 -03:00
Xiang Xiao aa0d57e8ad libc: Move unwind code to libs/libc/machine/arm
because the logic:
1.only work on arm platform
2.couple with elf format

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I25dc95b5fc7b24196e2e71fdcf82d71d621ee2d3
2020-07-11 10:34:22 -07:00
Xiang Xiao c3e256e018 libxx: Make __dso_handle weak
since sim arch has to use other instance provided by host glibc
also initialize __dso_handle to self as glibc:
https://github.com/bminor/glibc/blob/master/csu/dso_handle.c#L21

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7531ae58fc4dbe4600bcb2c2c3a6cac021378bc1
2020-07-10 13:51:26 +09:00
Xiang Xiao 5da9cb3ae6 libxx: Eanble HAVE_CXXINITIALIZE automatically if LIBCXX or UCLIBCXX enable
otherwise the user is shocked that using cin/cout/cerr will crash the system

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I453427261f3e2a6e60f7dd2398f7d3bd1043a0d5
2020-07-09 13:19:54 +01:00
Xiang Xiao 8153e31753 sched: Call c++ global variables constructor inside nxtask_startup
to avoid the similar code spread around each application

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8967d647eaf2ecae47f29f83e7fa322ef1b42a02
2020-07-01 07:55:33 -06:00
Xiang Xiao 23668a4b9b build: Remove the empty variable assignment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-24 08:24:13 -06:00
Xiang Xiao dd61d3d9f9 build: Remve the unnecessary .gitignore
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-23 18:00:40 +01:00
Xiang Xiao 1a95cce1a3 build: Move .config check to the top Makefile
remove the workaround to handle the inexistence of .config/Make.defs

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-20 17:57:34 +01:00
liuhaitao 78c8b43b9c libs/libxx: add .cpp files build support
libcxx project has .cpp files inside, so add .cpp files build support
here.

Change-Id: Icd3bcb42f4ceafa5e07a9977149cb08d555a9ade
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-05-13 09:15:37 +02:00
Xiang Xiao eca7059785 Refine __KERNEL__ and CONFIG_BUILD_xxx usage in the code base
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 10:43:47 -03:00
YAMAMOTO Takashi 1ffa009c8b Revert "Don't generate .depend anymore"
This reverts commit 79af7fbf4e.

Because:

* btashton reported some issues in local builds:

  https://github.com/apache/incubator-nuttx/pull/603#issuecomment-602264860

* this might be related to the current CI breakage:

  > /bin/sh: 1: /__w/incubator-nuttx/incubator-nuttx/nuttx/tools/mkdeps: not found
2020-03-22 23:07:29 -05:00
Xiang Xiao 79af7fbf4e
Don't generate .depend anymore 2020-03-22 18:15:29 +00:00
Xiang Xiao e7d9260014 arch: Customize the typedef of size_t instead of intptr_t
To ensure size_t same as toolchain definition in the first place and rename CXX_NEWLONG to ARCH_SIZET_LONG.  The change also check whether __SIZE_TYPE__ exist before CONFIG_ARCH_SIZET_LONG so our definition can align with toolchain(gcc/clang) definition automatically.
2020-02-18 07:15:19 -06:00
Masayuki Ishikawa 81f1133174 ELF64 support (#220)
* include: Introduce elf64.h and elf.h

    Added elf64.h for 64bit ELF support and moved common definitions
    from elf32.h to elf.h. Also introduced Elf_xxx to be used in
    common libraries such as binfmt.

  * binfmt, include, modlib, module: Add support for ELF64

    Elf_xxx must be used instead of Elf32_xxx to support ELF64.
    To use ELF64, CONFIG_ELF_64BIT must be enabled.

  * binfmt, modlib: Add support for relocate address

  * arch: risc-v: Add include/elf.h

  * libs: machine: Add risc-v related files.

    NOTE: Currently only supports ELF64

  * boards: maix-bit: Add elf and posix_spawn configurations

  * boards: maix-bit: Add support for module configuration
2020-02-07 17:10:23 -06:00
Xiang Xiao 68951e8d72 Remove exra whitespace from files (#189)
* Remove multiple newlines at the end of files
* Remove the whitespace from the end of lines
2020-01-31 09:24:49 -06:00
Xiang Xiao 1e3f457c9e Remove TIME_EXTENDED option to more conform C standard
Gregory Nutt <gnutt@nuttx.org>

    Run all .c and .h files modified in this PR through nxstyle and correct all coding standard problems.

Xiang Xiao <xiaoxiang@xiaomi.com>

    Remove TIME_EXTENDED option to more conform C standard

    Note: the code/data size increment is small
2020-01-23 08:17:22 -06:00
Xiang Xiao 443255f348 Unify the c++ standard library name to libxx (#19)
libs/libxx/Makefile, and tools/*.mk:  Use common library name libxx.a, regardless of which libc++ library is selected.
2019-12-31 10:28:48 -06:00
Matias N 8ccb5fabf8 libs/libxx/Kconfig: CONFIG_LIBC_LOCALE is needed to build libcxx. A
math library is also needed, however, here are various ways to provide a
math library so CONFIG_LIBM is not now set.

boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs:  Add required
definitiions if libcxx is enabled.
2019-10-12 08:51:13 +08:00
Daniel Pereira Volpato 0566525764 libs/libxx/Kconfig: Automatically select CONFIG_CLOCK_MONOTONIC when CONFIG_LIBCXX is selected.
Remove hardcoded -DCLOCK_MONOTONIC from CFLAGS in Make.defs of several configurations.  That defintiion is now automatically adding this define when CONFIG_LIBCXX=y.
2019-09-27 12:31:08 -06:00
Juha Niskanen e8b5dd4528 Fix use of undefined pp-token #errror, other typos. 2019-09-19 18:19:18 -06:00
zhangyuan7 acd1a57bd1 libs/libxx/Makefile: Always add libxx_cxa_guard.cxx for uclibcxx. 2019-03-19 10:10:29 -06:00
Gregory Nutt 7dd81cc5c2 libs/libxx/Kconfig: utomatically select CONFIG_LIBC_WCHAR and CONFIG_TIME_EXTENDED when CONFIG_LIBCXX is selected since libcxx compile fails if without these two option 2019-01-27 07:00:07 -06:00
Xiang Xiao 38ffb98f1b Kconfig files, binfmt/libelf, libs/libc/machin, libs/libxx: Correct libcxx exception handling by introducing the generic config(CXX_EXCEPTION and CXX_LIBSUPCXX) 2019-01-26 11:23:31 -06:00
Gregory Nutt a04d2eeb10 tools/Directories.mk: Correct the path to the installed libcxx directory. 2018-09-13 14:03:09 -06:00
Xiang Xiao 467d2a58ea Replace non critical PANIC with DEBUGPANIC to save the code space 2018-08-24 06:21:15 -06:00