I "objdump -d" an executable, e.g, /bin/ls, and I found there's not any main function in the assembly code. Why?
There are several possible explanations:
main
doesn't mean the world requires one.main
function may have been inlined or eliminated by the compiler in general. The operating system just calls an entry point; it doesn't care if that's actually the start of a function called main
.objdump
) Objdump
might not expose all possible symbols in a program; given that you're pointing it at linked executable and not object files, there's not really a contract for objdump to tell you every possible function in the executable; just those which might be called externally.Symbolic information are only mnemonics; the processor isn't looking at these things at all.