Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ CONFIG_HAVE_CXX=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBCXXABI=y
CONFIG_LIBC_FLOATINGPOINT=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_LOCALTIME=y
Expand All @@ -49,3 +50,6 @@ CONFIG_TLS_TASK_NELEM=8
CONFIG_USART2_RXBUFSIZE=128
CONFIG_USART2_SERIAL_CONSOLE=y
CONFIG_USART2_TXBUFSIZE=128
CONFIG_CXX_EXCEPTION=y
CONFIG_CXX_RTTI=y
CONFIG_TESTING_CXXTEST=y
6 changes: 3 additions & 3 deletions boards/risc-v/esp32c3/common/scripts/esp32c3_sections.ld
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ SECTIONS
*(.fini)
*(.gnu.version)

. += 16;
. = ALIGN(4);

_text_end = ABSOLUTE(.);
_instruction_reserved_end = ABSOLUTE(.); /* This is a symbol marking the flash.text end, this can be used for mmu driver to maintain virtual address */
Expand Down Expand Up @@ -512,6 +512,8 @@ SECTIONS
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array))
__init_array_end = ABSOLUTE(.);

_einit = ABSOLUTE(.);

/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */

. = ALIGN(4);
Expand All @@ -526,8 +528,6 @@ SECTIONS
KEEP (*(SORT_BY_INIT_PRIORITY(.esp_system_init_fn.*)))
_esp_system_init_fn_array_end = ABSOLUTE(.);

_einit = ABSOLUTE(.);

} >default_rodata_seg AT > ROM

.flash.rodata_noload (NOLOAD) :
Expand Down
59 changes: 59 additions & 0 deletions boards/risc-v/esp32c3/esp32c3-devkit/configs/testlibcxx/defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ARCH="risc-v"
CONFIG_ARCH_BOARD="esp32c3-devkit"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32C3_DEVKIT=y
CONFIG_ARCH_CHIP="esp32c3"
CONFIG_ARCH_CHIP_ESP32C3=y
CONFIG_ARCH_INTERRUPTSTACK=1536
CONFIG_ARCH_RISCV=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_LOOPSPERMSEC=15000
CONFIG_BUILTIN=y
CONFIG_FS_PROCFS=y
CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_NSH_STRERROR=y
CONFIG_PREALLOC_TIMERS=0
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_BACKTRACE=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=29
CONFIG_START_MONTH=11
CONFIG_START_YEAR=2019
CONFIG_SYSTEM_DUMPSTACK=y
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_BUILTIN=y
CONFIG_CXX_LOCALIZATION=y
CONFIG_CXX_WCHAR=y
CONFIG_EXAMPLES_HELLOXX=y
CONFIG_HAVE_CXX=y
CONFIG_LIBCXX=y
CONFIG_LIBCXXABI=y
CONFIG_CXX_EXCEPTION=y
CONFIG_CXX_RTTI=y
CONFIG_TESTING_CXXTEST=y
CONFIG_LIBC_LOCALE=y
CONFIG_TLS_NELEM=16
CONFIG_TLS_TASK_NELEM=8
CONFIG_DEFAULT_THREAD_STACKSIZE=4096
4 changes: 2 additions & 2 deletions boards/risc-v/esp32c6/common/scripts/esp32c6_sections.ld
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,8 @@ SECTIONS
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array))
__init_array_end = ABSOLUTE(.);

_einit = ABSOLUTE(.);

/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */

. = ALIGN(4);
Expand All @@ -538,8 +540,6 @@ SECTIONS
KEEP (*(SORT_BY_INIT_PRIORITY(.esp_system_init_fn.*)))
_esp_system_init_fn_array_end = ABSOLUTE(.);

_einit = ABSOLUTE(.);

} >default_rodata_seg AT > ROM

.flash.rodata_noload (NOLOAD) :
Expand Down
4 changes: 2 additions & 2 deletions boards/risc-v/esp32h2/common/scripts/esp32h2_sections.ld
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,8 @@ SECTIONS
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .init_array))
__init_array_end = ABSOLUTE(.);

_einit = ABSOLUTE(.);

/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */

. = ALIGN(4);
Expand All @@ -536,8 +538,6 @@ SECTIONS
KEEP (*(SORT_BY_INIT_PRIORITY(.esp_system_init_fn.*)))
_esp_system_init_fn_array_end = ABSOLUTE(.);

_einit = ABSOLUTE(.);

} >default_rodata_seg AT > ROM

.flash.rodata_noload (NOLOAD) :
Expand Down
1 change: 1 addition & 0 deletions boards/xtensa/esp32/common/scripts/esp32_sections.ld
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ SECTIONS
__init_array_start = ABSOLUTE(.);
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .ctors SORT(.ctors.*)))
__init_array_end = ABSOLUTE(.);

