mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd: add new common architecture representation
Information about CPU architectures (e.g., name, family, byte ordering, pointer and register size) is currently redundantly scattered around the source tree. Instead consolidate the basic information into a single new package cmd/internal/sys. Also, introduce new sys.I386, sys.AMD64, etc. names for the constants '8', '6', etc. and replace most uses of the latter. The notable exceptions are a couple of error messages that still refer to the old char-based toolchain names and function reltype in cmd/link. Passes toolstash/buildall. Change-Id: I8a6f0cbd49577ec1672a98addebc45f767e36461 Reviewed-on: https://go-review.googlesource.com/21623 Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
31cf1c1779
commit
c6e11fe037
67 changed files with 639 additions and 743 deletions
|
|
@ -31,7 +31,7 @@ package mips
|
|||
|
||||
import (
|
||||
"cmd/internal/obj"
|
||||
"encoding/binary"
|
||||
"cmd/internal/sys"
|
||||
"fmt"
|
||||
"math"
|
||||
)
|
||||
|
|
@ -336,7 +336,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
|||
q.As = AMOVV
|
||||
q.From.Type = obj.TYPE_MEM
|
||||
q.From.Reg = REGG
|
||||
q.From.Offset = 4 * int64(ctxt.Arch.Ptrsize) // G.panic
|
||||
q.From.Offset = 4 * int64(ctxt.Arch.PtrSize) // G.panic
|
||||
q.To.Type = obj.TYPE_REG
|
||||
q.To.Reg = REG_R1
|
||||
|
||||
|
|
@ -559,9 +559,9 @@ func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32) *obj.Prog {
|
|||
p.As = AMOVV
|
||||
p.From.Type = obj.TYPE_MEM
|
||||
p.From.Reg = REGG
|
||||
p.From.Offset = 2 * int64(ctxt.Arch.Ptrsize) // G.stackguard0
|
||||
p.From.Offset = 2 * int64(ctxt.Arch.PtrSize) // G.stackguard0
|
||||
if ctxt.Cursym.Cfunc {
|
||||
p.From.Offset = 3 * int64(ctxt.Arch.Ptrsize) // G.stackguard1
|
||||
p.From.Offset = 3 * int64(ctxt.Arch.PtrSize) // G.stackguard1
|
||||
}
|
||||
p.To.Type = obj.TYPE_REG
|
||||
p.To.Reg = REG_R1
|
||||
|
|
@ -1469,27 +1469,17 @@ loop:
|
|||
}
|
||||
|
||||
var Linkmips64 = obj.LinkArch{
|
||||
ByteOrder: binary.BigEndian,
|
||||
Name: "mips64",
|
||||
Thechar: '0',
|
||||
Arch: sys.ArchMIPS64,
|
||||
Preprocess: preprocess,
|
||||
Assemble: span0,
|
||||
Follow: follow,
|
||||
Progedit: progedit,
|
||||
Minlc: 4,
|
||||
Ptrsize: 8,
|
||||
Regsize: 8,
|
||||
}
|
||||
|
||||
var Linkmips64le = obj.LinkArch{
|
||||
ByteOrder: binary.LittleEndian,
|
||||
Name: "mips64le",
|
||||
Thechar: '0',
|
||||
Arch: sys.ArchMIPS64LE,
|
||||
Preprocess: preprocess,
|
||||
Assemble: span0,
|
||||
Follow: follow,
|
||||
Progedit: progedit,
|
||||
Minlc: 4,
|
||||
Ptrsize: 8,
|
||||
Regsize: 8,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue