[U-Boot] IP_t should be a "packed" struct

Ben Warren biggerbadderben at gmail.com
Wed Jan 28 22:21:29 CET 2009


Luigi Mantellini wrote:
> Dear All
>
> From my point of view, when packing is formally required (ie packets
> headers), the structs should be declared explicitly as __packed__. The
> correctness of the object code should be independent from the compiler
> optimizations and we should always remember that the offset of a
> struct field is not necessarily the sum of the sizes of the fields
> that precede it.
>
> struct {
>  type1 a;
>  type2 b;
>  type3 c;
> } mystruct
>
>
> offset(mystruct.c)  !=  sizeof(type1) + sizeof(type2).
>
> Regarding the CFLAGS used by me... I haven't set any CFLAGS and I just
> do a make qemu_mips_config CROSS_COMPILE=mips-linux- && make
> CROSS_COMPILE=mips-linux... and a boundary alignment is not an alien
> choice for a good compiler (a standard gcc4.2.4 in my case).
> Furthermore I expect a correct object always... with any -Ox flag (a
> apart bugs... of course).
>
> My idea should be to declare a define like this
>
> #define PKT_HEADER __attribute__((__packed__))
>
> my 2EuroCents.
>
> best regards,
>
> luigi
>
>   
OK, sounds good.  Send a patch please.

regards,
Ben
<snip>


More information about the U-Boot mailing list