


In optimized code there's not always a single source line that accounts for an instruction but the debug info will pick one source line for each asm instruction. Remember that the rel32 displacement in the call encoding is just a placeholder until the linker fills in a real offset (to a PLT stub in this case, unless you statically link libc).įootnote 1: Interleaving source can be messy and not very helpful in optimized builds for that, consider or other ways of visualizing which instructions go with which source lines. And looks like a broken call that jumps into the middle of the call instruction in main. Note that this isn't using -r so the call rel32=-4 isn't annotated with the puts symbol name. If not on x86, or if you like AT&T syntax, omit -Mintel.ĩ: c7 04 24 00 00 00 00 mov DWORD PTR ,0x0 You could put something like alias disas="objdump -drwCS -Mintel" in your ~/.bashrc. -S: interleave source lines with disassembly.intel_syntax noprefix syntax instead of AT&T -w is "wide" mode: it doesn't line-wrap the machine-code bytes.-R shows dynamic-linking relocations / symbol names (useful on shared libraries).-r shows symbol names on relocations (so you'd see puts in the call instruction below).l, -line-numbers Include line numbers and filenames in output S, -source Intermix source code with disassembly You can use objdump -S to produce a more readable disassembly interleaved with C source. If you compile with debug symbols (add -g to your GCC command line, even if you're also using -O3 1),
