Subject: Re: EGCS and structure returns
To: Todd Vierling <tv@pobox.com>
From: Richard Earnshaw <rearnsha@arm.com>
List: port-arm32
Date: 11/02/1998 12:57:10
tv@pobox.com said:
> And RETURN_IN_MEMORY gives us the -freg-struct-return compatibility,
> for now?  If so, I'm inclined to make that permanent, because it's
> what the shipped compiler did - unfortunately. 

I disagree.

1) -freg-struct-return is not compatible with the ABI for NetBSD/arm32.  
My mistake here previously was to forget that I had in fact changed the 
compiler so that -freg-struct-return was the default, and that 
NetBSD/arm32 requires -fpcc-struct-return.

2) Applications should not be using it unless they are completely 
self-containted (ie don't need to access any system libraries).  
Self-contained apps should still work fine if the behaviour changes.

2a) Applications using shared library interfaces (importing or exporting) 
definitely should not be using it.  You cannot require an app to be 
compiled with this to support one shared lib because it may call another 
shared lib built the other way.

3) The fact that it makes softfloat.c in libc compile in the way that is 
wanted is a fortunate hack, but it is definitely a hack.  It only works 
because the only structures used for return values in the that file are 
the ones we are interested in; if it were to try to call ldiv, for 
example, it would all explode horribly.

4) The fact that a previous release of the compiler behaved differently 
when an ABI changing flag was used shouldn't be used as an excuse here.

5) It breaks the potential to use the compiler for building APCS 
conforming apps (note this is not necessarily for use on NetBSD).

We should fix softfloat.c by fixing it so that it will compile correctly 
without changing the ABI  (either by changing the code, or by adding 
extensions to the compiler, or both).  The most portable way to make 
softfloat produce the "right" thing is to make it return "long long" for 
doubles -- these are returned in registers in the way that is required.

Richard.