Subject: Re: structure alignment on arm in NetBSD? (resend without html)
To: None <tech-toolchain@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: tech-toolchain
Date: 10/16/2007 17:03:37
In article <20071016120156.GC11851@bigmac.stderr.spb.ru>,
Valeriy E. Ushakov <uwe@stderr.spb.ru> wrote:
>On Mon, Oct 15, 2007 at 18:11:09 +0000, Christos Zoulas wrote:
>
>> I am not sure, but the kernel structures should be fixed instead...
>
>As far as I understand, if ABI enforces 32-bit alignment on structs
>there's just no chance you can express things like the following, so I
>don't see how can you "fix" kernel structures for that.
>
>struct foo { /* common 2-bytes header */
>	uint8_t a;
>	uint8_t b;
>};
>
>struct bar { /* some 4-bytes "packet" with common header */
>	struct foo;	/* oops, has two bytes of tail padding */
>	uint8_t c;
>	uint8_t d;
>};
>
>
>I guess that's why AAPCS reverted to naturally aligned structs.

Either by __attribute__((__packed__)) or by not using a struct.

christos