1
2
3
4
5 package main
6
7 import (
8 "cmd/compile/internal/amd64"
9 "cmd/compile/internal/arm"
10 "cmd/compile/internal/arm64"
11 "cmd/compile/internal/base"
12 "cmd/compile/internal/gc"
13 "cmd/compile/internal/mips"
14 "cmd/compile/internal/mips64"
15 "cmd/compile/internal/ppc64"
16 "cmd/compile/internal/riscv64"
17 "cmd/compile/internal/s390x"
18 "cmd/compile/internal/ssagen"
19 "cmd/compile/internal/wasm"
20 "cmd/compile/internal/x86"
21 "fmt"
22 "internal/buildcfg"
23 "log"
24 "os"
25 )
26
27 var archInits = map[string]func(*ssagen.ArchInfo){
28 "386": x86.Init,
29 "amd64": amd64.Init,
30 "arm": arm.Init,
31 "arm64": arm64.Init,
32 "mips": mips.Init,
33 "mipsle": mips.Init,
34 "mips64": mips64.Init,
35 "mips64le": mips64.Init,
36 "ppc64": ppc64.Init,
37 "ppc64le": ppc64.Init,
38 "riscv64": riscv64.Init,
39 "s390x": s390x.Init,
40 "wasm": wasm.Init,
41 }
42
43 func main() {
44
45 log.SetFlags(0)
46 log.SetPrefix("compile: ")
47
48 buildcfg.Check()
49 archInit, ok := archInits[buildcfg.GOARCH]
50 if !ok {
51 fmt.Fprintf(os.Stderr, "compile: unknown architecture %q\n", buildcfg.GOARCH)
52 os.Exit(2)
53 }
54
55 gc.Main(archInit)
56 base.Exit(0)
57 }
58
View as plain text