This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Alignment problems with MIPS cross-compiler
- From: Eljay Love-Jensen <eljay at adobe dot com>
- To: Roy Franz <roy at royfranz dot com>, gcc-help at gcc dot gnu dot org
- Date: Tue, 02 Mar 2004 20:36:04 -0600
- Subject: Re: Alignment problems with MIPS cross-compiler
- References: <40451072.3000901@royfranz.com>
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