[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080425.223130.04936392.davem@davemloft.net>
Date: Fri, 25 Apr 2008 22:31:30 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: dlstevens@...ibm.com
Cc: yoshfuji@...ux-ipv6.org, netdev@...r.kernel.org
Subject: Re: [GIT PULL] [IPV6] COMPAT: Fix SSM applications on 64bit
kernels.
From: David Stevens <dlstevens@...ibm.com>
Date: Fri, 25 Apr 2008 21:36:29 -0700
> YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@...ux-ipv6.org> wrote on 04/25/2008
> 08:33:59 PM:
>
> > Please define __compat_sockaddr_storage{} with attribute((aligned(4))).
> > If you do that we do not need attribute(packed). No?
>
> I just tried it and the compiler seems to do that for this case,
> but the gcc documentation says explicitly that you need both packed and
> aligned if you want it to be a specific value. aligned(4) is a minimum
> only and the compiler would be free to add pad still as long as the
> padded value was also 4-byte aligned.
Regardless, using packed has several other side effects you absolutely
do not want. It causes words to be loaded using byte loads on RISC
architectures, because no alignment assumptions can be made at all
about packed objects.
Please use aligned(4), it should be totally sufficient.
> In this case, we want no pad, so packed is the relevant part. If
> had a char followed by a struct as in your previous example, the right
> way to get 4-byte alignment is both aligned(4) and packed. Leaving off
> packed would allow 8-byte or 16-byte (or 12 :-)) alignment, too.
Have you seen this in practice?
> I don't understand this comment. If you're suggesting I
> put these in an include file, I didn't because this is the only
> file that uses them and I don't want them to be visible to any
> other code. If you mean something else, please explain.
Right.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists