PowerPC64 alignment of double in structs

Steve Munroe sjmunroe at us.ibm.com
Thu Sep 18 07:55:13 EST 2003


On Wed, 2003-09-17 at 18:11, Alan Modra wrote:
> http://gcc.gnu.org/ml/gcc-patches/2003-09/msg01003.html is a proposal
> for fixing struct layout rules on powerpc64-linux-gcc to comply with
> the PowerPC64 Linux ABI.  The ABI specifies 4 byte alignment for
> doubles, which is a little surprising for someone without an AIX
> background, and isn't ideal for speed.  An alternative would be to
> change the ABI and gcc (and presumably xlc) to natural alignment.
>
> I'm interested in opinions..

Unfortunately this change might break backward compatibility with existing
libraries. Basically any ABI where the application passes a struct
containing a double to an existing library (or an old application to a new
library) might break. I bumped into this when I wanted to change the
alignment of pthread_mutex_t (etc) to avoid false sharing at the
reservation.

In glibc it may be possible to version these interfaces but it is not
clear the gain is worth the pain. In the case of pthread_mutex_t
alignment, I decided to leave it alone. Even if we can fix glibc what
about the other libraries.

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list