X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f Message-ID: <4533BF1A.5080806@drv.nu> Date: Mon, 16 Oct 2006 13:19:22 -0400 From: Daniel Verkamp User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Global constructor order patch Content-Type: multipart/mixed; boundary="------------030900070007060105090208" Reply-To: djgpp-workers AT delorie DOT com This is a multi-part message in MIME format. --------------030900070007060105090208 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Attached is a patch for DJGPP to execute constructors in LIFO order, to match other platforms, like MinGW (gccmain.c) and gcc on Linux (libgcc.c/crtstuff.c). On those platforms, the __CTOR_LIST__ is always processed backwards. Destructor order as implemented in DJGPP now is correct (FIFO). The fix is by Andre Victor (av1ctor AT yahoo DOT com DOT br) of the FreeBASIC project - we stumbled across this problem while working on runtime initialization problems (the FB runtime's constructor must run before any user constructors). Thanks, -- Daniel Verkamp --------------030900070007060105090208 Content-Type: text/plain; name="djgpp-ctor-order.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="djgpp-ctor-order.patch" --- crt0/_main.c.orig 2006-10-16 13:15:38.250000000 -0400 +++ crt0/_main.c 2006-10-16 12:22:37.000000000 -0400 @@ -14,6 +14,9 @@ if (been_there_done_that == __bss_count) return; been_there_done_that = __bss_count; - for (i=0; i=0; i--) djgpp_first_ctor[i](); } --------------030900070007060105090208--