Alignment problems with MIPS cross-compiler
Roy Franz
roy@royfranz.com
Tue Mar 2 22:52:00 GMT 2004
Hello,
I am having problems with the aligned attribute on a gcc 3.2.1
cross compiler for MIPS. (running on x86 linux) I am not sure if this is
a known (but undocumented) limitation of the MIPS crosscompiler or is
really a bug.
I specify the aligned attribute on a global variable, but the variable
is not aligned. The assembly file does not specify the alignement, nor
is it present in the .o elf file. The same program works fine when
compiled on the native gcc (GCC) 3.2.3 20030316 (Debian prerelease)
compiler.
In the MIPS case the alignment is not specified in the assembly file,
whereas for x86 it is specified.
Is this a bug or a known limitation? Any help would be appreciated.
(Please CC me as I am not subscribed, but I will also be checking the
archives.)
Thanks,
Roy
#include <stdio.h>
__attribute__ ((__aligned__(256))) int aligned_int;
main()
{
printf("aligned_int: %p\n", &aligned_int);
}
on x86 I get the following in the .s file:
.comm aligned_int,4,256
and the following in the elf file (from read_elf --symbols)
8: 00000100 4 OBJECT GLOBAL DEFAULT COM aligned_int
When compiling for MIPS (compiling for mips64 ) I get:
(I tried compiling 32 bit code and had the same issues.)
.comm aligned_int,4
and
11: 0000000000000004 4 OBJECT GLOBAL DEFAULT COM aligned_int
More information about the Gcc-help
mailing list