mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-22 23:41:54 +08:00
2010-11-29 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libcsupport/src/newlibc_exit.c, score/src/threadhandler.c: Added support for .preinit_array, .init_array and .fini_array sections.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2010-11-29 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* libcsupport/src/newlibc_exit.c, score/src/threadhandler.c: Added
|
||||
support for .preinit_array, .init_array and .fini_array sections.
|
||||
|
||||
2010-11-25 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* sapi/include/confdefs.h, score/include/rtems/score/scheduler.h,
|
||||
|
||||
@@ -118,10 +118,13 @@ void libc_wrapup(void)
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <newlib.h>
|
||||
|
||||
#if defined(HAVE_INITFINI_ARRAY)
|
||||
extern void __libc_fini_array(void);
|
||||
#endif
|
||||
|
||||
/* FIXME: These defines are a blatant hack */
|
||||
#define EXIT_SYMBOL _exit
|
||||
|
||||
#if defined(__AVR__)
|
||||
#undef __USE_INIT_FINI__
|
||||
#endif
|
||||
@@ -135,8 +138,22 @@ void libc_wrapup(void)
|
||||
extern void FINI_SYMBOL( void );
|
||||
#endif
|
||||
|
||||
void EXIT_SYMBOL(int status)
|
||||
void _exit(int status)
|
||||
{
|
||||
#if defined(HAVE_INITFINI_ARRAY)
|
||||
/*
|
||||
* According to
|
||||
*
|
||||
* System V Application Binary Interface
|
||||
* Chapter 5
|
||||
* Initialization and Termination Functions
|
||||
*
|
||||
* we have to call the functions referenced by the .fini_array before the
|
||||
* one referenced by the .fini section.
|
||||
*/
|
||||
__libc_fini_array();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If the toolset uses init/fini sections, then we need to
|
||||
* run the global destructors now.
|
||||
|
||||
@@ -30,6 +30,14 @@
|
||||
#include <rtems/score/userext.h>
|
||||
#include <rtems/score/wkspace.h>
|
||||
|
||||
#if defined(RTEMS_NEWLIB)
|
||||
#include <newlib.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_INITFINI_ARRAY)
|
||||
extern void __libc_init_array(void);
|
||||
#endif
|
||||
|
||||
#if defined(__AVR__)
|
||||
#undef __USE_INIT_FINI__
|
||||
#endif
|
||||
@@ -138,6 +146,20 @@ void _Thread_Handler( void )
|
||||
*/
|
||||
if (!doneCons) /* && (volatile void *)_init) */ {
|
||||
INIT_NAME ();
|
||||
|
||||
#if defined(HAVE_INITFINI_ARRAY)
|
||||
/*
|
||||
* According to
|
||||
*
|
||||
* System V Application Binary Interface
|
||||
* Chapter 5
|
||||
* Initialization and Termination Functions
|
||||
*
|
||||
* we have to call the functions referenced by the .init_array after
|
||||
* the one referenced by the .init section.
|
||||
*/
|
||||
__libc_init_array();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user