Commit Graph

162 Commits

Author SHA1 Message Date
wangmingrong1 d13dc86f16 libxx/patch: Remove jira information and change-id
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-11-01 23:01:16 +08:00
cuiziwei 12fd5ec472 nuttx: Add LIBSUPCXX_TOOLCHAIN to link the prebuilt library provide by toolchain.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-24 01:38:03 +08:00
cuiziwei 7e925dbeaa libxx: C++ low level library select LIBSUPCXX by default.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-23 20:09:16 +08:00
cuiziwei 35c278b716 libcxx: Ignore compile warnings.
nuttx/libs/libxx/libcxx/src/support/runtime/exception_pointer_unimplemented.ipp:17:4: warning: #warning exception_ptr not yet implemented [-Wcpp]
17 | #  warning exception_ptr not yet implemented
   |    ^~~~~~~

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-21 15:06:42 +02:00
jihandong 444ba4caa4 libcxx: optional localization.
Signed-off-by: jihandong <jihandong@xiaomi.com>
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-19 14:34:38 +08:00
jihandong 100c43c8c3 libcxx: optional wide characters support.
Disable wchar can reduce approximately 1/3 of the libcxx.
mainly from locale, string and streams.

Platform: sim
Figures: bin size in bytes.

   Size   | Description
----------+------------------------------------------------
 10045336 | Base, enable libcxx whithout any cxx programs.
 42067224 | Add cxxtest.
 29997304 | Disable libcxx wchar support.

