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