_einit = ABSOLUTE(.);

/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
Expand Down
1 change: 1 addition & 0 deletions boards/xtensa/esp32s2/common/scripts/esp32s2_sections.ld
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ SECTIONS
__init_array_start = ABSOLUTE(.);
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .ctors SORT(.ctors.*)))
__init_array_end = ABSOLUTE(.);

_einit = ABSOLUTE(.);

/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
Expand Down
1 change: 1 addition & 0 deletions boards/xtensa/esp32s3/common/scripts/esp32s3_sections.ld
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ SECTIONS
__init_array_start = ABSOLUTE(.);
KEEP (*(EXCLUDE_FILE (*crtend.* *crtbegin.*) .ctors SORT(.ctors.*)))
__init_array_end = ABSOLUTE(.);

_einit = ABSOLUTE(.);

/* Addresses of memory regions reserved via SOC_RESERVE_MEMORY_REGION() */
Expand Down
8 changes: 4 additions & 4 deletions libs/libxx/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ config LIBCXXABI_VERSION
string "Select libcxxabi version"
depends on LIBCXXABI
default LIBCXX_VERSION if LIBCXX
default "17.0.6" if !LIBCXX
default "21.1.8" if !LIBCXX

config CXX_STANDARD
string "Language standard"
default "gnu++20" if LIBCXX
default "gnu++23" if LIBCXX
default "gnu++17" if !LIBCXX
---help---
Possible values:
gnu++98/c++98, gnu++11/c++11, gnu++14/c++14, gnu++17/c++17 and gnu++20/c++20
gnu++98/c++98, gnu++11/c++11, gnu++14/c++14, gnu++17/c++17, gnu++20/c++20 and gnu++23/c++23

config CXX_EXCEPTION
bool "Enable Exception Support"
Expand All @@ -134,6 +134,6 @@ endif
config LIBCXX_VERSION
string "Select libcxx version"
depends on LIBCXX
default "17.0.6"
default "21.1.8"

endif
47 changes: 31 additions & 16 deletions libs/libxx/__config_site
Original file line number Diff line number Diff line change
Expand Up @@ -16,48 +16,63 @@
/* #undef _LIBCPP_ABI_FORCE_ITANIUM */
/* #undef _LIBCPP_ABI_FORCE_MICROSOFT */
/* #undef _LIBCPP_HAS_NO_THREADS */
#define _LIBCPP_HAS_THREADS 1
#define _LIBCPP_HAS_THREAD_API_PTHREAD 1
/* #undef _LIBCPP_HAS_NO_MONOTONIC_CLOCK */
#define _LIBCPP_HAS_MONOTONIC_CLOCK 1
#define _LIBCPP_HAS_TIME_ZONE_DATABASE 0
/* #undef _LIBCPP_HAS_MUSL_LIBC */
/* #undef _LIBCPP_HAS_THREAD_API_PTHREAD */
/* #undef _LIBCPP_HAS_THREAD_API_EXTERNAL */
/* #undef _LIBCPP_HAS_THREAD_API_WIN32 */
/* #undef _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS */
#define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
/* #undef _LIBCPP_NO_VCRUNTIME */
/* #undef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION */
/* #undef _LIBCPP_HAS_NO_FILESYSTEM */
#define _LIBCPP_HAS_FILESYSTEM 1
/* #undef _LIBCPP_HAS_NO_RANDOM_DEVICE */
#ifndef CONFIG_CXX_LOCALIZATION
# define _LIBCPP_HAS_NO_LOCALIZATION
#define _LIBCPP_HAS_RANDOM_DEVICE 0
#ifdef CONFIG_CXX_LOCALIZATION
#define _LIBCPP_HAS_LOCALIZATION 1
#else
#define _LIBCPP_HAS_NO_LOCALIZATION
#define _LIBCPP_HAS_LOCALIZATION 0
#endif
#ifndef CONFIG_CXX_WCHAR
# define _LIBCPP_HAS_NO_WIDE_CHARACTERS
#ifdef CONFIG_CXX_WCHAR
#define _LIBCPP_HAS_WIDE_CHARACTERS 1
#else
#define _LIBCPP_HAS_NO_WIDE_CHARACTERS
#define _LIBCPP_HAS_WIDE_CHARACTERS 0
#endif
#define _LIBCPP_ENABLE_ASSERTIONS_DEFAULT 0

// Define assertion macros for libcxx 21.x
#define _LIBCPP_ASSERT_ARGUMENT_WITHIN_DOMAIN(...) ((void)0)

// PSTL backends
#define _LIBCPP_PSTL_CPU_BACKEND_SERIAL
/* #undef _LIBCPP_PSTL_CPU_BACKEND_THREAD */
/* #undef _LIBCPP_PSTL_CPU_BACKEND_LIBDISPATCH */
#define _LIBCPP_PSTL_BACKEND_SERIAL
/* #undef _LIBCPP_PSTL_BACKEND_STD_THREAD */
/* #undef _LIBCPP_PSTL_BACKEND_LIBDISPATCH */

// Hardening.
#define _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT 0
#define _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT 0
#ifndef NDEBUG
#define _LIBCPP_HARDENING_MODE_DEFAULT _LIBCPP_HARDENING_MODE_EXTENSIVE
#else
#define _LIBCPP_HARDENING_MODE_DEFAULT _LIBCPP_HARDENING_MODE_FAST
#endif
#define _LIBCPP_ENABLE_ASSERTIONS_DEFAULT 0

#define _LIBCPP_DISABLE_DEPRECATION_WARNINGS 1
#define _LIBCPP_AVAILABILITY_HAS_NO_VERBOSE_ABORT 1

// __USE_MINGW_ANSI_STDIO gets redefined on MinGW
#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wmacro-redefined"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmacro-redefined"
#endif




#ifdef __clang__
# pragma clang diagnostic pop
#pragma clang diagnostic pop
#endif

#define _SYS_REENT_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- a/src/locale.cpp
+++ b/src/locale.cpp
@@ -37,6 +37,10 @@
#include "include/atomic_support.h"
#include "include/sso_allocator.h"

+#if defined(__NuttX__) && defined(__GLIBC__)
+# undef __GLIBC__
+#endif
+
// On Linux, wint_t and wchar_t have different signed-ness, and this causes
// lots of noise in the build log, but no bugs that I know of.
_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wsign-conversion")
12 changes: 12 additions & 0 deletions libs/libxx/libcxx/0001-libcxx-fix-exception-no-rtti_21.1.8.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- libcxx/src/exception.cpp.orig 2025-01-10 00:00:00.000000000 +0000
+++ libcxx/src/exception.cpp 2025-01-10 00:00:00.000000000 +0000
@@ -22,6 +22,9 @@
#if defined(_LIBCPP_ABI_MICROSOFT)
# include "support/runtime/exception_msvc.ipp"
# include "support/runtime/exception_pointer_msvc.ipp"
+#elif defined(LIBCXX_BUILDING_LIBCXXABI) && defined(_LIBCPP_HAS_NO_EXCEPTIONS)
+# include "include/atomic_support.h"
+# include "support/runtime/exception_pointer_unimplemented.ipp"
#elif defined(_LIBCPPABI_VERSION)
# include "support/runtime/exception_libcxxabi.ipp"
# include "support/runtime/exception_pointer_cxxabi.ipp"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--- a/include/__ostream/basic_ostream.h
+++ b/include/__ostream/basic_ostream.h
@@ -207,7 +207,12 @@

template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>::sentry::~sentry() {
- if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf) && uncaught_exceptions() == 0) {
+ if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf)
+# if _LIBCPP_HAS_EXCEPTIONS
+ && uncaught_exceptions() == 0
+# endif
+ ) {
+
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_EXCEPTIONS
13 changes: 13 additions & 0 deletions libs/libxx/libcxx/0001-libcxx-remove-mach-time-h_21.1.8.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- a/src/chrono.cpp
+++ b/src/chrono.cpp
@@ -54,10 +54,6 @@
# include <zircon/syscalls.h>
#endif

-#if __has_include(<mach/mach_time.h>)
-# include <mach/mach_time.h>
-#endif
-
#if defined(__ELF__) && defined(_LIBCPP_LINK_RT_LIB)
# pragma comment(lib, "rt")
#endif
11 changes: 11 additions & 0 deletions libs/libxx/libcxx/0001_fix_stdatomic_h_miss_typedef_21.1.8.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/include/stdatomic.h
+++ b/include/stdatomic.h
@@ -231,7 +231,7 @@
using std::atomic_signal_fence _LIBCPP_USING_IF_EXISTS;
using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS;

-# elif defined(_LIBCPP_COMPILER_CLANG_BASED)
+# else

// Before C++23, we include the next <stdatomic.h> on the path to avoid hijacking
// the header. We do this because Clang has historically shipped a <stdatomic.h>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--- libcxx/src/locale.cpp.orig
+++ libcxx/src/locale.cpp
@@ -5605,6 +5605,7 @@

// explicit instantiation

+#ifndef _LIBCPP_HAS_NO_LOCALIZATION
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS collate<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS collate_byname<char>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS moneypunct_byname<char, false>;
@@ -5645,6 +5646,7 @@
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS collate_byname<wchar_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<wchar_t, char, mbstate_t>;
#endif
+#endif // _LIBCPP_HAS_NO_LOCALIZATION

// FIXME: These explicit instantiations seem wrong since it depends on localization support which can be disabled
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
Loading
Loading