This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: MIPS gas problem
- To: kk at ddeorg dot soft dot net, flo at rfc822 dot org, ian at zembu dot com
- Subject: Re: MIPS gas problem
- From: Hiroyuki Machida <machida at sm dot sony dot co dot jp>
- Date: Fri, 21 Apr 2000 10:52:25 +0900
- Cc: binutils at sourceware dot cygnus dot com, linux at cthulhu dot engr dot sgi dot com, debian-mips at lists dot debian dot org
- References: <200004201207.RAA07021@madras.ddeorg.soft.net><20000420164812.17210.qmail@daffy.airs.com>
I rewrite the test program which is not depending your gcc version
or config. Please try this.
#define P1 10
#define P2 12
#define P1STR "10"
#define P2STR "12"
#define AL1 (2<<(P1-1))
#define AL2 (2<<(P2-1))
asm(
" .globl globalc;\n"
" .rdata;\n"
" .type globalc,@object;\n"
" .size globalc,1;\n"
"globalc:\n"
" .byte 97;\n"
);
asm(
" .globl global1;\n"
" .align " P1STR ";\n"
" .type global1,@object;\n"
" .size global1,4;\n"
"global1:\n"
" .word 0;\n"
);
asm(
" .globl global2;\n"
" .align " P2STR ";\n"
" .type global2,@object;\n"
" .size global2,4;\n"
"global2:\n"
" .word 1;\n"
);
int total_ng=0;
void check(char *addr, unsigned long al)
{
unsigned long mask = (al -1);
if ((unsigned long) addr & mask){
total_ng ++;
printf("err:%x expected:%x\n", addr,
(unsigned long) addr & ~mask);
}
}
int
main(void)
{
extern int global1, global2;
extern char globalc;
printf("* readonly gloabl\n");
printf("chcking align:%x\n",AL1);
check((char *)&global1,AL1);
printf("%x\n", &global1);
printf("chcking align:%x\n",AL2);
check((char *)&global2,AL2);
printf("%x\n", &global2);
printf("\n");
if (total_ng) {
printf("NG:%d\n",total_ng);
} else {
printf("OK\n");
}
printf("\n");
return total_ng;
}