Assume this C
code, compiled with gcc file.c
:
int main(){
return 0;
}
Generated output with objdump
:
0000000000000660 <main>:
660: 55 push %rbp
661: 48 89 e5 mov %rsp,%rbp
664: b8 00 00 00 00 mov $0x0,%eax
669: 5d pop %rbp
66a: c3 retq
66b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
Notice the first address is 660
.
Here is the same output from GDB
:
0x555555554660 <main> push %rbp
0x555555554661 <main+1> mov %rsp,%rbp
0x555555554664 <main+4> mov $0x0,%eax
0x555555554669 <main+9> pop %rbp
0x55555555466a <main+10> retq
Notice the added 5s
to left of each address.
Here are my questions:
1- What are the 5s
on the left? why doesn't objdump have them?
2- Are these just offsets? or final addresses hard coded in the binary which will be loaded in virtual memory.
3- If these are offsets than what is the difference between a regular executable and PIE
? I thought only PIE code is position independent and has random addresses assigned to it during load time, I didn't compile with -fpie
option. I have also used -fno-pie
and it made no difference.