[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTimyaA+JdBHekm69R5Y2A2DEdPdndFLrKJAaz=vt@mail.gmail.com>
Date: Mon, 21 Feb 2011 18:03:16 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Benjamin Herrenschmidt <benh@...nel.crashing.org>
Cc: Rusty Russell <rusty@...tcorp.com.au>,
David Miller <davem@...emloft.net>, dtor@...are.com,
linux-kernel@...r.kernel.org, geert@...ux-m68k.org,
linux-m68k@...r.kernel.org, linux-arch@...r.kernel.org
Subject: Re: [PATCH 1/3] module: deal with alignment issues in built-in module versions
On Mon, Feb 21, 2011 at 5:58 PM, Benjamin Herrenschmidt
<benh@...nel.crashing.org> wrote:
>
> The only sane thing I can see is make sure that such structures that
> we put into sections "arrays" like that are naturally aligned with
> padding.
The sad part is, that assuming I read the gcc sources correctly (see
the earlier emails where David pointed to it), that alignment is:
- architecture-specific
- depends on the size of the structure
- seems to depend on the version of gcc itself.
The _one_ safe case is likely to be "structure size is a power of
two". And it does look like using a pointer is going to be safe, not
only because the gcc auto-alignment only triggers for things like
structs/unions/arrays, but because at least the x86 code only does it
if the structure was bigger than the alignment size itself.
So using pointer indirection is likely to be safe. It's still ugly and
annoying as heck, though.
Linus
--
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