[PATCH] Delete default __getreent() implementation

Sebastian Huber sebastian.huber@embedded-brains.de
Tue Nov 7 19:37:00 GMT 2017



----- Am 7. Nov 2017 um 17:12 schrieb Craig Howland howland@LGSInnovations.com:

> On 11/07/2017 10:03 AM, Corinna Vinschen wrote:
>> On Nov  7 12:53, Sebastian Huber wrote:
[...] 
> I suggest that at a minimum the contents of getreent.c should be kept.  This
> keeps a starting point for people who are needing to supply such a function.

The default implementation is a bad example.  It makes no sense to use __DYNAMIC_REENT__ with this implementation, e.g. you get the same thing without a function call overhead:

#if defined(__DYNAMIC_REENT__) && !defined(__SINGLE_THREAD__)
#ifndef __getreent
  struct _reent * _EXFUN(__getreent, (void));
#endif
# define _REENT (__getreent())
#else /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */
# define _REENT _impure_ptr
#endif /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ *

> (Leaving it out of the library stops the link problem which is the stated goal
> of the patch.)  But I think it needs to go further, and this patch should not be
> done in this form because of the cited backwards-compatibility reasons.  If
> something were to be done it should be a configure flag to leave it out of the
> library.

Then we are back to Joel's patch:

https://sourceware.org/ml/newlib/2017/msg01026.html

I don't know why Joel added this _dummy_getreent, but something similar is used elsewhere:

libc/reent/linkr.c:int _dummy_link_syscalls = 1;
libc/reent/fstat64r.c:int _dummy_fstat_syscalls = 1;
libc/reent/timesr.c:int _dummy_times_syscalls = 1;
libc/reent/sbrkr.c:int _dummy_sbrk_syscalls = 1;
libc/reent/stat64r.c:int _dummy_stat64_syscalls = 1;
libc/reent/gettimeofdayr.c:int _dummy_gettimeofday_syscalls = 1;
libc/reent/signalr.c:int _dummy_link_syscalls = 1;
libc/reent/execr.c:int _dummy_exec_syscalls = 1;
libc/reent/statr.c:int _dummy_stat_syscalls = 1;
libc/reent/fstatr.c:int _dummy_fstat_syscalls = 1;
libc/reent/isattyr.c:int _dummy_isatty_syscalls = 1;
libc/signal/signal.c:int _dummy_simulated_signal;
libc/signal/raise.c:int _dummy_raise;
libc/sys/netware/crt0.c:int _dummy_crt0 = 1;
libc/stdlib/abort.c:int _dummy_abort = 1;
libc/stdlib/mstats.c:int _dummy_mstats = 1;
libc/stdlib/malloc.c:int _dummy_malloc = 1;
libc/stdlib/mallocr.c:int _dummy_mallocr = 1;
libc/stdlib/realloc.c:int _dummy_calloc = 1;
libc/stdlib/calloc.c:int _dummy_calloc = 1;
libc/time/clock.c:int _dummy_clock = 1;



More information about the Newlib mailing list