From: "Pekka Seppänen" <pexu@sourceware.mail.kapsi.fi>
To: newlib@sourceware.org
Subject: [PATCH 0/3] Reentrancy
Date: Wed, 30 Aug 2023 12:16:21 +0300 [thread overview]
Message-ID: <4b19412f4ec22c719c7d0effe9e0e096@sourceware.mail.kapsi.fi> (raw)
Hi,
The following patch series provides small (one line) fixes for
newlib/libc
reentrancy when using --enable-newlib-reent-thread-local and uses the
existing
infrastructure to do that:
- There were a few locations on which _errno member was directly
accessed.
As struct _reent is not available if _REENT_THREAD_LOCAL is defined, any
accesses to errno shall be done using the corresponding _REENT_ERRNO()
macro.
Should be self-explanatory.
- __getreent() did not check that struct _reent and _impure_ptr were
available. Both <sys/reent.h> and impure.c, that declare and define
_impure_ptr, use similar #ifdef/ifndef gate. If thread-local storage is
used
the allocated objects are not related to each other. Therefore
__getreent()
does not exist even at a concept level, hence should not be provided at
all.
- As _Thread_local might not be available (as in that particular
keyword),
<sys/reent.h> shall include <sys/cdefs.h> that will provide a correct
mapping,
should the compiler actually support thread-local storage. A prime
example is
libstdc++ configure, which uses #include <math.h> in some of the
generated
checks. Essentially any C++ target is affected and possibly C targets
in
near future as C23 uses thread_local, not _Thread_local.
It should be noted that libgloss is affected by similar reentrancy
issues, but
I decided not to touch those.
-- Pekka
next reply other threads:[~2023-08-30 9:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-30 9:16 Pekka Seppänen [this message]
2023-08-31 9:23 ` Corinna Vinschen
2023-08-31 10:40 ` Pekka Seppänen
2023-08-31 9:24 ` Corinna Vinschen
2023-09-11 8:09 ` 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=4b19412f4ec22c719c7d0effe9e0e096@sourceware.mail.kapsi.fi \
--to=pexu@sourceware.mail.kapsi.fi \
--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).