This is the mail archive of the crossgcc@sources.redhat.com 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] |
> Dear all, > > I am trying to figure out why gcc always aligns on 4 bytes boundaries (32 bits) > on arm-elf-gcc in an attempt to reduce code footprint. I found that GCC produces > much bigger code than ADS (30 to 50 %) when ARM and THUMB are mixed > (interworking enabled) on our project. > > It indeed seems that ARM ADS 1.2 aligns on halfwords (16 bits) when in THUMB > mode (along with much more sophisticated rules). GCC different behavior causes > much more padding to be inserted in structs members and, as the project I work > on uses HW mapped registers, application crashes. > For now, I worked around that using a compile time define to enable the > __attribute((packed))__ on the struct(s). I would nevertheless like to know > whether there is another solution. > > I am also digging into the arm.h and arm.c files (thanks to the gcc's internal > manual) to try to change the alignment behavior. > > Could you give me other ideas/solutions on that point? > GCC defaults to the old APCS rules on structure alignment and padding, which means that all structures are word-aligned by default. ARM ADS uses the ATPCS rules where structures take the alignment of their most aligned member. You can change gcc's default for this with the compiler switch -mstructure-size-boundary=8 but beware that this changes the ABI, so you will need to rebuild all your code (including the libraries) with this option. R. ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |