[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080426.000944.50852302.davem@davemloft.net>
Date: Sat, 26 Apr 2008 00:09:44 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: dlstevens@...ibm.com
Cc: netdev@...r.kernel.org, netdev-owner@...r.kernel.org,
yoshfuji@...ux-ipv6.org
Subject: Re: [GIT PULL] [IPV6] COMPAT: Fix SSM applications on 64bit
kernels.
From: David Stevens <dlstevens@...ibm.com>
Date: Sat, 26 Apr 2008 00:00:49 -0700
> I did see that plain old structure field __attribute((4))__
> wasn't correct (still padded), and gcc docs use the same language
> to define the behavior for structure field attribute "aligned" and
> type attribute "aligned" (at least with my limited research). So,
> it surprised me that the field attribute results in pad and the
> type attribute doesn't, and I wonder if it's good to rely on that
> difference given the same documentation for both as "minimum alignment".
> But if the compiler changes its notion of when to pad this in a way
> that breaks it, we can always revisit it later. :-)
You're right about this point of course:
--------------------
struct foo {
int a;
unsigned long b;
};
struct foo_align4 {
int a;
unsigned long b;
} __attribute__((aligned(4)));
int main(void)
{
printf("Normal: 'b' offset is %Zu\n",
__builtin_offsetof(struct foo, b));
printf("Align4: 'b' offset is %Zu\n",
__builtin_offsetof(struct foo_align4, b));
return 0;
}
--------------------
gives:
--------------------
Normal: 'b' offset is 8
Align4: 'b' offset is 8
--------------------
on sparc64.
So if we need to use packed because of that specific problem here,
fine.
--
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