This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
On Tue, 6 Apr 1999, Brendan Simon wrote: > I am trying to use RTEMS-4.0.0 (with egcs-1.1b, binutils-2.9.1 and > newlib-1.8.0) on an MPC860 board. During initialization, the rtems code > calls the libc (newlib) function atexit() to register a a routine that > closes down a clock driver. 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 ? > Is it the responsibility of newlib, rtems, gcc or the loader (note that > I am using a BDM interface to download the elf file into DRAM). My > board support package clears the BSS but I believe that the _REENT > structure lives in the .data section. I thought someone previously reposted a patch I had sent them to change from static to dynamic initialization of the global reentrancy structure. They had problems that things worked on the 1st run but not on 2nd and subsequent runs. Be warned that I have seen code to clear BSS that looks right but depends on correct placement of diretives and symbol definitions in the linker script. If the linker script does not put the symbols in the right place, then the BSS does not really get cleared. This was particularly a problem on the PPC/ELF where there are oodles of sections. Anyway the patch I mentioned is below my signature. --joel Joel Sherrill Director of Research & Development joel@OARcorp.com On-Line Applications Research Ask me about RTEMS: a free RTOS Huntsville AL 35805 Support Available (256) 722-9985 -------------------------- Index: newlibc.c =================================================================== RCS file: /usr1/rtems/CVS-PRIVATE/rtems/c/src/lib/libc/newlibc.c,v retrieving revision 1.33 retrieving revision 1.34 diff -c -r1.33 -r1.34 *** newlibc.c 1999/02/15 18:56:08 1.33 --- newlibc.c 1999/02/18 15:11:41 1.34 *************** *** 9,15 **** * found in the file LICENSE in this distribution or at * http://www.OARcorp.com/rtems/license.html. * ! * $Id: newlibc.c,v 1.33 1999/02/15 18:56:08 joel Exp $ * */ --- 9,15 ---- * found in the file LICENSE in this distribution or at * http://www.OARcorp.com/rtems/license.html. * ! * $Id: newlibc.c,v 1.34 1999/02/18 15:11:41 joel Exp $ * */ *************** *** 60,66 **** int libc_reentrant; /* do we think we are reentrant? */ ! struct _reent libc_global_reent = _REENT_INIT(libc_global_reent); /* * CYGNUS newlib routine that does atexit() processing and flushes --- 60,66 ---- int libc_reentrant; /* do we think we are reentrant? */ ! struct _reent libc_global_reent; /* * CYGNUS newlib routine that does atexit() processing and flushes *************** *** 294,299 **** --- 294,300 ---- rtems_id extension_id; rtems_status_code rc; + libc_global_reent = (struct _reent) _REENT_INIT((libc_global_reent)); _REENT = &libc_global_reent; if (reentrant) _______________________________________________ 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.