This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


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

Re: Structure alignment with GCC


Christopher Bahns <chris@bahns.com> wrote:
 > I'd like some kind of command line option to specify the
 > default alignment of structures, but have searched the documentation (a
 > bit outdated) and found nothing. The only possible solution I've seen
 > mentioned so far is:

I _think_ the effect you want is that produced by defining
STRUCTURE_SIZE_BOUNDARY to 16 in the compiler sources.
[grep for that in gcc/config/m68k].
What you want is how gcc used to behave for embedded m68k targets but
it plays havoc with structure packing; lots of customers complained
so Cygnus deleted it [it's just plain unnatural].

I don't know if defining it is sufficient though.
I kinda think it is, but that's just a semi-educated guess.

You might want to give it a spin.
If it works you could submit a patch that enables it with a command
line option (assuming such a thing is possible, and without much
effort).  There's only one reference to it in gcc:

casey:~/casey/gnu/cvs/egcs/src/gcc$ grep STRUCTURE_SIZE *.c
stor-layout.c:#ifdef STRUCTURE_SIZE_BOUNDARY
stor-layout.c:    rli->record_align = MAX (rli->record_align, STRUCTURE_SIZE_BOUNDARY);

so it shouldn't take too much effort.
Hmmm... grepping for STRUCTURE_SIZE_BOUNDARY in gcc/config/*/*.[ch]
shows the arm and sh ports have command line options to set it,
so you could piggyback off of what they do.  You don't even
need to touch gcc proper.

You'd kinda have to be prepared to do a bit of gcc hacking;
the biggest amount of time would be the learning curve,
the actual hacking is trivial once you know what you're doing. :-)
[again, assuming that's all there is too it]

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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