ARM packed structures
Dimitry Andric
dimitry@andric.com
Wed Nov 29 19:06:00 GMT 2006
Caputo, Tim wrote:
> I am having a problem with structures using the arm cross complier I've
> built. Initially I noticed that my structures were not being packed in
> memory. I realize now that this is meant to be efficient, however, I
> need to share these structures with legacy code on another processor and
> with specialty hardware that both expect/need them to be packed. I
> tried the pragma route, the attribute route and finally was successful
> packing my structures with the directive -fpack_struct.
Don't do that. Read the gcc manual, and use __attribute__((packed))
instead.
> Unfortunately this resulted the compiler being extremely conservative in
> how it accessed elements of the struct. It now reads one byte at a time
> from memory and reconstructs longwords in registers (I assume it is
> worried about the whole structure being unaligned in memory.)
It is not "worried", arm processors just *require* you to do this
dance. It depends on the specific cpu model how complicated the dance
is. :)
--
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc
mailing list