| Each architecture needs a crt0.S file. The crt0.S assembly routine |
| typically corresponds to the following pseudo-C code. In addition, |
| each architecture needs any support routines that gcc-generated code |
| expects to find in the system library -- Alpha, for example, needs |
| divide subroutines. |
| |
| The "getenvtest" test program is a very good test for proper crt0.S |
| functionality. |
| |
| |
| extern __noreturn __libc_init(void *, void *); |
| |
| __noreturn _start(void) |
| { |
| void *elf_data = get_elf_data_address(); /* Usually the stack address */ |
| void *atexit_ptr = get_atexit_ptr(); /* Usually in a register */ |
| |
| /* Some architectures need this for debugging to work */ |
| setup_null_stack_frame_if_necessary(); |
| |
| __libc_init(elf_data, atexit_ptr); |
| } |
| |
| |
| |
| |