This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

infinite recursion in sbrk()/abort()


Target: h8300-elf

If the first time we use signals is to call abort() in _sbrk() due to
heap/stack collision, the signal infrastructure ends up calling
_malloc_r() to allocate space for the signal table, which calls
_sbrk(), which calls abort, which calls... you get the idea.

The comment in signal.c says:

/* _init_signal initialises the signal handlers for each signal. This function
   is called by crt0 at program startup.  */

But nowhere in newlib or libgloss is that function referenced, outside
of signal.c itself:

dj@greed pts/4 ~/gnu/newlib/src
$ pgrep _init_signal
./newlib/libc/reent/reent.tex: _init_signal_r _signal_r 
./newlib/libc/signal/signal.c: /* _init_signal initialises the signal handlers for each signal. This function 
./newlib/libc/signal/signal.c: _DEFUN (_init_signal_r, (ptr), 
./newlib/libc/signal/signal.c:  if (ptr->_sig_func == NULL && _init_signal_r (ptr) != 0) 
./newlib/libc/signal/signal.c:  if (ptr->_sig_func == NULL && _init_signal_r (ptr) != 0) 
./newlib/libc/signal/signal.c:  if (ptr->_sig_func == NULL && _init_signal_r (ptr) != 0) 
./newlib/libc/signal/signal.c: _DEFUN_VOID (_init_signal) 
./newlib/libc/signal/signal.c:  return _init_signal_r (_REENT); 

Maybe _raise_r() shouldn't try to initialize the tables, but instead
assume SIG_DFL if the table is missing?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]