[U-Boot] packed attribute problem

Wolfgang Denk wd at denx.de
Thu Oct 7 21:31:43 CEST 2010


Dear Scott Wood,

In message <20101007135257.05a93975 at udp111988uds.am.freescale.net> you wrote:
>
> > It is a pretty common method to use a pointer to some struct (for
> > example, some form of PDU) and make it point to some I/O buffer.
> 
> Yes, but at that point we are not talking about well-defined C, but
> rather implementation-specific behavior.  There's nothing wrong with
> it, but the C standard is no longer authoritative on what happens in
> such cases.

Huch?  Which part of that is not well-defined (or even not
standard-conforming) C?

> Yes.  And there would also be performance complaints if each of those
> accesses were to trap and be emulated (even ignoring weird stuff like
> old ARM).  Thus it's nice to have some sort of pointer or data type
> annotation to tell the compiler to be careful.

I also complain about poor performance when instead of a single
instruction (a 32 bit load) at least 4 (8 bit) instructions need to be
executed.

> BTW, I see GCC splitting accesses to bitfields in a packed
> struct into bytes on powerpc, even with -mno-strict-align.

Indeed. Bitfields have always been evil.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"And it should be the law: If you use  the  word  `paradigm'  without
knowing  what  the  dictionary  says  it  means,  you  go to jail. No
exceptions."                     - David Jones @ Megatest Corporation


More information about the U-Boot mailing list