This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ARM packed structures


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]