All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] IP_t should be a "packed" struct
Date: Wed, 28 Jan 2009 13:21:29 -0800	[thread overview]
Message-ID: <4980CC59.1070302@gmail.com> (raw)
In-Reply-To: <b73e93990901281240l71c60e96y837802e434e5a681@mail.gmail.com>

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>

  reply	other threads:[~2009-01-28 21:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-27 18:32 [U-Boot] IP_t should be a "packed" struct Luigi 'Comio' Mantellini
2009-01-28  9:42 ` Luigi 'Comio' Mantellini
2009-01-28 17:55 ` Ben Warren
2009-01-28 18:36   ` Jerry Van Baren
2009-01-28 18:58     ` Ben Warren
2009-01-28 20:40       ` Luigi Mantellini
2009-01-28 21:21         ` Ben Warren [this message]
2009-01-28 21:38           ` Wolfgang Denk
2009-01-28 21:52             ` Ben Warren
2009-01-28 22:21               ` Wolfgang Denk
2009-01-28 22:16             ` Luigi Mantellini
2009-01-28 22:27               ` Wolfgang Denk
2009-01-28 23:04                 ` Luigi Mantellini
2009-01-29 10:20                   ` Wolfgang Denk
2009-01-29 10:37                     ` Alessandro Rubini
2009-01-28 20:58   ` Luigi Mantellini
2009-01-28 21:26     ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4980CC59.1070302@gmail.com \
    --to=biggerbadderben@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.