You are looking at position-independent executable (PIE).
This executable is linked to load at address 0
, and is relocated to 0x54...
address on execution.
If you disas main
before first running the binary, GDB will show the original linked-at addresses. If you do the same command after first run, GDB will show relocated (actual) addresses.
You can also link non-PIE binary with gcc t.c -no-pie
. That binary will exhibit the behavior you expect: the output of disas main
will not change between before and after first run, and the disassembly will match the actual value of rip
at runtime.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…