Newlib problems with atexit()

Jonathan Larmour jlarmour@cygnus.co.uk
Tue Apr 6 07:03:00 GMT 1999


Brendan Simon wrote:
> atexit() reads a pointer to an _atexit
> structure (_REENT->atexit).  It seems that this pointer is uninitialized
> at runtime so it picks up random values from what ever happens to be in
> memory at the time.
> 
> I assume that this value should be initialized to NULL.  Where and how
> is this done ?

Look at libc/reent/impure.c along with libc/include/sys/reent.h in your
newlib distribuction. It has the lines:

static struct _reent __ATTRIBUTE_IMPURE_DATA__ impure_data = _REENT_INIT
(impure_data);
struct _reent *__ATTRIBUTE_IMPURE_PTR__ _impure_ptr = &impure_data;

where struct _reent and _REENT_INIT come from sys/reent.h and the latter is
an array initializer, i.e. not NULL.

Jifl
-- 
Cygnus Solutions, 35 Cambridge Place, Cambridge, UK.  Tel: +44 (1223) 728762
"Women marry hoping their husbands will change, men||Home e-mail: jifl @ 
marry hoping their wives never do. Both are rare." ||     jifvik.demon.co.uk
Help fight spam! http://spam.abuse.net/  These opinions are all my own fault
_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.



More information about the crossgcc mailing list