This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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: [PATCH, ARM] Don't use __thumb2__ to select _REENT_SMALL


On Tuesday 02 June 2009, Paul Brook wrote:
> > Yes, this leaks out into user code -- at least it does for me.  Try
> > building the standard arm-eabi multilib tools and then running the gcc
> > testsuite with -mcpu=cortex-a8 and -mthumb.  Programs such as
> > gcc.c-torture/exectute/fprintf-1.c will then fail.
> >
> > The definition of stdout is:
> > #define stdout  (_REENT->_stdout)
>
> In my sources this field lives at the same location in both cases.

Further investigation indicates upstream newlib is missing the following 
patch.

2009-06-02  Paul Brook  <paul@codesourcery.com>

	newlib/
	* libc/include/sys/reent.h (_reent): Adjust _REENT_SMALL to be binary
	compatible with normal layout

Index: newlib/libc/include/sys/reent.h
===================================================================
--- newlib/libc/include/sys/reent.h	(revision 159552)
+++ newlib/libc/include/sys/reent.h	(revision 159553)
@@ -344,14 +344,15 @@ struct _misc_reent
  * ports with 16-bit int's but 32-bit pointers, align nicely.  */
 struct _reent
 {
+  /* As an exception to the above put _errno first for binary
+     compatibility with non _REENT_SMALL targets.  */
+  int _errno;			/* local copy of errno */
 
   /* FILE is a big struct and may change over time.  To try to achieve binary
      compatibility with future versions, put stdin,stdout,stderr here.
      These are pointers into member __sf defined below.  */
   __FILE *_stdin, *_stdout, *_stderr;	/* XXX */
 
-  int _errno;			/* local copy of errno */
-
   int  _inc;			/* used by tmpnam */
 
   char *_emergency;


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