From 2917180c216cf31c44bfad7a069cac6ba54ed9aa Mon Sep 17 00:00:00 2001 From: FragrantRye <903465575@qq.com> Date: Wed, 16 Aug 2023 19:47:41 -0400 Subject: [PATCH] [libc][newlib] __sdidinit is obselete related: https://github.com/RT-Thread/rt-thread/issues/7923 https://github.com/mirror/newlib-cygwin/commit/44b60f0c4ba597c55dcac4f2d3119a3055c80ba1 Co-authored-by: Meco Man <920369182@qq.com> --- components/libc/posix/io/stdio/stdio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/libc/posix/io/stdio/stdio.c b/components/libc/posix/io/stdio/stdio.c index 4e5464c53..98816c1f2 100644 --- a/components/libc/posix/io/stdio/stdio.c +++ b/components/libc/posix/io/stdio/stdio.c @@ -47,6 +47,8 @@ INIT_ENV_EXPORT(rt_posix_stdio_init); #if defined(RT_USING_NEWLIBC) +#define NEWLIB_VERSION_NUM (__NEWLIB__ * 10000U + __NEWLIB_MINOR__ * 100U + __NEWLIB_PATCHLEVEL__) + static FILE* std_console = NULL; int rt_posix_stdio_set_console(const char* device_name, int mode) { @@ -102,7 +104,9 @@ int rt_posix_stdio_set_console(const char* device_name, int mode) _GLOBAL_REENT->_stderr = std_console; } - _GLOBAL_REENT->__sdidinit = 1; +#if (NEWLIB_VERSION_NUM < 30400U) || (NEWLIB_VERSION_NUM >= 40000U && NEWLIB_VERSION_NUM < 40300U) + _GLOBAL_REENT->__sdidinit = 1; /* __sdidinit is obselete */ +#endif } if (std_console) -- GitLab