Subject: Re: structure alignment on arm in NetBSD? (resend without html)
To: Martin Fouts <mfouts@danger.com>
From: Matt Thomas <matt@3am-software.com>
List: tech-toolchain
Date: 10/15/2007 10:28:04
On Oct 15, 2007, at 9:45 AM, Martin Fouts wrote:
> Deep in the heart of gcc sources,
> In src/gnu/dist/gcc4/gcc/config/arm/netbsd-elf.h I found the comment
>
> /* VERY BIG NOTE: Change of structure alignment for NetBSD/arm.
> There are consequences you should be aware of...
>
> Normally GCC/arm uses a structure alignment of 32 for compatibility
> with armcc. This means that structures are padded to a word
> boundary. However this causes problems with bugged NetBSD kernel
> code (possibly userland code as well - I have not checked every
> binary). The nature of this bugged code is to rely on sizeof()
> returning the correct size of various structures rounded to the
> nearest byte (SCSI and ether code are two examples, the vm system
> is another). This code breaks when the structure alignment is 32
> as sizeof() will report a word=3Drounded size. By changing the
> structure alignment to 8. GCC will conform to what is expected by
> NetBSD.
>
> (rest elided...)
>
> Is this comment still accurate?
Yes. Also, NetBSD does not use short-enums either.