Background:
So, I watched several tutorial videos on how the compiler and linker (in VS 2017 VC ++ compiler / linker) work by looking at the assembly files to put everything together. When I compile and link these two cpp files together:
main.cpp (note: I removed the implicit link to the c library and defined my own mainCRTStartup function to make it easier to view the .exe result file.)
int Func1(int x);
int mainCRTStartup(void)
{
Func1(3);
return 0;
}
func1.cpp
int Func1(int x)
{
x +=2;
return x;
}
I get the main.exe file, which looks something like this:
File Type: EXECUTABLE IMAGE
0000000140001000: CC int 3
0000000140001001: CC int 3
0000000140001002: CC int 3
0000000140001003: CC int 3
0000000140001004: CC int 3
@ILT+0(?Func1@@YAHH@Z):
0000000140001005: E9 36 00 00 00 jmp ?Func1@@YAHH@Z
@ILT+5(?mainCRTStartup@@YAHXZ):
000000014000100A: E9 11 00 00 00 jmp ?mainCRTStartup@@YAHXZ
000000014000100F: CC int 3
0000000140001010: CC int 3
0000000140001011: CC int 3
0000000140001012: CC int 3
0000000140001013: CC int 3
0000000140001014: CC int 3
0000000140001015: CC int 3
0000000140001016: CC int 3
0000000140001017: CC int 3
0000000140001018: CC int 3
0000000140001019: CC int 3
000000014000101A: CC int 3
000000014000101B: CC int 3
000000014000101C: CC int 3
000000014000101D: CC int 3
000000014000101E: CC int 3
000000014000101F: CC int 3
?mainCRTStartup@@YAHXZ:
0000000140001020: 48 83 EC 28 sub rsp,28h
0000000140001024: B9 03 00 00 00 mov ecx,3
0000000140001029: E8 D7 FF FF FF call @ILT+0(?Func1@@YAHH@Z)
000000014000102E: 33 C0 xor eax,eax
0000000140001030: 48 83 C4 28 add rsp,28h
0000000140001034: C3 ret
0000000140001035: CC int 3
0000000140001036: CC int 3
0000000140001037: CC int 3
0000000140001038: CC int 3
0000000140001039: CC int 3
000000014000103A: CC int 3
000000014000103B: CC int 3
000000014000103C: CC int 3
000000014000103D: CC int 3
000000014000103E: CC int 3
000000014000103F: CC int 3
?Func1@@YAHH@Z:
0000000140001040: 89 4C 24 08 mov dword ptr [rsp+8],ecx
0000000140001044: 8B 44 24 08 mov eax,dword ptr [rsp+8]
0000000140001048: 83 C0 02 add eax,2
000000014000104B: 89 44 24 08 mov dword ptr [rsp+8],eax
000000014000104F: 8B 44 24 08 mov eax,dword ptr [rsp+8]
0000000140001053: C3 ret
0000000140001054: CC int 3
0000000140001055: CC int 3
0000000140001056: CC int 3
0000000140001057: CC int 3
Question:
I have two problems that I'm afraid of:
1.) , .exe , "", , 000040001000, asm @ILT+0(?Func1@@YAHH@Z)
, . , , .exe? , , exe , , , 000040001000.
2.) , "" Func1 VS, , . , exe ( ) ( @ILT+0(?Func1@@YAHH@Z)
asm ) THEN jmp, Func1. "", "jmp"?