Even for the simplest program like yours, gcc
is linking some libraries and some object files (notably crt0.o
which calls your main
and contains _start
, the ELF starting point). And your binary is probably dynamically linked to some libc.so.6
so needs the dynamic linker (use ldd foobar
to find out). Use gcc -v
to understand what gcc
is doing. And objdump has a lot of interesting flags or options.
You may also want to read the Assembly Howto, the X86 calling conventions, this question, the X86-64 ABI, these notes on X86-64 programming, etc