Here’s a snippet from disassembled output of a simple program with gcc
on Linux:
400478: ff 15 6a 0b 20 00 callq *0x200b6a(%rip) # 600fe8 <__libc_start_main@GLIBC_2.2.5>
40047e: f4 hlt
- Why is
hlt
needed here?- From my understanding, it is if the program fails to exit and it would then trap. However, in what situations would the program fail to exit like this?
- Where is the definition for
__libc_start_main
?- My understanding is it may be dynamically linked.
I’m compiling code to assembly myself and am in particular curious on how to handle program start-up.