[ECOS] structure size
Roland Caßebohm
roland.cassebohm@visionsystems.de
Tue Jan 6 17:04:00 GMT 2004
On Dienstag, 6. Januar 2004 17:01, Grant Edwards wrote:
> > -------------------------------------------------------------------------
> >--- struct xyzzy {
> > short a;
> > int b;
> > } __attribute__((packed));
> >
> > struct xyzzy data;
> >
> > int
> > fred(void)
> > {
> > data.b = 42;
> > }
> > -------------------------------------------------------------------------
> >---
> >
> > Compile with arm-elf-gcc -S. The assignment to data.b is implemented
> > using four separate strb instructions, as I would expect. If you try
> > reading data.b instead there will be four ldrb instructions plus
> > appropriate manipulation.
>
> Very interesting. I don't have arm-elf-gcc handy, but I'll
> certainly take your word for it. I swear that didn't used
> work. The last time I had an alignment problem on ARM was
> probably 4 years ago with gcc 2.something. I distinctly
> remember having to change a bunch of "int" assignments into
> memcpy() calls when filling in fields in a network packet.
I had also such alignment problems with an ARM, but turning
-mno-short-load-words on fixed it for me.
Regards,
Roland
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
More information about the Ecos-discuss
mailing list