[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20061207094833.GD4942@hasse.suse.de>
Date: Thu, 7 Dec 2006 10:48:33 +0100
From: Jan Blunck <jblunck@...e.de>
To: Phil Endecott <phil_arcwk_endecott@...zphil.org>,
linux-kernel@...r.kernel.org
Subject: Re: Subtleties of __attribute__((packed))
On Wed, Dec 06, Russell King wrote:
> On Wed, Dec 06, 2006 at 04:54:39PM +0100, Jan Blunck wrote:
> > Maybe the arm backend is somehow broken. AFAIK (and I verfied it on S390 and
> > i386) the alignment shouldn't change.
>
Once again: I refered to "packed attribute on the struct vs. packed attribute
on each member of the struct". The alignment shouldn't be different.
> Please read the info pages:
>
> `packed'
> This attribute, attached to an `enum', `struct', or `union' type
> definition, specifies that the minimum required memory be used to
> represent the type.
>
> Specifying this attribute for `struct' and `union' types is
> equivalent to specifying the `packed' attribute on each of the
> structure or union members. Specifying the `-fshort-enums' flag
> on the line is equivalent to specifying the `packed' attribute on
> all `enum' definitions.
>
> Note that it says *nothing* about alignment. It says "minimum required
> memory be used to represent the type." which implies that the internals
> of the structure are packed together as tightly as possible.
>
> It does not say "and as such the struct may be aligned to any alignment".
>
And this is why it makes sense to think about align attribute when you use
packed.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists