How does the linker find the main function?
问题 How does the linker find the main function in an x86-64 ELF-format executable? 回答1: A very generic overview, the linker assigns the address to the block of code identified by the symbol main . As it does for all the symbols in your object files. Actually, it doesn't assign a real address but assigns an address relative to some base which will get translated to a real address by the loader when the program is executed. The actual entry point is not likely main but some symbol in the crt that