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. */
13 #ifdef HAVE_FPU_CONTROL_H
14 #include <fpu_control.h>
25 /* The main function for a Go program. This records the command line
26 parameters, calls the real main function, and returns a zero status
27 if the real main function returns. */
29 extern char **environ
;
31 /* A copy of _end that a shared library can reasonably refer to. */
36 /* The main function. */
39 main (int argc
, char **argv
)
41 runtime_isarchive
= false;
43 if (runtime_isstarted
)
45 runtime_isstarted
= true;
50 __go_end
= (uintptr
)_end
;
53 runtime_args (argc
, (byte
**) argv
);
54 setncpu (getproccount ());
55 setpagesize (getpagesize ());
56 runtime_sched
= runtime_getsched();
58 __go_go (runtime_main
, NULL
);
59 runtime_mstart (runtime_m ());