Subject: Re: Another ELF issue
To: None <Richard.Earnshaw@arm.com>
From: David Laight <dsl@l8s.co.uk>
List: port-arm
Date: 02/14/2002 18:48:58
On Wed, Feb 13, 2002 at 05:19:53PM +0000, Richard Earnshaw wrote:
> 
> [8-byte alignment]
> >  > Does our Malloc do this?
> > 
> > Well, mallocs on the Alpha are certainly suitably aligned, so it's
> > possible, at least :-)
> > 

I suspect the sparc one is also,  IIRC it has to be 16-byte aligned
on some system, maybe sparc64.
> 
> The reason I asked is that some Mallocs use a union with a type that 
> requires maximum alignment (eg double).  That won't work here, since no 
> type on the ARM requires that by default -- it's just that we can generate 
> more efficient code in some cases if we know that they are more aligned 
> than that.
> 
> > The minimum allocation size is currently 16 bytes, and it appears to
> > be a power-of-two allocator, so I think we're okay.

Don't you need to check the kernel allocater, user allocator, all the
'diagnostic' user allocaters that might be used?

I presume ldrd is ARM v5?  Don't remember it the in ARM v4 book,
since the default netbsd compile is ARM v3 - this is somewhat moot!

Mind you I would have expected the ABI to specify that double be
aligned on 8 byte boundary, and 'complex double' and 'long double'
on 16 byte (I've forgotten the exact names for these types).
Not doing so is asking for trouble down the line....
(I've rarely written any FP in the last 25 years - except an ARM FP
library! does that count?)

Maybe gcc should issue a warning whenever it misaligns items within
a structure?  Can it remember which items ought to be aligined?

	David