From owner-svn-src-projects@FreeBSD.ORG Fri Jul 10 07:30:35 2009 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1E5F1065672; Fri, 10 Jul 2009 07:30:35 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 8F1C08FC1F; Fri, 10 Jul 2009 07:30:35 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id n6A7PnxJ087026; Fri, 10 Jul 2009 01:25:49 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Fri, 10 Jul 2009 01:26:30 -0600 (MDT) Message-Id: <20090710.012630.-875846397.imp@bsdimp.com> To: kientzle@freebsd.org From: "M. Warner Losh" In-Reply-To: <4A561477.7000508@freebsd.org> References: <20090709041145.G46111@delplex.bde.org> <86prc9g8yf.fsf@ds4.des.no> <4A561477.7000508@freebsd.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, des@des.no, src-committers@freebsd.org, rpaulo@freebsd.org, brde@optusnet.com.au Subject: Re: svn commit: r195460 - projects/mesh11s/sys/net80211 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jul 2009 07:30:36 -0000 In message: <4A561477.7000508@freebsd.org> Tim Kientzle writes: : Dag-Erling Sm=F8rgrav wrote: : > Bruce Evans writes: : >> Broken ABIs (e.g., arm?) may add padding at the end of structs, : > = : > Padding at the end of a struct is *required* to ensure proper align= ment : > of the next element in an array, e.g. : > = : > struct foo { int i; char c; } bar[2]; : > = : > Assuming a four-byte alignment requirement for int, the compiler *m= ust* : > add three bytes of padding at the end of struct foo so bar[1].i is : > correctly aligned. : > = : > cf. ISO/IEC 9899:1999 =A76.7.2.1: : > = : > 15 There may be unnamed padding at the end of a structure or union.= : = : Everyone (I hope!) expects alignment in the : case you outlined. But many of us have been : surprised to see the ARM compiler pad : = : struct foo { : char f1[4]; : char f2[1]; : char f3[1]; : }; : = : to 12 bytes. This breaks a lot of traditional : code that uses structs of char arrays to : define memory and disk layouts. : = : I'm not claiming that the ARM compiler is broken, : just that its padding behavior surprises : a lot of people. It isn't a compiler bug. It is an ABI requirement for ARM. At least for the ABI we use. there are others that might be better, and not suffer from this surprise. We[*] should investigate them. Warner [*] By "we" of course I mean "some smart guy that isn't me" :)