public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: newlib@sourceware.org
Subject: [PATCH] Use weak reference for _REENT_SMALL
Date: Wed, 18 May 2022 19:13:07 +0200	[thread overview]
Message-ID: <20220518171307.53663-3-sebastian.huber@embedded-brains.de> (raw)
In-Reply-To: <20220518171307.53663-1-sebastian.huber@embedded-brains.de>

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


  parent reply	other threads:[~2022-05-18 17:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18 17:13 [PATCH] Fix __fp_lock_all() and __fp_unlock_all() Sebastian Huber
2022-05-18 17:13 ` [PATCH] Fix __sFILE::_lock initialization Sebastian Huber
2022-05-19 12:04   ` Corinna Vinschen
2022-05-18 17:13 ` Sebastian Huber [this message]
2022-05-19 12:05   ` [PATCH] Use weak reference for _REENT_SMALL Corinna Vinschen
2022-05-19 12:02 ` [PATCH] Fix __fp_lock_all() and __fp_unlock_all() Corinna Vinschen
2022-05-19 17:08   ` Sebastian Huber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220518171307.53663-3-sebastian.huber@embedded-brains.de \
    --to=sebastian.huber@embedded-brains.de \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).