* AIX-specific struct alignment rules

o doubles are aligned to 8 bytes outside records, but to 4 bytes
     inside them
   o same as for Darwin/PPC: if the first field of a record has 8 byte
     alignment (including double!), then the struct itself gets 8 byte
     alignment

git-svn-id: trunk@20791 -
This commit is contained in:
Jonas Maebe 2012-04-11 18:00:37 +00:00
parent 462de0f5fd
commit 57908f528b
2 changed files with 9 additions and 1 deletions

View File

@ -1596,7 +1596,7 @@ implementation
(32-bit) alignment, in which case the alignment is determined by
the alignment of the first field. */
}
if (target_info.system in [system_powerpc_darwin, system_powerpc_macos, system_powerpc64_darwin]) and
if (target_info.abi=abi_powerpc_aix) and
is_first_type and
(symtablestack.top.symtabletype=recordsymtable) and
(trecordsymtable(symtablestack.top).usefieldalignment=C_alignment) then

View File

@ -946,6 +946,14 @@ implementation
l:=sym.getsize;
vardef:=sym.vardef;
varalign:=vardef.alignment;
{$if defined(powerpc) or defined(powerpc64)}
{ aix is really annoying: the recommended scalar alignment for both
int64 and double is 64 bits, but in structs int64 has to be aligned
to 8 bytes and double to 4 bytes }
if (target_info.system in systems_aix) and
is_double(vardef) then
varalign:=4;
{$endif powerpc or powerpc64}
case usefieldalignment of
bit_alignment: