Source file
src/cmd/link/main.go
1
2
3
4
5 package main
6
7 import (
8 "cmd/internal/sys"
9 "cmd/link/internal/amd64"
10 "cmd/link/internal/arm"
11 "cmd/link/internal/arm64"
12 "cmd/link/internal/ld"
13 "cmd/link/internal/loong64"
14 "cmd/link/internal/mips"
15 "cmd/link/internal/mips64"
16 "cmd/link/internal/ppc64"
17 "cmd/link/internal/riscv64"
18 "cmd/link/internal/s390x"
19 "cmd/link/internal/wasm"
20 "cmd/link/internal/x86"
21 "fmt"
22 "internal/buildcfg"
23 "os"
24 )
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 func main() {
41 var arch *sys.Arch
42 var theArch ld.Arch
43
44 buildcfg.Check()
45 switch buildcfg.GOARCH {
46 default:
47 fmt.Fprintf(os.Stderr, "link: unknown architecture %q\n", buildcfg.GOARCH)
48 os.Exit(2)
49 case "386":
50 arch, theArch = x86.Init()
51 case "amd64":
52 arch, theArch = amd64.Init()
53 case "arm":
54 arch, theArch = arm.Init()
55 case "arm64":
56 arch, theArch = arm64.Init()
57 case "loong64":
58 arch, theArch = loong64.Init()
59 case "mips", "mipsle":
60 arch, theArch = mips.Init()
61 case "mips64", "mips64le":
62 arch, theArch = mips64.Init()
63 case "ppc64", "ppc64le":
64 arch, theArch = ppc64.Init()
65 case "riscv64":
66 arch, theArch = riscv64.Init()
67 case "s390x":
68 arch, theArch = s390x.Init()
69 case "wasm":
70 arch, theArch = wasm.Init()
71 }
72 ld.Main(arch, theArch)
73 }
74
View as plain text