summaryrefslogtreecommitdiffstats
path: root/src/cmd/compile/main.go
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:23:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:23:18 +0000
commit43a123c1ae6613b3efeed291fa552ecd909d3acf (patch)
treefd92518b7024bc74031f78a1cf9e454b65e73665 /src/cmd/compile/main.go
parentInitial commit. (diff)
downloadgolang-1.20-43a123c1ae6613b3efeed291fa552ecd909d3acf.tar.xz
golang-1.20-43a123c1ae6613b3efeed291fa552ecd909d3acf.zip
Adding upstream version 1.20.14.upstream/1.20.14upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/cmd/compile/main.go')
-rw-r--r--src/cmd/compile/main.go59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/cmd/compile/main.go b/src/cmd/compile/main.go
new file mode 100644
index 0000000..7d38bea
--- /dev/null
+++ b/src/cmd/compile/main.go
@@ -0,0 +1,59 @@
+// Copyright 2015 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.
+
+package main
+
+import (
+ "cmd/compile/internal/amd64"
+ "cmd/compile/internal/arm"
+ "cmd/compile/internal/arm64"
+ "cmd/compile/internal/base"
+ "cmd/compile/internal/gc"
+ "cmd/compile/internal/loong64"
+ "cmd/compile/internal/mips"
+ "cmd/compile/internal/mips64"
+ "cmd/compile/internal/ppc64"
+ "cmd/compile/internal/riscv64"
+ "cmd/compile/internal/s390x"
+ "cmd/compile/internal/ssagen"
+ "cmd/compile/internal/wasm"
+ "cmd/compile/internal/x86"
+ "fmt"
+ "internal/buildcfg"
+ "log"
+ "os"
+)
+
+var archInits = map[string]func(*ssagen.ArchInfo){
+ "386": x86.Init,
+ "amd64": amd64.Init,
+ "arm": arm.Init,
+ "arm64": arm64.Init,
+ "loong64": loong64.Init,
+ "mips": mips.Init,
+ "mipsle": mips.Init,
+ "mips64": mips64.Init,
+ "mips64le": mips64.Init,
+ "ppc64": ppc64.Init,
+ "ppc64le": ppc64.Init,
+ "riscv64": riscv64.Init,
+ "s390x": s390x.Init,
+ "wasm": wasm.Init,
+}
+
+func main() {
+ // disable timestamps for reproducible output
+ log.SetFlags(0)
+ log.SetPrefix("compile: ")
+
+ buildcfg.Check()
+ archInit, ok := archInits[buildcfg.GOARCH]
+ if !ok {
+ fmt.Fprintf(os.Stderr, "compile: unknown architecture %q\n", buildcfg.GOARCH)
+ os.Exit(2)
+ }
+
+ gc.Main(archInit)
+ base.Exit(0)
+}