Rev 5963 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4349 | Serge | 1 | /* |
2 | * crt1.c |
||
3 | * This file has no copyright assigned and is placed in the Public Domain. |
||
4 | * This file is a part of the mingw-runtime package. |
||
5 | * No warranty is given; refer to the file DISCLAIMER within the package. |
||
6 | * |
||
7 | * Source code for the startup proceedures used by all programs. This code |
||
8 | * is compiled to make crt1.o, which should be located in the library path. |
||
9 | * |
||
10 | */ |
||
11 | |||
12 | /* Hide the declaration of _fmode with dllimport attribute in stdlib.h to |
||
13 | avoid problems with older GCC. */ |
||
14 | |||
15 | #include |
||
16 | #include |
||
17 | #include |
||
18 | #include |
||
19 | #include |
||
20 | |||
21 | void *load_libc(); |
||
22 | void* get_entry_point(void *raw); |
||
23 | |||
5964 | serge | 24 | void _pei386_runtime_relocator (void){}; |
4349 | Serge | 25 | |
26 | void __attribute__((noreturn)) |
||
27 | __crt_startup (void) |
||
28 | { |
||
29 | struct app_hdr *header; |
||
30 | void *img; |
||
31 | void __attribute__((noreturn)) (*entry)(void *img); |
||
32 | |||
33 | img = load_libc(); |
||
34 | |||
35 | if(img == NULL) |
||
36 | { |
||
37 | asm ("int $0x40" ::"a"(-1)); |
||
38 | }; |
||
39 | |||
40 | entry = get_entry_point(img); |
||
41 | entry(img); |
||
42 | } |
||
43 |