In Linux x86_64 and gcc:
I wrote a very simple demon program using c.
gcc -O0 -o main ./main.c
, main.c contains a function foo.
And I use objdump -d to disassemble the program.
objdump -d ./main
, then see the main function in objdump output. find out callq foo instruction as shown below.
My question is how the objdump knows 'e8 02 00 00 00' is callq 0x1140 <foo>
. I understand that is call 0x00 00 00 02
, the first byte e8 is the call instruction and the subsequent four bytes 02 00 00 00 are the target function address used by call (since the byte endian, so 02 00 00 00 represent 0x00 00 00 02).
And are there any other resources that can help me to learn the assembly instructions in the objdump?