Ticket #84: __main_patch.diff

File __main_patch.diff, 1.7 KB (added by Joel Sherrill, on Dec 3, 2006 at 1:31:13 PM)

main_patch.diff

Line 
12001-11-20      Joel Sherrill <joel@OARcorp.com>
2
3        * src/threadhandler.c: When __USE__MAIN__ is defined by the toolset,
4        invoke the global constructors via __main.  Reported as tested by
5        Alexandra Kossovsky <sasha@oktet.ru> and  Victor V. Vengerov
6        <vvv@oktet.ru> in conjunction with a new set of tool RPMs
7        (gcc2.95.3newlib1.9.0-3).  This was tracked as GNATS PR tools/84.
8
9Index: c/src/exec/score/src/threadhandler.c
10=================================================================
11RCS file: /usr1/CVS/rtems/c/src/exec/score/src/threadhandler.c,v
12retrieving revision 1.5
13diff -c -r1.5 threadhandler.c
14*** c/src/exec/score/src/threadhandler.c        2001/10/22 11:55:44     1.5
15--- c/src/exec/score/src/threadhandler.c        2001/11/20 18:07:27
16***************
17*** 58,64 ****
18  {
19    ISR_Level  level;
20    Thread_Control *executing;
21! #if defined(__USE_INIT_FINI__)
22    static char doneConstructors;
23    char doneCons;
24  #endif
25--- 58,64 ----
26  {
27    ISR_Level  level;
28    Thread_Control *executing;
29! #if defined(__USE_INIT_FINI__) || defined(__USE__MAIN__)
30    static char doneConstructors;
31    char doneCons;
32  #endif
33***************
34*** 73,79 ****
35    level = executing->Start.isr_level;
36    _ISR_Set_level(level);
37 
38! #if defined(__USE_INIT_FINI__)
39    doneCons = doneConstructors;
40    doneConstructors = 1;
41  #endif
42--- 73,79 ----
43    level = executing->Start.isr_level;
44    _ISR_Set_level(level);
45 
46! #if defined(__USE_INIT_FINI__) || defined(__USE__MAIN__)
47    doneCons = doneConstructors;
48    doneConstructors = 1;
49  #endif
50***************
51*** 95,100 ****
52--- 95,105 ----
53    if (!doneCons)
54      _init ();
55  #endif
56+ #if defined(__USE__MAIN__)
57+   if (!doneCons)
58+     __main ();
59+ #endif
60+
61   
62    switch ( executing->Start.prototype ) {
63      case THREAD_START_NUMERIC: