This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: A problem about constructor sequence


On Mon, Sep 10, 2007 at 05:14:13PM +0800, taiyun@sunnorth.com.cn wrote:
> 
> Dear all:
> 
> I want to discuss something about eCos kernel, BUT I am not sure whether my
> opinion is correct or someone has reported this problem before.
> I think there is a problem with global constructor sequence. There are two
> global instances, not only they have the same initialized priority but also
> they have some relationship between each other. They are:
> 
> Cyg_Thread cyg_libc_main_thread CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_LIBC) = ...
> AND
> static cyg_libc_startup_dummy_constructor_class cyg_libc_startup_obj
>                                   CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_LIBC);

Here is the patch i have committed to CVS.

     Andrew
Index: language/c/libc/startup/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/startup/current/ChangeLog,v
retrieving revision 1.9
diff -u -r1.9 ChangeLog
--- language/c/libc/startup/current/ChangeLog	2 Jul 2007 11:48:59 -0000	1.9
+++ language/c/libc/startup/current/ChangeLog	11 Sep 2007 16:47:46 -0000
@@ -1,3 +1,9 @@
+2007-09-11  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* src/cstartup.cxx: Change the INIT priority of
+	cyg_libc_startup_obj so that it is always called after the thread
+	has been constructed. Reported by taiyun@sunnorth.com.cn
+
 2007-07-02  Gary Thomas  <gary@mlbassoc.com>
 
 	* cdl/startup.cdl: Add (char *) casts to make GCC/4.2.x happy.
Index: language/c/libc/startup/current/src/cstartup.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/startup/current/src/cstartup.cxx,v
retrieving revision 1.3
diff -u -r1.3 cstartup.cxx
--- language/c/libc/startup/current/src/cstartup.cxx	23 May 2002 23:07:11 -0000	1.3
+++ language/c/libc/startup/current/src/cstartup.cxx	11 Sep 2007 16:47:46 -0000
@@ -104,7 +104,7 @@
 };
 
 static cyg_libc_startup_dummy_constructor_class cyg_libc_startup_obj
-                                  CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_LIBC);
+                                  CYGBLD_ATTRIB_INIT_AFTER(CYG_INIT_LIBC);
 
 #elif defined( CYGSEM_LIBC_STARTUP_MAIN_INITCONTEXT )
 

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]