summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadhandler.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2010-11-29 14:14:27 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2010-11-29 14:14:27 +0000
commitd6a72fff81fd3a9e042346d6e958aaf455e2447d (patch)
treef2cbd1289cd13e6043cc2d107baa9d12c8e31379 /cpukit/score/src/threadhandler.c
parent2010-11-26 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff)
downloadrtems-d6a72fff81fd3a9e042346d6e958aaf455e2447d.tar.bz2
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.
Diffstat (limited to 'cpukit/score/src/threadhandler.c')
-rw-r--r--cpukit/score/src/threadhandler.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/cpukit/score/src/threadhandler.c b/cpukit/score/src/threadhandler.c
index 3fffd8fb83..2082bdfb78 100644
--- a/cpukit/score/src/threadhandler.c
+++ b/cpukit/score/src/threadhandler.c
@@ -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