Skip to content

Commit

Permalink
nuttx/sim: Remove math.h in sim.
Browse files Browse the repository at this point in the history
The reason for removing math.h is that undefining __GLIBC__ does not take effect. By default, sim will use the toolchain's math library and undef __GLIBC__ in the source file.

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
  • Loading branch information
cuiziweizw authored and xiaoxiang781216 committed Dec 26, 2024
1 parent 7e5ce63 commit 05a8789
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 36 deletions.
34 changes: 0 additions & 34 deletions arch/sim/include/math.h

This file was deleted.

1 change: 0 additions & 1 deletion boards/sim/sim/sim/configs/libcxxtest/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ CONFIG_ARCH="sim"
CONFIG_ARCH_BOARD="sim"
CONFIG_ARCH_BOARD_SIM=y
CONFIG_ARCH_CHIP="sim"
CONFIG_ARCH_MATH_H=y
CONFIG_ARCH_SIM=y
CONFIG_BOARDCTL_APP_SYMTAB=y
CONFIG_BOARDCTL_POWEROFF=y
Expand Down
17 changes: 17 additions & 0 deletions libs/libxx/0001-Fix-build-error-about-__GLIBC__.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git libcxx/src/locale.cpp libcxx/src/locale.cpp
--- libcxx/src/locale.cpp
+++ libcxx/src/locale.cpp
@@ -41,6 +41,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")
--
2.34.1

4 changes: 3 additions & 1 deletion libs/libxx/libcxx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libcxx)
${CMAKE_CURRENT_LIST_DIR}/libcxx <
${CMAKE_CURRENT_LIST_DIR}/0001-libcxx-remove-mach-time-h.patch && patch
-p1 -d ${CMAKE_CURRENT_LIST_DIR}/libcxx <
${CMAKE_CURRENT_LIST_DIR}/0001-libcxx-fix-ld-errors.patch
${CMAKE_CURRENT_LIST_DIR}/0001-libcxx-fix-ld-errors.patch && patch -p1 -d
${CMAKE_CURRENT_LIST_DIR}/libcxx <
${CMAKE_CURRENT_LIST_DIR}/0001-Fix-build-error-about-__GLIBC__.patch
DOWNLOAD_NO_PROGRESS true
TIMEOUT 30)

Expand Down
1 change: 1 addition & 0 deletions libs/libxx/libcxx.defs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ libcxx: libcxx-$(LIBCXX_VERSION).src.tar.xz
$(Q) patch -p2 < mbstate_t.patch
$(Q) patch -p0 < 0001-libcxx-remove-mach-time-h.patch
$(Q) patch -p0 < 0001-libcxx-fix-ld-errors.patch
$(Q) patch -p0 < 0001-Fix-build-error-about-__GLIBC__.patch
$(Q) touch $@
endif

Expand Down

0 comments on commit 05a8789

Please sign in to comment.