[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4915262.qEFumRrH4p@radagast>
Date: Sun, 19 Jan 2014 01:10:39 +0000
From: James Hogan <james.hogan@...tec.com>
To: Antonio Quartulli <antonio@...hcoding.com>
Cc: Chen Gang <gang.chen.5i5j@...il.com>,
David Miller <davem@...emloft.net>, mareklindner@...mailbox.ch,
sw@...onwunderlich.de, b.a.t.m.a.n@...ts.open-mesh.org,
netdev <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
linux-metag@...r.kernel.org
Subject: Re: [PATCH linux-next] net: batman-adv: use "__packed __aligned(2)" for each structure instead of "__packed(2)" region
On Saturday 18 January 2014 14:03:26 Antonio Quartulli wrote:
> On 18/01/14 12:31, Chen Gang wrote:
> > Unfortunately, not all compilers assumes the structures within a pack
> > region also need be packed (e.g. metag), so need add a pack explicitly
> > to satisfy all compilers.
> >
> > The related error (under metag with allmodconfig):
> > MODPOST 2952 modules
> >
> > ERROR: "__compiletime_assert_431" [net/batman-adv/batman-adv.ko]
> > undefined!
> > ERROR: "__compiletime_assert_432" [net/batman-adv/batman-adv.ko]
> > undefined!
> > ERROR: "__compiletime_assert_429" [net/batman-adv/batman-adv.ko]
> > undefined!
> > ERROR: "__compiletime_assert_428" [net/batman-adv/batman-adv.ko]
> > undefined!
> > ERROR: "__compiletime_assert_423" [net/batman-adv/batman-adv.ko]
> > undefined!
> >
> > Signed-off-by: Chen Gang <gang.chen.5i5j@...il.com>
>
> David, what do you think about this change?
>
>
> Can "__packed __aligned(2)" generate a different structure padding than
> "#pragma pack(2)" ?
>
> I am not really sure about the difference between the two. But if we
> have the possibility that the padding may change then this patch should
> go into net, otherwise we will have a protocol compatibility problem
> between 3.13 and 3.14.
(Chen: sorry I didn't twig what you were referring to before about #pragma
pack not working)
It appears that the following gcc patch adds support for #pragma pack:
http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01115.html
I gave it a quick spin on metag gcc (which is unfortunately stuck on an old
version) and it seems to fix my simple test case so that #pragma pack(2)
becomes equivalent to __packed __aligned(2) (for sizeof and __alignof__).
However, the __packed and __aligned are linux specific macros to abstract
compiler details, whereas #pragma pack appears to be a compiler-specific WIN32
style equivalent to GCC's __attribute__((packed)) and
__attribute__((aligned(2))) (these are what __packed and __aligned use in
compiler-gcc.h).
Therefore I believe using the Linux abstractions is still more correct here.
Cheers
James
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists