You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "Barto22 (via GitHub)" <gi...@apache.org> on 2026/01/11 19:11:04 UTC
[PR] Add support for latest LLVM LIBCXX and LIBCXXABI version 21.1.8 [nuttx]
Barto22 opened a new pull request, #17826:
URL: https://github.com/apache/nuttx/pull/17826
## Summary
This PR introduces initial support for **LLVM libc++ and libc++abi (v21.1.8)** in NuttX. It enables C++23-compatible standard library components including new language features and exception handling. The integration is currently limited to basic operation and does not yet include threading or mutex support.
Configurations for testing have been added for:
- `stm32f4discovery:testlibcxx`
- `esp32c3-devkit:testlibcxx`
## Impact
This adds optional support for a modern C++ standard library implementation and improves compatibility with toolchains that prefer or require libc++ over libstdc++.
At this stage:
- **Runtime / ABI:** basic C++ exception handling is functional
- **Threading:** thread and mutex support is not yet implemented
- **Compatibility:** existing C++ support (GNU libstdc++) is unaffected
- **Build systems:** tested with both `make` and `cmake`
- **Documentation:** serves as a foundation for future libc++ enablement and enhancements
No impact to existing boards or applications unless explicitly enabling the new configurations.
## Testing
**Host machine:** Linux x86_64
**Boards / Configurations tested:**
- `stm32f4discovery:testlibcxx`
- `esp32c3-devkit:testlibcxx`
**Toolchains used:**
- ARM GCC **15.2.rel1**
- RISC-V GCC **15.2.0**
**Procedure:**
- Built using both `make` and `cmake`
- Verified exception handling through sample test cases
- Confirmed basic standard library functionality
- Validated that non-libc++ configurations continue to build successfully
**Current status:**
- Basic libc++ functionality works as expected
- Exception handling verified
- No regressions observed
- Threading/mutex support not yet implemented
Logs and additional validation data can be provided upon request.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] libs: Add support for latest LLVM LIBCXX and LIBCXXABI version 21.1.8 [nuttx]
Posted by "Barto22 (via GitHub)" <gi...@apache.org>.
Barto22 commented on code in PR #17826:
URL: https://github.com/apache/nuttx/pull/17826#discussion_r2685081642
##########
boards/sim/sim/sim/scripts/Make.defs:
##########
@@ -186,9 +186,15 @@ endif
ARCHPICFLAGS = -fpic
+ifeq ($(CONFIG_SIM_TOOLCHAIN_CLANG),y)
Review Comment:
Yes, for Docker file here is the PR: https://github.com/apache/nuttx/pull/17849 and for updating SIM boards to use Clang instead of GCC here is the PR: https://github.com/apache/nuttx/pull/17850 , I removed this changes from this PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add support for latest LLVM LIBCXX and LIBCXXABI version 21.1.8 [nuttx]
Posted by "Barto22 (via GitHub)" <gi...@apache.org>.
Barto22 commented on code in PR #17826:
URL: https://github.com/apache/nuttx/pull/17826#discussion_r2680894299
##########
libs/libxx/libcxxabi/Make.defs:
##########
@@ -51,6 +53,9 @@ ifeq ($(CONFIG_LIBCXXABI), y)
CXXFLAGS += ${DEFINE_PREFIX}LIBCXX_BUILDING_LIBCXXABI
CXXFLAGS += -I $(TOPDIR)/libs/libxx/libcxxabi/libcxxabi/include
+# Define _LIBCPP_HAS_NO_THREADS for no-threading builds
+CXXFLAGS += ${DEFINE_PREFIX}_LIBCPP_HAS_NO_THREADS
Review Comment:
Ok, I will add it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] libs: Add support for latest LLVM LIBCXX and LIBCXXABI version 21.1.8 [nuttx]
Posted by "Barto22 (via GitHub)" <gi...@apache.org>.
Barto22 commented on code in PR #17826:
URL: https://github.com/apache/nuttx/pull/17826#discussion_r2681934478
##########
arch/arm/src/cmake/gcc.cmake:
##########
@@ -274,6 +274,11 @@ if(NOT CONFIG_CXX_RTTI)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>)
endif()
+# Add -mlong-calls for C++ when using libcxx to fix relocation issues
+if(CONFIG_LIBCXX)
+ add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-mlong-calls>)
Review Comment:
For now I resolved the problem and remove this flags, I will do further tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add support for latest LLVM LIBCXX and LIBCXXABI version 21.1.8 [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #17826:
URL: https://github.com/apache/nuttx/pull/17826#discussion_r2680712092
##########
libs/libxx/libcxxabi/Make.defs:
##########
@@ -51,6 +53,9 @@ ifeq ($(CONFIG_LIBCXXABI), y)
CXXFLAGS += ${DEFINE_PREFIX}LIBCXX_BUILDING_LIBCXXABI
CXXFLAGS += -I $(TOPDIR)/libs/libxx/libcxxabi/libcxxabi/include
+# Define _LIBCPP_HAS_NO_THREADS for no-threading builds
+CXXFLAGS += ${DEFINE_PREFIX}_LIBCPP_HAS_NO_THREADS
Review Comment:
but we need support thread before merging this pr
##########
arch/arm/src/cmake/gcc.cmake:
##########
@@ -274,6 +274,11 @@ if(NOT CONFIG_CXX_RTTI)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>)
endif()
+# Add -mlong-calls for C++ when using libcxx to fix relocation issues
+if(CONFIG_LIBCXX)
+ add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-mlong-calls>)
Review Comment:
do you hit this problem when generate elf binary
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] libs: Add support for latest LLVM LIBCXX and LIBCXXABI version 21.1.8 [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #17826:
URL: https://github.com/apache/nuttx/pull/17826#issuecomment-3741576184
@Barto22 please move Docker related change to new pr, so we can merge it first and then verify whether this pr can pass ci.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] libs: Add support for latest LLVM LIBCXX and LIBCXXABI version 21.1.8 [nuttx]
Posted by "Barto22 (via GitHub)" <gi...@apache.org>.
Barto22 commented on code in PR #17826:
URL: https://github.com/apache/nuttx/pull/17826#discussion_r2685103549
##########
arch/arm/src/common/Toolchain.defs:
##########
@@ -405,6 +405,7 @@ endif
ifneq ($(CONFIG_CXX_RTTI),y)
ARCHCXXFLAGS += -fno-rtti
endif
+
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] libs: Add support for latest LLVM LIBCXX and LIBCXXABI version 21.1.8 [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #17826:
URL: https://github.com/apache/nuttx/pull/17826#discussion_r2684612361
##########
arch/arm/src/common/Toolchain.defs:
##########
@@ -405,6 +405,7 @@ endif
ifneq ($(CONFIG_CXX_RTTI),y)
ARCHCXXFLAGS += -fno-rtti
endif
+
Review Comment:
revert
##########
boards/sim/sim/sim/scripts/Make.defs:
##########
@@ -186,9 +186,15 @@ endif
ARCHPICFLAGS = -fpic
+ifeq ($(CONFIG_SIM_TOOLCHAIN_CLANG),y)
Review Comment:
it's better to split the change not directly related to c++23 upgrade to new pr to boost the review proccess.
##########
libs/libc/misc/lib_cxx_initialize.c:
##########
@@ -71,6 +100,65 @@ void lib_cxx_initialize(void)
{
#if defined(CONFIG_ARCH_SIM) && defined(CONFIG_HOST_MACOS)
macho_call_saved_init_funcs();
+#elif defined(USE_ESP32_XTENSA_INIT_ARRAYS)
Review Comment:
why add esp32 specific code in the common place? it's better to adjust esp32 riscv ld to conform the requirement.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add support for latest LLVM LIBCXX and LIBCXXABI version 21.1.8 [nuttx]
Posted by "Barto22 (via GitHub)" <gi...@apache.org>.
Barto22 commented on code in PR #17826:
URL: https://github.com/apache/nuttx/pull/17826#discussion_r2680894005
##########
arch/arm/src/cmake/gcc.cmake:
##########
@@ -274,6 +274,11 @@ if(NOT CONFIG_CXX_RTTI)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>)
endif()
+# Add -mlong-calls for C++ when using libcxx to fix relocation issues
+if(CONFIG_LIBCXX)
+ add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-mlong-calls>)
Review Comment:
Yes, there was problem during linking with relocations.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] libs: Add support for latest LLVM LIBCXX and LIBCXXABI version 21.1.8 [nuttx]
Posted by "Barto22 (via GitHub)" <gi...@apache.org>.
Barto22 commented on code in PR #17826:
URL: https://github.com/apache/nuttx/pull/17826#discussion_r2685081642
##########
boards/sim/sim/sim/scripts/Make.defs:
##########
@@ -186,9 +186,15 @@ endif
ARCHPICFLAGS = -fpic
+ifeq ($(CONFIG_SIM_TOOLCHAIN_CLANG),y)
Review Comment:
Yes, for Docker file here is the PR: https://github.com/apache/nuttx/pull/17849 and for updating SIM boards to use Clang instead of GCC here is the PR: https://github.com/apache/nuttx/pull/17850
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] libs: Add support for latest LLVM LIBCXX and LIBCXXABI version 21.1.8 [nuttx]
Posted by "Barto22 (via GitHub)" <gi...@apache.org>.
Barto22 commented on PR #17826:
URL: https://github.com/apache/nuttx/pull/17826#issuecomment-3749700375
This PR is waiting for this one: https://github.com/apache/nuttx/pull/17849 - it have updated compilers for support latest libcxx.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] libs: Add support for latest LLVM LIBCXX and LIBCXXABI version 21.1.8 [nuttx]
Posted by "Barto22 (via GitHub)" <gi...@apache.org>.
Barto22 closed pull request #17826: libs: Add support for latest LLVM LIBCXX and LIBCXXABI version 21.1.8
URL: https://github.com/apache/nuttx/pull/17826
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add support for latest LLVM LIBCXX and LIBCXXABI version 21.1.8 [nuttx]
Posted by "Barto22 (via GitHub)" <gi...@apache.org>.
Barto22 commented on code in PR #17826:
URL: https://github.com/apache/nuttx/pull/17826#discussion_r2681195348
##########
libs/libxx/libcxxabi/Make.defs:
##########
@@ -51,6 +53,9 @@ ifeq ($(CONFIG_LIBCXXABI), y)
CXXFLAGS += ${DEFINE_PREFIX}LIBCXX_BUILDING_LIBCXXABI
CXXFLAGS += -I $(TOPDIR)/libs/libxx/libcxxabi/libcxxabi/include
+# Define _LIBCPP_HAS_NO_THREADS for no-threading builds
+CXXFLAGS += ${DEFINE_PREFIX}_LIBCPP_HAS_NO_THREADS
Review Comment:
Support for threads is added. I will test it and check all builds are passing. For now I'm resolving this comment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org