Signed-off-by: jihandong <jihandong@xiaomi.com>
2024-10-19 14:34:38 +08:00
cuiziwei 499de61ec3 libxx: Globally reference the header file of libcxxabi and remove duplication code.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-16 20:05:17 +08:00
wangmingrong1 bf70cd2bce bug/fix: Makefile expression error caused
expr: syntax error: unexpected argument "12"
expr: syntax error: unexpected argument "12"

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-16 15:35:04 +08:00
raiden00pl c393416580 libs/libxx: uClibc depends on CONFIG_ALLOW_GPL_COMPONENTS=y
uClibc is LGPL so it should depends on CONFIG_ALLOW_GPL_COMPONENTS=y
2024-10-16 07:56:50 +08:00
cuiziwei 9d9857acd2 Change the judgment of GCCVER version to greater equal.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-15 23:32:13 +08:00
cuiziwei bbf60ec685 gnu++20:fix ld error.
LD: nuttx
arm-none-eabi-ld: warning: net_sendfile.o: missing .note.GNU-stack section implies executable stack
arm-none-eabi-ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
arm-none-eabi-ld: warning: nuttx/nuttx has a LOAD segment with RWX permissions
arm-none-eabi-ld: apps/staging/libfeature.a(feature_framework.cpp.frameworks.base.feature_1.o): in function `std::__1::__throw_length_error[abi:un170006](char const*)':

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-15 12:57:52 +08:00
cuiziwei 7246533aeb Unify the definition of GCCVER and remove duplicate code.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-13 11:41:22 +08:00
cuiziwei 39576af753 libcxxabi: Optimize cxx code size
enable LIBSUPCXX:
text data bss dec hex filename
93080 592 5472 99144 18348 nuttx/nuttx

enable LIBCXXABI:
before:
text data bss dec hex filename
126468 352 5960 132780 206ac nuttx/nuttx

after:
text data bss dec hex filename
68048 352 5960 74360 12278 nuttx/nuttx

Summary:
Optimize text segment code size by about 46%.

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-09 01:35:13 +08:00
cuiziwei 97359a7f76 nuttx/libxx: Simplify compilation warnings for passing CXXFLAGS.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-07 00:46:45 +08:00
Alin Jerpelea d56c16e2b8 libs/libxx: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-10-01 12:25:52 +08:00
chenrun1 0d46c68731 libxx:fix build error when enable LIBCXXTOOLCHAIN
Summary:
  P:➜  nuttx git:(4cec713dbf) LC_ALL=C make
CC:  chip/stm32_gpio.c chip/stm32_gpio.c:41:11: note: '#pragma message: CONFIG_STM32_USE_LEGACY_PINMAP will be deprecated migrate board.h see tools/stm32_pinmap_tool.py'
   41 | #  pragma message "CONFIG_STM32_USE_LEGACY_PINMAP will be deprecated migrate board.h see tools/stm32_pinmap_tool.py"
      |           ^~~~~~~
CXX:  libcxxmini/libxx_new.cxx libcxxmini/libxx_new.cxx:72:11: error: redefinition of 'void* operator new(std::size_t, void*)'
   72 | FAR void *operator new(std::size_t nbytes, FAR void *ptr)
      |           ^~~~~~~~
In file included from /usr/include/newlib/c++/13.2.1/bits/atomic_base.h:36,
                 from /usr/include/newlib/c++/13.2.1/atomic:41,
                 from /home/leduc/wdc_workspace/src/autre/nuttx_dev/nuttx/include/nuttx/atomic.h:32,
                 from /home/leduc/wdc_workspace/src/autre/nuttx_dev/nuttx/include/nuttx/fs/fs.h:38,
                 from /home/leduc/wdc_workspace/src/autre/nuttx_dev/nuttx/include/nuttx/lib/lib.h:30,
                 from libcxxmini/libxx_new.cxx:29:
/usr/include/newlib/c++/13.2.1/new:174:33: note: 'void* operator new(std::size_t, void*)' previously defined here
  174 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
      |                                 ^~~~~~~~
make[1]: *** [Makefile:69: libxx_new.o] Error 1
make: *** [tools/LibTargets.mk:216: libs/libxx/libxx.a] Error 2

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-27 21:43:04 +08:00
SPRESENSE 53bbf797da libcxx: Apply 0001_fix_stdatomic_h_miss_typedef.patch to libcxx.defs
0001_fix_stdatomic_h_miss_typedef.patch is only applied to cmake,
so apply it to Makefile as well.
2024-09-27 17:10:17 +08:00
Masayuki Ishikawa df298c186f Revert "build depend:Revert Make.dep intermediate ddc file"
This reverts commit ddc3119c4e.
2024-09-15 19:29:47 +08:00
xuxin19 ddc3119c4e build depend:Revert Make.dep intermediate ddc file
Revert "Parallelize depend file generation"
This reverts commit d5b6ec450f.

parallel depend ddc does not significantly speed up compilation,
intermediately generated .ddc files can cause problems if compilation is interrupted unexpectedly

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:01:58 +08:00
yinshengkai a055734912 libcxx: adds tls&libcxxabi dependency
If libcxxabi is not enabled, the toolchain default implementation will be used. However, arm-gcc does not enable thread
support by default, which will cause errors in a multi-threaded environment.

libcxx depends on pthread_key_create

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-06 09:52:33 +08:00
yinshengkai 6d39b248a4 libcxxabi: fix compilation warnings
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-06 09:52:33 +08:00
yinshengkai ad76a4f7a9 libcxxabi: libcxxabi enables exceptions by default
In the following code, even though the application does not use exceptions, an exception is still thrown in libcxx

If libcxxabi is not enabled, the toolchain default implementation will be used. However, arm-gcc does not enable thread
support by default, which will cause errors in a multi-threaded environment.

Therefore, we need to use libcxxabi to ensure normal functions in a multi-threaded environment.

using namespace std;

void foo(bool recur);
int bar(bool recur)
{
  if (recur) {
      foo(false);
  }
  return 0xFAFAFA;
}

void foo(bool recur)
{
  static int i = bar(recur);
  cout << "Static is:" << i << "\n";
}

int main(int argc, char *argv[])
{
  foo(true);
  return 0;
}

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-06 09:52:33 +08:00
yinshengkai b721f2c84e libcxx: Disable dynamic type checking when enabling libcxxabi
It results in a recursive call, cxxabiv1::__dynamic_case -> is_equal -> __ubsan::checkDynamic -> cxxabiv1::__dynamic_case

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-06 09:52:33 +08:00
Petro Karashchenko d499ac9d58 nuttx: fix multiple 'FAR', 'CODE' and style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
simbit18 d1789d84e8 fix nxstyle
fix Relative file path does not match actual file.
2024-05-13 22:24:36 +02:00
Philippe Leduc 3dc6b4c9bd Add basic support for locales in order to C++ streams to build and work for simple cases (POSIX / C locale).
Fix build with C++ GCC toolchain
2024-04-29 17:34:10 +08:00
xuxin19 859247c224 cmake:enhance set_source_files_properties for NuttX CMake module
Because `set_source_files_properties` in cmake will overwrite the properties instead of appending them.
This module implements addition and deletion by
first `getting_source_file_property` and then `set_source_files_properties`

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-04-18 14:57:58 -03:00
xuxin19 2c9d46f176 cmake:enable libxx for CMake build
distinguish whether to add the CXX header file search path
according to the target Language.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-03-15 01:28:53 +08:00
wangmingrong d4b5991589 libcxxabi: Path <cxxabi.h> not found
./helloxx_main.cxx:29:10: fatal error: cxxabi.h: No such file or directory
   29 | #include <cxxabi.h>
      |          ^~~~~~~~~~
CONFIG_LIBCXXABI is turned on, but the library include is not linked to nuttx/include, causing the compilation to fail.

Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2024-03-14 22:47:55 +08:00
trns1997 54e9e582d5 Use C++ standard lib from toolchain
Signed-off-by: trns1997 <trns1997@gmail.com>
2024-03-06 08:42:44 +08:00
Petro Karashchenko 5495ff4d78 libs/libxx: add patch to remove mach/mach_time.h inclusion
Inclusion of mach/mach_time.h by libcxx/src/chrono.cpp breaks
the build on latest MACOS dues to https://forums.developer.apple.com/forums/thread/746737
The interface from mach/mach_time.h is not referenced in chrono.cpp
so it is safe to remove it

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-02-16 10:42:23 -08:00
Zhe Weng b8e0423b74 libcxx: Fix CMake compile with correct CMAKE_CXX_STANDARD
It seems libcxx needs C++20 from 12.0.0 to 17.0.6: 3b625060fc

But we're setting CMAKE_CXX_STANDARD to 17, errors on my side:

nuttx/libs/libxx/libcxx/src/include/to_chars_floating_point.h:122:46: error: ‘bit_cast’ is not a member of ‘std’
  122 |     const _Uint_type _Uint_value    = _VSTD::bit_cast<_Uint_type>(_Value);
      |                                              ^~~~~~~~
nuttx/libs/libxx/libcxx/src/memory_resource_init_helper.h:2:8: error: ‘constinit’ does not name a type
    2 | static constinit ResourceInitHelper res_init _LIBCPP_INIT_PRIORITY_MAX;
      |        ^~~~~~~~~
nuttx/libs/libxx/libcxx/src/memory_resource_init_helper.h:2:8: note: C++20 ‘constinit’ only available with ‘-std=c++20’ or ‘-std=gnu++20’

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-01-16 21:54:30 -08:00
YAMAMOTO Takashi 7d6612d0e5 libcxxabi.cmake: fix build error
This tries to mirror the following change.
```
commit c260fee516
Author: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
Date:   Tue Aug 31 14:47:13 2021 -0300

    libs/libxx: Enforce RTTI for building libcxxabi

    It is okay for the application to be built without RTTI (-fno-rrti), but
    libcxxabi requires RTTI at least for the library.

    Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
