Thanks for shedding some light on this.
I wonder though why disassembling "works" in some cases and
sometimes not:
int foo()
{
asm
{
naked;
mov RAX, 1;
}
}
void main()
{
int i = foo();
}
yields
0000000000000000 <_Dmain>:
0: 55 push rbp
1: 48 8b ec mov rbp,rsp
4: e8 00 00 00 00 call 9 <_Dmain+0x9>
5: R_X86_64_PC32 _D4test3fooFZi-0x4
9: 31 c0 xor eax,eax
b: 5d pop rbp
c: c3 ret
while
void foo() {}
void bar() {foo();}
turns into
0000000000000000 <_D5test23barFZv>:
0: 55 push rbp
1: 48 8b ec mov rbp,rsp
4: e8 00 00 00 00 call 9 <_D5test23barFZv+0x9>
5: R_X86_64_PC32 _D5test23fooFZv-0x4
9: 5d pop rbp
a: c3 ret