mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Now only cmd/asm and cmd/compile depend on cmd/internal/obj. Changing the assembler backends no longer requires reinstalling cmd/link or cmd/addr2line. There's also now one canonical definition of the object file format in cmd/internal/objabi/doc.go, with a warning to update all three implementations. objabi is still something of a grab bag of unrelated code (e.g., flag and environment variable handling probably belong in a separate "tool" package), but this is still progress. Fixes #15165. Fixes #20026. Change-Id: Ic4b92fac7d0d35438e0d20c9579aad4085c5534c Reviewed-on: https://go-review.googlesource.com/40972 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
// 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/gc"
|
|
"cmd/compile/internal/mips"
|
|
"cmd/compile/internal/mips64"
|
|
"cmd/compile/internal/ppc64"
|
|
"cmd/compile/internal/s390x"
|
|
"cmd/compile/internal/x86"
|
|
"cmd/internal/objabi"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
var archInits = map[string]func(*gc.Arch){
|
|
"386": x86.Init,
|
|
"amd64": amd64.Init,
|
|
"amd64p32": amd64.Init,
|
|
"arm": arm.Init,
|
|
"arm64": arm64.Init,
|
|
"mips": mips.Init,
|
|
"mipsle": mips.Init,
|
|
"mips64": mips64.Init,
|
|
"mips64le": mips64.Init,
|
|
"ppc64": ppc64.Init,
|
|
"ppc64le": ppc64.Init,
|
|
"s390x": s390x.Init,
|
|
}
|
|
|
|
func main() {
|
|
// disable timestamps for reproducible output
|
|
log.SetFlags(0)
|
|
log.SetPrefix("compile: ")
|
|
|
|
archInit, ok := archInits[objabi.GOARCH]
|
|
if !ok {
|
|
fmt.Fprintf(os.Stderr, "compile: unknown architecture %q\n", objabi.GOARCH)
|
|
os.Exit(2)
|
|
}
|
|
|
|
gc.Main(archInit)
|
|
gc.Exit(0)
|
|
}
|