source: rtems/cpukit/score/src/threadglobalconstruction.c @ 44e9871

5
Last change on this file since 44e9871 was 44e9871, checked in by Sebastian Huber <sebastian.huber@…>, on 12/22/15 at 08:40:48

score: Avoid dead code in global construction

Update #2514.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/**
2 * @file
3 *
4 * @brief Thread Global Construction
5 *
6 * @ingroup ScoreThread
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-2012.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/score/threadimpl.h>
23#include <rtems/score/assert.h>
24#include <rtems/config.h>
25
26/*
27 *  Conditional magic to determine what style of C++ constructor
28 *  initialization this target and compiler version uses.
29 */
30#if defined(__USE_INIT_FINI__)
31  #if defined(__ARM_EABI__)
32    #define INIT_NAME __libc_init_array
33  #else
34    #define INIT_NAME _init
35  #endif
36
37  extern void INIT_NAME(void);
38  #define EXECUTE_GLOBAL_CONSTRUCTORS
39#endif
40
41#if defined(__USE__MAIN__)
42  extern void __main(void);
43  #define INIT_NAME __main
44  #define EXECUTE_GLOBAL_CONSTRUCTORS
45#endif
46
47void _Thread_Global_construction( Thread_Entry entry_point )
48{
49  Thread_Control *executing;
50
51#if defined(EXECUTE_GLOBAL_CONSTRUCTORS)
52  /*
53   *  _init could be a weak symbol and we SHOULD test it but it isn't
54   *  in any configuration I know of and it generates a warning on every
55   *  RTEMS target configuration.  --joel (12 May 2007)
56   */
57  INIT_NAME();
58#endif
59
60  _Thread_Disable_dispatch();
61
62  executing = _Thread_Executing;
63  executing->Start.entry_point = entry_point;
64
65  _Thread_Restart(
66    executing,
67    executing,
68    executing->Start.pointer_argument,
69    executing->Start.numeric_argument
70  );
71
72  _Thread_Enable_dispatch();
73
74  _Assert_Not_reached();
75}
Note: See TracBrowser for help on using the repository browser.