I would like to get linked with a C compiler.
There is no correct way, with assembly language you can do whatever you want.
But if you are trying to link with a C compiler for example then, why dont you just try using the compiler you have? It obviously can create objects that link with other objects made by the same compiler.
extern unsigned int more_fun ( unsigned int a, unsigned int b );
unsigned int fun ( unsigned int a, unsigned int b )
{
unsigned int c;
c = more_fun(a,b+7);
return(c+a+5);
}
this is what mine produces (with certain flags), object not linked...
00000000 <fun>:
0: 27bdffe8 addiu sp,sp,-24
4: 24a50007 addiu a1,a1,7
8: afbf0014 sw ra,20(sp)
c: afb00010 sw s0,16(sp)
10: 0c000000 jal 0 <fun>
14: 00808025 move s0,a0
18: 8fbf0014 lw ra,20(sp)
1c: 26100005 addiu s0,s0,5
20: 02021021 addu v0,s0,v0
24: 8fb00010 lw s0,16(sp)
28: 03e00008 jr ra
2c: 27bd0018 addiu sp,sp,24
I think that spells it out, and gives you a way to figure it out for more complicated parameters or return values. I prefer to compile and disassemble to compile to assembly. Much easier to read and actually see what is produced. YMMV.