Rev 4874 | Go to most recent revision | 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 | |||
24 | |||
25 | void __attribute__((noreturn)) |
||
26 | __crt_startup (void) |
||
27 | { |
||
28 | struct app_hdr *header; |
||
29 | void *img; |
||
30 | void __attribute__((noreturn)) (*entry)(void *img); |
||
31 | |||
32 | img = load_libc(); |
||
33 | |||
34 | if(img == NULL) |
||
35 | { |
||
36 | asm ("int $0x40" ::"a"(-1)); |
||
37 | }; |
||
38 | |||
39 | entry = get_entry_point(img); |
||
40 | entry(img); |
||
41 | } |
||
42 |