```
2024-01-04 07:20:04 -08:00
YAMAMOTO Takashi bb053f137d libcxxabi.cmake: remove a patch which no longer exists
the patch has been removed in the following change.
```
commit 4f90a6140c
Author: Stuart Ianna <stuart.ianna@motec.com.au>
Date:   Mon Jan 23 09:08:00 2023 +1100

    libcxx: Remove exiting patches and update libcxx version to 15.0.7

     - Add __config_site for NuttX.
       In libcxx 12.0.0. CMake concatenated __config_site with _config,
       which enabled NuttX to build without its inclusion. In 15.0.7, this
       file is configured by CMake and included explicitly in __config.
     - Add additional include directories.
     - Mute always_inline warning.
     - Make the download of libcxx/libcxxabi configurable
```
2024-01-04 07:20:04 -08:00
YAMAMOTO Takashi 23db901bb3 libcxxabi.cmake: fix download
don't forget to expand CONFIG_LIBCXXABI_VERSION
2024-01-04 07:20:04 -08:00
YAMAMOTO Takashi 3e4bc9bcef libcxx.defs: appease "expr: syntax error" messages with clang 2024-01-04 13:01:42 +01:00
xuxin19 87553e71f8 cmake build file support with libcxx 17.0.6
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-12-18 20:38:10 -08:00
ThomasNS 224be61f5a upgrade llvm version to 17.0.6 and set default nuttx math lib as default 2023-12-17 03:39:26 -08:00
zhanghongyu 68a6f1090c libcxx.cmake: remove useless code
removes test code that was accidentally incorporated earlier.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-12-14 03:02:15 -08:00
zhanghongyu fb5c9975cc libcxx: fix build error.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-12-06 07:56:17 -08:00
raiden00pl 5b87fdfb9d Documentation: remove all migrated READMEs 2023-10-29 21:03:54 -03:00
Stuart Ianna ad9f6b79e0 libs/libcxx: Silence warnings when building libcxx.
Silence two warnings when building libcxx with GCC 12.2.0 and std=c++2b:

libcxx/src/charconv.cpp_CXXFLAGS += -Wno-attributes
 - Results from libcxx fallback to use __always_inline__ when exclude_from_explicit_instantiation isn't available.

libcxx/src/locale.cpp_CXXFLAGS += -Wno-attributes
 - Results from the expansion of _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS. Should be fine to ignore.
2023-10-26 09:07:17 +02:00
Lee Lup Yuen 6cad7e9582 arm, arm64, xtensa, libxx: Change sed -r to sed -E to support macOS
When we build NuttX on macOS, it shows many `sed` messages (and the build still completes successfully):

```text
$ tools/configure.sh pinephone:nsh
$ make
sed: illegal option -- r
```

This is due to the Makefiles executing `sed -r` which is not a valid option on macOS.

This PR proposes to change `sed -r` to `sed -E` because:

- `sed -E` on macOS is equivalent to `sed -r` on Linux

- `sed -E` and `sed -r` are aliases according to the GNU `sed` Manual

- `sed -E` is already used in nuttx_add_romfs.cmake, nuttx_add_symtab.cmake and process_config.sh
2023-10-10 11:36:32 +03:00
SPRESENSE bf6606f80c libxx: Use gnu++20 option only if using libcxx
Fix an issue that gnu++20 option is always used.
Essentially, when cxx is not used, gnu++17 should be retained.
2023-10-05 13:09:20 +08:00
Xiang Xiao 381c7dd747 Fix error: unknown warning option '-Wno-unqualified-std-cast-call'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-24 08:40:10 +03:00
Stuart Ianna 4f90a6140c libcxx: Remove exiting patches and update libcxx version to 15.0.7
- Add __config_site for NuttX.
   In libcxx 12.0.0. CMake concatenated __config_site with _config,
   which enabled NuttX to build without its inclusion. In 15.0.7, this
   file is configured by CMake and included explicitly in __config.
 - Add additional include directories.
 - Mute always_inline warning.
 - Make the download of libcxx/libcxxabi configurable
2023-09-24 08:40:10 +03:00
Xiang Xiao d6453cfc3c libxx: Change the default value of CXX_STANDARD to gnu++20
since llvm libcxx 15.0.7 require c++20 feature to pass the build

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-24 08:40:10 +03:00
Petro Karashchenko 587f01a5e2 libs/libxx/libcxx: fix CI compilation issue reported on MACOS
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-09-19 01:17:17 +08:00
dongjiuzhu1 4763ca849a libxx/libcxx: select PTHREAD_MUTEX_TYPES to support recursive mutex
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-18 15:34:44 +08:00
wangming9 61a38ca680 libs/libxx/libcxx: Fix compilation warnings
Summary
Workaround the following warning with "GCC 12"
CXX:  libcxxabi/src/cxa_demangle.cpp In file included from libcxx/src/locale.cpp:15:
In member function 'std::__1::_EnableIf<std::__1::__is_cpp17_forward_iterator<_ForwardIterator>::value> std::__1::basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = const wchar_t*; _CharT = wchar_t; _Traits = std::__1::char_traits<wchar_t>; _Allocator = std::__1::allocator<wchar_t>]',    inlined from 'std::__1::basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator, _InputIterator) [with _InputIterator = const wchar_t*; <template-parameter-2-2> = void; _CharT = wchar_t; _Traits = std::__1::char_traits<wchar_t>; _Allocator = std::__1::allocator<wchar_t>]' at include/libcxx/string:2182:11,
    inlined from 'virtual int std::__1::collate_byname<wchar_t>::do_compare(const char_type*, const char_type*, const char_type*, const char_type*) const' at libcxx/src/locale.cpp:764:33:
include/libcxx/string:2156:35: warning: 'lhs' may be used uninitialized [-Wmaybe-uninitialized]
 2156 |         this->__throw_length_error();
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~

include/libcxx/new:237:24: warning: argument 1 value '18446744073709551599' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  237 |   return ::operator new(__args...);
      |          ~~~~~~~~~~~~~~^~~~~~~~~~~

Signed-off-by: wangming9 <wangming9@xiaomi.com>
2023-09-09 17:08:23 +03:00