[patch] Implement __cxa_atexit

Christopher Faylor me@cgf.cx
Tue Sep 14 23:47:00 GMT 2004

On Tue, Sep 14, 2004 at 02:46:57PM -0400, jjohnstn wrote:
>Apparently there is some hidden dependency in Cygwin on the _reent struct 
>as old applications are no longer working with this change.  This is 
>unfortunate.  Until someone from Cygwin can determine what the problem is 
>I have chosen to freeze sys/reent.h for Cygwin by putting it in the 
>libc/sys/cygwin/sys directory.  The new changes have been modified to look 
>for a new flag __REENT_HAS_CXA_SUPPORT to enable the new cxa support.  The 
>default libc/include/sys/reent.h has the flag turned on.

We were actually relying on behavior between two different versions of a
compiler being unchanged.

This is the minimal way to fix this.  I suppose it really should be
#ifdef __CYGWIN__ though.

I can fix this in another way in cygwin but this seemed cleaner and
more straightforward.

This patch is against the previous version of reent.h prior to any
conditionalization.  With this change cygwin seems to be ok.


Index: libc/include/sys/reent.h
RCS file: /cvs/uberbaum/newlib/libc/include/sys/reent.h,v
retrieving revision 1.30
diff -u -p -r1.30 reent.h
--- libc/include/sys/reent.h	9 Sep 2004 19:46:54 -0000	1.30
+++ libc/include/sys/reent.h	14 Sep 2004 23:15:14 -0000
@@ -561,7 +561,7 @@ struct _reent
 #define _REENT_SIGNAL_BUF(ptr)  ((ptr)->_signal_buf)
 #else /* !_REENT_SMALL */
+#pragma pack(push,4)
 struct _reent
   int _errno;			/* local copy of errno */
@@ -638,6 +638,7 @@ struct _reent
   struct _glue __sglue;		/* root of glue chain */
   __FILE __sf[3];  		/* first three file descriptors */
+#pragma pack(pop)
 #define _REENT_INIT(var) \
   { 0, \

More information about the Newlib mailing list