MIPS上实现C和汇编互相调用?
因为最近的项目,需要在MIPS上实现C和汇编的互相调用,参照论坛以前的帖子
//test.c
#include <stdio.h>
int addtest(int a,int b);
int main()
{
int a,b,c;
a=1;
b=2;
c=addtest(a,b);
printf("a+b=%d\n",c);
return 0;
}
//addtest.s
.text
.global addtest
.ent addtest
addtest:
addu $2,$4,$5
j $31
.end addtest
参照论坛以前的帖子,在MIPS SDE1.0.0中,写了以上的C和汇编互相调用的例子,怎么编译不过去呀,有那位高手指点一下迷津,非常感激!
//test.c
#include <stdio.h>
int addtest(int a,int b);
int main()
{
int a,b,c;
a=1;
b=2;
c=addtest(a,b);
printf("a+b=%d\n",c);
return 0;
}
//addtest.s
.text
.global addtest
.ent addtest
addtest:
addu $2,$4,$5
j $31
.end addtest
//编译过程
mipsel-linux-gcc -o test addtest.s test.c
//执行过程
./test
a+b=3