Retro68/gcc/libgo/runtime/go-main.c

58 lines
1.2 KiB
C
Raw Normal View History

2012-03-27 23:13:14 +00:00
/* 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>
#include <unistd.h>
#ifdef HAVE_FPU_CONTROL_H
#include <fpu_control.h>
#endif
2014-09-21 17:33:12 +00:00
#include "runtime.h"
2012-03-27 23:13:14 +00:00
#include "go-alloc.h"
#include "array.h"
#include "arch.h"
#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;
2017-04-10 11:32:00 +00:00
/* A copy of _end that a shared library can reasonably refer to. */
uintptr __go_end;
extern byte _end[];
2012-03-27 23:13:14 +00:00
/* The main function. */
int
main (int argc, char **argv)
{
2015-08-28 15:33:40 +00:00
runtime_isarchive = false;
if (runtime_isstarted)
2017-04-10 11:32:00 +00:00
return 0;
2015-08-28 15:33:40 +00:00
runtime_isstarted = true;
2017-04-10 11:32:00 +00:00
__go_end = (uintptr)_end;
2012-03-27 23:13:14 +00:00
runtime_check ();
runtime_args (argc, (byte **) argv);
runtime_osinit ();
runtime_schedinit ();
2014-09-21 17:33:12 +00:00
__go_go (runtime_main, NULL);
2012-03-27 23:13:14 +00:00
runtime_mstart (runtime_m ());
abort ();
}