aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.7/libgo/runtime/go-main.c
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2012-10-01 10:30:31 -0700
committerBen Cheng <bccheng@google.com>2012-10-01 10:30:31 -0700
commit82bcbebce43f0227f506d75a5b764b6847041bae (patch)
treefe9f8597b48a430c4daeb5123e3e8eb28e6f9da9 /gcc-4.7/libgo/runtime/go-main.c
parent3c052de3bb16ac53b6b6ed659ec7557eb84c7590 (diff)
downloadtoolchain_gcc-82bcbebce43f0227f506d75a5b764b6847041bae.tar.gz
toolchain_gcc-82bcbebce43f0227f506d75a5b764b6847041bae.tar.bz2
toolchain_gcc-82bcbebce43f0227f506d75a5b764b6847041bae.zip
Initial check-in of gcc 4.7.2.
Change-Id: I4a2f5a921c21741a0e18bda986d77e5f1bef0365
Diffstat (limited to 'gcc-4.7/libgo/runtime/go-main.c')
-rw-r--r--gcc-4.7/libgo/runtime/go-main.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/gcc-4.7/libgo/runtime/go-main.c b/gcc-4.7/libgo/runtime/go-main.c
new file mode 100644
index 000000000..7e8bb9b23
--- /dev/null
+++ b/gcc-4.7/libgo/runtime/go-main.c
@@ -0,0 +1,56 @@
+/* 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
+
+#include "go-alloc.h"
+#include "array.h"
+#include "go-string.h"
+
+#include "runtime.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;
+
+extern void runtime_main (void);
+static void mainstart (void *);
+
+/* The main function. */
+
+int
+main (int argc, char **argv)
+{
+ runtime_check ();
+ runtime_args (argc, (byte **) argv);
+ runtime_osinit ();
+ runtime_schedinit ();
+ __go_go (mainstart, NULL);
+ runtime_mstart (runtime_m ());
+ abort ();
+}
+
+static void
+mainstart (void *arg __attribute__ ((unused)))
+{
+ runtime_main ();
+}