I had just a look at a very simple SPARC assembly output that I got from this C programm:
int addition_func(int a, int b)
{
return(a+b);
}
void main()
{
int a = 20;
int b = 19;
int res;
res = addition_func(a, b);
}
Disassembly of section .text:
00000000 <addition_func>:
0: 81 c3 e0 08 retl
4: 90 02 00 09 add %o0, %o1, %o0
00000008 <main>:
8: 90 10 20 14 mov 0x14, %o0
c: 92 10 20 13 mov 0x13, %o1
10: 82 13 c0 00 mov %o7, %g1
14: 40 00 00 00 call 14 <main+0xc>
18: 9e 10 40 00 mov %g1, %o7
1c: 01 00 00 00 nop
I do not understand why the "call" instruction says:
call 14 <main+0xc>
Why is it not:
call 0 <addition_func+0x0>
The program works fine, however, this output does not make too much sense to me. Any suggestions why it is handled this way?
Thanks