|
|
The UNIX system a.out optional header contains a field for the (primary) entry point of the file. This field is set using one of the following rules: the rule used is the first one (from the order given) that applies:
_start = expression;If ld is called through cc, a startup routine is automatically linked in. When the program is executed, this startup routine causes exit() to be called after main() finishes to close file descriptors and do other cleanup. When calling ld directly or when changing the entry point, the user must supply the start-up routine or make sure that the program always calls exit rather than falling through the end. Otherwise, the program will dump core.