Alignment problems with MIPS cross-compiler

Eljay Love-Jensen eljay@adobe.com
Wed Mar 3 02:36:00 GMT 2004


Hi Roy,

As I understand it, alignment is modulo whatever the given platform supports.

If the components on MIPS only support, say, 16 bytes (which I'm just 
pulling out of thin air), then specifying __attribute__((__aligned__(256))) 
will be ineffective.

Some platforms only support alignments of 4.  Others 8 or 16.  I don't know 
what MIPS supports.

In this case, when I say "platform", that comprises the OS as well as the 
assembler and linker.  Least useful denominator rule applies.

Also note, some (most?) platforms require that the alignment be a one of 
2^x (where x is 0 to some "n").  So if you tested 
__attribute__((__aligned__(3))) for a RGB quantity, for example, I wouldn't 
be surprised to find out that it wasn't honored everywhere as one may 
expect.  Caveat emptor!

HTH,
--Eljay



More information about the Gcc-help mailing list