[PATCH] Use weak reference for _REENT_SMALL

Sebastian Huber <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
Avoid a strong reference to __sfp[] for _impure_data.  The __sfp[] is linked in
if __sinit() is used for example.
---
 newlib/libc/reent/impure.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/newlib/libc/reent/impure.c b/newlib/libc/reent/impure.c
index f10665fd0..643a511c6 100644
--- a/newlib/libc/reent/impure.c
+++ b/newlib/libc/reent/impure.c
@@ -6,10 +6,14 @@
    important to reduce image size for targets with very small amounts
    of memory.  */
 #ifdef _REENT_SMALL
+#ifdef _REENT_GLOBAL_STDIO_STREAMS
+extern __FILE __sf[3] _ATTRIBUTE ((weak));
+#else
 extern const struct __sFILE_fake __sf_fake_stdin _ATTRIBUTE ((weak));
 extern const struct __sFILE_fake __sf_fake_stdout _ATTRIBUTE ((weak));
 extern const struct __sFILE_fake __sf_fake_stderr _ATTRIBUTE ((weak));
 #endif
+#endif
 
 struct _reent __ATTRIBUTE_IMPURE_DATA__ _impure_data = _REENT_INIT (_impure_data);
 #ifdef __CYGWIN__
-- 
2.35.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.