[4.11 PATCH] libcsupport/newlib: Call newlib's __sinit to force reent initialisation

chrisj at rtems.org chrisj at rtems.org
Tue Feb 18 00:25:22 UTC 2020


From: Chris Johns <chrisj at rtems.org>

- Newlib overtites any FILE pointers set in stdin, stdout or stderr.

Closes #3870
---
 cpukit/libcsupport/src/newlibc_reent.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/cpukit/libcsupport/src/newlibc_reent.c b/cpukit/libcsupport/src/newlibc_reent.c
index 430157cf0f..6dc0b1eeaa 100644
--- a/cpukit/libcsupport/src/newlibc_reent.c
+++ b/cpukit/libcsupport/src/newlibc_reent.c
@@ -44,7 +44,10 @@ bool newlib_create_hook(
   }
 #endif
 
-  _REENT_INIT_PTR((creating_task->libc_reent)); /* GCC extension: structure constants */
+  extern void __sinit (struct _reent *s);
+  struct _reent *reent = (struct _reent *) creating_task->libc_reent;
+  _REENT_INIT_PTR((reent)); /* GCC extension: structure constants */
+  __sinit( reent );
 
   return true;
 }
-- 
2.23.0



More information about the devel mailing list