This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Ping : H8/300 ABI Document
- From: Jim Wilson <wilson at specifixinc dot com>
- To: Anil Paranjape <AnilP1 at KPITCummins dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 01 Apr 2004 12:58:44 -0800
- Subject: Re: Ping : H8/300 ABI Document
- References: <69595093233BB547BB70CF5E492B63F204B96BAE@sohm.kpit.com>
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