[PATCH, ARM] Don't use __thumb2__ to select _REENT_SMALL

Richard Earnshaw rearnsha@arm.com
Tue Jun 2 14:13:00 GMT 2009


On Tue, 2009-06-02 at 14:46 +0100, Paul Brook wrote:
> On Tuesday 02 June 2009, Richard Earnshaw wrote:
> > This cost me at least a couple of hours debugging at the weekend; I was
> > trying to work out why my file handles were all corrupted when compiling
> > code for Thumb-2.  It turns out that Newlib's config.h was changing the
> > ABI depending on the instruction set it was compiling for -- a big No
> > No, since code is supposed to interwork freely between the two ISAs!
> 
> I'm fairly sure I tested this, and concluded that it had no effect on the 
> external library ABI. In fact I think I fixed bugs related to this.
> i.e. this only matters if you're trying to compile part of the library as 
> Thumb-2 and part as ARM. Do we really care about that? Or did I miss 
> something?
> 
> Paul

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)

Which thus depends on the layout of _REENT.

R.
-- 
Richard Earnshaw             Email: Richard.Earnshaw@arm.com
Engineering Manager          Phone: +44 1223 400569 (Direct + VoiceMail)
OpenSource Tools             Switchboard: +44 1223 400400
ARM Ltd                      Fax: +44 1223 400410
110 Fulbourn Rd              Web: http://www.arm.com/
Cambridge, UK. CB1 9NJ




More information about the Newlib mailing list