[4.11 PATCH] libcsupport/newlib: Call newlib's __sinit to force reent initialisation

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Feb 19 08:51:34 UTC 2020


On 19/02/2020 05:57, Chris Johns wrote:
> On 18/2/20 7:33 pm, Sebastian Huber wrote:
>> On 18/02/2020 01:25, chrisj at rtems.org wrote:
>>> From: Chris Johns <chrisj at rtems.org>
>>>
>>> - Newlib overtites any FILE pointers set in stdin, stdout or stderr.
>>>
>>> Closes #3870
[...]
> The worker_task in newlib01 has different pointers and fd numbers for it's
> stdout, stdin and stderr and `fprintf(stdout, "...");` does not appear on the
> console while it does in the `test()` body. I am not sure about this. The change
> to add `__sinit` does not change this, it is the same in or out.

I had a look at this with the debugger. It seems to work since the 
_close hander is NULL:

(gdb) p _Per_CPU_Information [0].per_cpu .executing [0].libc_reent 
[0]._stdin[0]
$4 = {
   _p = 0x0,
   _r = 0,
   _w = 0,
   _flags = 4,
   _file = 0,
[...]
   _close = 0x0,

For other files, it looks like:

(gdb) p file[0]
$5 = {
   _p = 0x0,
   _r = 0,
   _w = 0,
   _flags = 16,
   _file = 3,
[...]
   _close = 0x11e0f9 <__sclose>,

So, it looks good.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


More information about the devel mailing list