Skip to content

Commit 933acf3

Browse files
committed
sys/newlib: drop workaround for stdio
This drops a workaround that initialized newlib's reentrancy structure on boot to reduce the chances of crashes when using the non-thread-safe (unless reentrancy hooks are provided) stdio implementation of newlib. Now that the newlib stdio implementation is only ever used if it is thread-safe, we no longer need a workaround that reduces the chance of crashes on concurrent use of stdio.
1 parent 16795c8 commit 933acf3

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

sys/newlib_syscalls_default/syscalls.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -144,23 +144,7 @@ static const struct heap heaps[NUM_HEAPS] = {
144144
*/
145145
void _init(void)
146146
{
147-
/* Definition copied from newlib/libc/stdio/local.h */
148-
extern void __sinit (struct _reent *);
149-
150-
/* When running multiple threads: Initialize reentrant structure before the
151-
* scheduler starts. This normally happens upon the first stdio function
152-
* called. However, if no boot message happens this can result in two
153-
* concurrent "first calls" to stdio in data corruption, if no locking is
154-
* used. Except for ESP (which is using its own syscalls.c anyway), this
155-
* currently is the case in RIOT. */
156-
if (MAXTHREADS > 1) {
157-
/* Also, make an exception for riotboot, which does not use stdio
158-
* at all. This would pull in stdio and increase .text size
159-
* significantly there */
160-
if (!IS_USED(MODULE_RIOTBOOT)) {
161-
__sinit(_REENT);
162-
}
163-
}
147+
/* nothing to do here */
164148
}
165149

166150
/**

0 commit comments

Comments
 (0)