go-main.c 950 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
/* go-main.c -- the main function for a Go program.

   Copyright 2009 The Go Authors. All rights reserved.
   Use of this source code is governed by a BSD-style
   license that can be found in the LICENSE file.  */

#include "config.h"

#include <stdlib.h>
#include <time.h>
11
#include <unistd.h>
12 13 14 15 16

#ifdef HAVE_FPU_CONTROL_H
#include <fpu_control.h>
#endif

17
#include "runtime.h"
18 19
#include "go-alloc.h"
#include "array.h"
20
#include "arch.h"
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#include "malloc.h"

#undef int
#undef char
#undef unsigned

/* The main function for a Go program.  This records the command line
   parameters, calls the real main function, and returns a zero status
   if the real main function returns.  */

extern char **environ;

/* The main function.  */

int
main (int argc, char **argv)
{
38
  runtime_check ();
39
  runtime_args (argc, (byte **) argv);
40 41
  runtime_osinit ();
  runtime_schedinit ();
42
  __go_go (runtime_main, NULL);
43 44 45
  runtime_mstart (runtime_m ());
  abort ();
}