[Patch Doc] Update documentation for __fp16 type
[official-gcc.git] / libgo / runtime / go-main.c
blob622a77d96af8e80f2531ee41e6ac1c09e5929060
1 /* go-main.c -- the main function for a Go program.
3 Copyright 2009 The Go Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file. */
7 #include "config.h"
9 #include <stdlib.h>
10 #include <time.h>
11 #include <unistd.h>
13 #ifdef HAVE_FPU_CONTROL_H
14 #include <fpu_control.h>
15 #endif
17 #include "runtime.h"
18 #include "go-alloc.h"
19 #include "array.h"
20 #include "arch.h"
21 #include "malloc.h"
23 #undef int
24 #undef char
25 #undef unsigned
27 /* The main function for a Go program. This records the command line
28 parameters, calls the real main function, and returns a zero status
29 if the real main function returns. */
31 extern char **environ;
33 /* A copy of _end that a shared library can reasonably refer to. */
34 uintptr __go_end;
36 extern byte _end[];
38 /* The main function. */
40 int
41 main (int argc, char **argv)
43 runtime_isarchive = false;
45 if (runtime_isstarted)
46 return 0;
47 runtime_isstarted = true;
49 __go_end = (uintptr)_end;
50 runtime_cpuinit ();
51 runtime_check ();
52 runtime_args (argc, (byte **) argv);
53 runtime_osinit ();
54 runtime_schedinit ();
55 __go_go (runtime_main, NULL);
56 runtime_mstart (runtime_m ());
57 abort ();