PPC64 alignment question
PPC64 alignment question
- Subject: PPC64 alignment question
- From: Jonas Maebe <email@hidden>
- Date: Tue, 13 Feb 2007 19:35:42 +0100
Hello,
http://developer.apple.com/documentation/DeveloperTools/Conceptual/
LowLevelABI/Articles/64bitPowerPC.html says:
P ower alignment mode is derived from the alignment rules used by the
IBM XLC compiler for the AIX operating system. It is the default
alignment mode for the PowerPC-architecture version of GCC used on
AIX and Mac OS X. Because this mode is most likely to be compatible
between PowerPC-architecture compilers from different vendors, it’s
typically used with data structures that are shared between different
programs.
The rules for power alignment are:
* The embedding alignment of the first element in a data structure is
equal to the element’s natural alignment.
* For subsequent elements with a natural alignment less than 4 bytes,
the embedding alignment of each element is equal to its natural
alignment.
* For subsequent elements that have a natural alignment greater than
4 bytes, the embedding alignment is 4, unless the element is a vector.
...
Below that list, it says:
***
Because the natural alignment of double and long long data types is
greater than 4 bytes, they may not be appropriately aligned in power-
alignment mode. Any misalignment impairs performance when such data
members are accessed. When you use these data types for any element
after the first element, the compiler pads the structure to align the
elements to their natural alignment.
***
That last sentence seems to contradict the earlier statement that
"for subsequent elements that have a natural alignment greater than 4
bytes, the embedding alignment is 4, unless the element is a vector".
When taking a look at /usr/include struct statfs, it looks like this:
struct statfs {
short f_otype; /* TEMPORARY SHADOW COPY OF
f_type */
short f_oflags; /* TEMPORARY SHADOW COPY OF
f_flags */
long f_bsize; /* fundamental file system
block size */
...
The f_bsize starts at byte 8 when compiling for ppc64. Does that mean
that in the sentence "For subsequent elements that have a natural
alignment greater than 4 bytes, the embedding alignment is 4, unless
the element is a vector", the "4" should be replaced by "8", and that
this is a copy/paste error from the PowerPC32 page?
Thanks,
Jonas _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden