diff options
author | Matt Joyce <matthew.joyce@embedded-brains.de> | 2022-05-16 12:51:54 +0300 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-07-13 07:55:46 +0300 |
commit | ea99f21ce6c8a332845439ea87f792dbaf679d42 (patch) | |
tree | 94cfcaf461882955f7461b09d6c4c0e2f321e66e /newlib/libc/string | |
parent | 1a0908203606527b6ac0ed438669b5bcd247a5f9 (diff) |
Add --enable-newlib-reent-thread-local option
By default, Newlib uses a huge object of type struct _reent to store
thread-specific data. This object is returned by __getreent() if the
__DYNAMIC_REENT__ Newlib configuration option is defined.
The reentrancy structure contains for example errno and the standard input,
output, and error file streams. This means that if an application only uses
errno it has a dependency on the file stream support even if it does not use
it. This is an issue for lower end targets and applications which need to
qualify the software according to safety standards (for example ECSS-E-ST-40C,
ECSS-Q-ST-80C, IEC 61508, ISO 26262, DO-178, DO-330, DO-333).
If the new _REENT_THREAD_LOCAL configuration option is enabled, then struct
_reent is replaced by dedicated thread-local objects for each struct _reent
member. The thread-local objects are defined in translation units which use
the corresponding object.
Diffstat (limited to 'newlib/libc/string')
-rw-r--r-- | newlib/libc/string/strsignal.c | 4 | ||||
-rw-r--r-- | newlib/libc/string/strtok.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/newlib/libc/string/strsignal.c b/newlib/libc/string/strsignal.c index 544857b14..89d39fe3c 100644 --- a/newlib/libc/string/strsignal.c +++ b/newlib/libc/string/strsignal.c @@ -52,6 +52,10 @@ QUICKREF #include <stdlib.h> #include <reent.h> +#ifdef _REENT_THREAD_LOCAL +_Thread_local char _tls_signal_buf[_REENT_SIGNAL_SIZE]; +#endif + char * strsignal (int signal) { diff --git a/newlib/libc/string/strtok.c b/newlib/libc/string/strtok.c index 801f51aca..2a11c9196 100644 --- a/newlib/libc/string/strtok.c +++ b/newlib/libc/string/strtok.c @@ -74,6 +74,10 @@ QUICKREF #include <_ansi.h> #include <reent.h> +#ifdef _REENT_THREAD_LOCAL +_Thread_local char *_tls_strtok_last; +#endif + #ifndef _REENT_ONLY extern char *__strtok_r (char *, const char *, char **, int); |