nuttx/sim: Remove math.h in sim.

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>
This commit is contained in:
cuiziwei 2024-10-31 16:02:35 +08:00 committed by Xiang Xiao
parent f2c46e08c8
commit f1d180d56e
5 changed files with 21 additions and 36 deletions

View file

@ -1,34 +0,0 @@
/****************************************************************************
* arch/sim/include/math.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_SIM_INCLUDE_MATH_H
#define __ARCH_SIM_INCLUDE_MATH_H
/****************************************************************************
* Included Files
****************************************************************************/
#include_next <math.h>
#ifdef __GLIBC__
#undef __GLIBC__
#endif
#endif /* __ARCH_SIM_INCLUDE_MATH_H */

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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