Subversion Repositories Kolibri OS

Rev

Rev 5963 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  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 <newlib.h>
  16. #include <stdint.h>
  17. #include <stdlib.h>
  18. #include <string.h>
  19. #include <stdio.h>
  20.  
  21. void *load_libc();
  22. void* get_entry_point(void *raw);
  23.  
  24. void _pei386_runtime_relocator (void){};
  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.  
  44.  
  45.  
  46.