[libcxx] Port to NuttX (https://nuttx.apache.org) RTOS

Since NuttX conform to POSIX standard, the code need to add is very simple.

Differential Revision: https://reviews.llvm.org/D88718

GitOrigin-RevId: f0785c1f7acd34ec6681f188afedc9be89ba0cc4
diff --git a/src/include/config_elast.h b/src/include/config_elast.h
index 501cbc4..3113f9f 100644
--- a/src/include/config_elast.h
+++ b/src/include/config_elast.h
@@ -17,10 +17,14 @@
 #include <errno.h>
 #endif
 
+// Note: _LIBCPP_ELAST needs to be defined only on platforms
+// where strerror/strerror_r can't handle out-of-range errno values.
 #if defined(ELAST)
 #define _LIBCPP_ELAST ELAST
 #elif defined(_NEWLIB_VERSION)
 #define _LIBCPP_ELAST __ELASTERROR
+#elif defined(__NuttX__)
+// No _LIBCPP_ELAST needed on NuttX
 #elif defined(__Fuchsia__)
 // No _LIBCPP_ELAST needed on Fuchsia
 #elif defined(__wasi__)
diff --git a/src/locale.cpp b/src/locale.cpp
index 5fdc149..ed93727 100644
--- a/src/locale.cpp
+++ b/src/locale.cpp
@@ -30,7 +30,7 @@
 #include "__sso_allocator"
 #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
 #include "support/win32/locale_win32.h"
-#elif !defined(__BIONIC__)
+#elif !defined(__BIONIC__) && !defined(__NuttX__)
 #include <langinfo.h>
 #endif
 #include <stdlib.h>