Ping : H8/300 ABI Document
Jim Wilson
wilson@specifixinc.com
Thu Apr 1 20:58:00 GMT 2004
Anil Paranjape wrote:
> Structure Alignment
> Unless __attribute__ ((packed)) is attached to the declaration of a struct, each structure member is aligned
> to a multiple of 2 bytes on H8/300 and of 4 bytes on H8/300H and H8S.
This is a maximum. Fields get natural alignment (alignment same as
size) up to this maximum. So shorts are always 2 byte aligned, but
4-byte ints get 2-byte alignment on H8/300 and 4-byte alignment on H8S.
Structure alignment is the max of the alignment of all fields.
Your suggested wording is not correct. The structure in your example
still has only 2-byte alignment even whwn compiled for H8S.
.comm _t,4,2
gives it a 4-byte size and 2-byte alignment. This is because shorts
always have 2-byte alignment.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
More information about the Gcc
mailing list