linux-mips
[Top] [All Lists]

Re: MIPS gas problem

To: kk@ddeorg.soft.net, flo@rfc822.org, ian@zembu.com
Subject: Re: MIPS gas problem
From: Hiroyuki Machida <machida@sm.sony.co.jp>
Date: Fri, 21 Apr 2000 10:52:25 +0900
Cc: binutils@sourceware.cygnus.com, linux@cthulhu.engr.sgi.com, debian-mips@lists.debian.org
In-reply-to: <20000420164812.17210.qmail@daffy.airs.com>
References: <200004201207.RAA07021@madras.ddeorg.soft.net> <20000420164812.17210.qmail@daffy.airs.com>
Sender: owner-linuxmips@oss.sgi.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;

}

<Prev in Thread] Current Thread [Next in Thread>