mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: clean up savedata
Simplify function signature. Remove unused Ctxt field Enforce_data_order. Passes toolstash -cmp. Change-Id: I5caa270ca9ae725708fe415b2c978b5f40780255 Reviewed-on: https://go-review.googlesource.com/20644 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
e8fab405cb
commit
fdc04223c5
3 changed files with 52 additions and 55 deletions
|
|
@ -52,14 +52,12 @@ func Symgrow(ctxt *Link, s *LSym, lsiz int64) {
|
||||||
s.P = s.P[:siz]
|
s.P = s.P[:siz]
|
||||||
}
|
}
|
||||||
|
|
||||||
func savedata(ctxt *Link, s *LSym, p *Prog, file string) {
|
func savedata(ctxt *Link, p *Prog) {
|
||||||
|
s := p.From.Sym
|
||||||
off := int32(p.From.Offset)
|
off := int32(p.From.Offset)
|
||||||
siz := int32(p.From3.Offset)
|
siz := int32(p.From3.Offset)
|
||||||
if off < 0 || siz < 0 || off >= 1<<30 || siz >= 100 {
|
if off < 0 || siz < 0 || off >= 1<<30 || siz >= 100 {
|
||||||
log.Fatalf("%s: mangled input file", file)
|
log.Fatalf("savedata: bad off=%d siz=%d", off, siz)
|
||||||
}
|
|
||||||
if ctxt.Enforce_data_order != 0 && off < int32(len(s.P)) {
|
|
||||||
ctxt.Diag("data out of order (already have %d)\n%v", len(s.P), p)
|
|
||||||
}
|
}
|
||||||
if s.Type == SBSS || s.Type == STLSBSS {
|
if s.Type == SBSS || s.Type == STLSBSS {
|
||||||
ctxt.Diag("cannot supply data for BSS var")
|
ctxt.Diag("cannot supply data for BSS var")
|
||||||
|
|
|
||||||
|
|
@ -602,55 +602,54 @@ const (
|
||||||
// Link holds the context for writing object code from a compiler
|
// Link holds the context for writing object code from a compiler
|
||||||
// to be linker input or for reading that input into the linker.
|
// to be linker input or for reading that input into the linker.
|
||||||
type Link struct {
|
type Link struct {
|
||||||
Goarm int32
|
Goarm int32
|
||||||
Headtype int
|
Headtype int
|
||||||
Arch *LinkArch
|
Arch *LinkArch
|
||||||
Debugasm int32
|
Debugasm int32
|
||||||
Debugvlog int32
|
Debugvlog int32
|
||||||
Debugdivmod int32
|
Debugdivmod int32
|
||||||
Debugpcln int32
|
Debugpcln int32
|
||||||
Flag_shared int32
|
Flag_shared int32
|
||||||
Flag_dynlink bool
|
Flag_dynlink bool
|
||||||
Flag_optimize bool
|
Flag_optimize bool
|
||||||
Bso *Biobuf
|
Bso *Biobuf
|
||||||
Pathname string
|
Pathname string
|
||||||
Windows int32
|
Windows int32
|
||||||
Goroot string
|
Goroot string
|
||||||
Goroot_final string
|
Goroot_final string
|
||||||
Enforce_data_order int32
|
Hash map[SymVer]*LSym
|
||||||
Hash map[SymVer]*LSym
|
LineHist LineHist
|
||||||
LineHist LineHist
|
Imports []string
|
||||||
Imports []string
|
Plist *Plist
|
||||||
Plist *Plist
|
Plast *Plist
|
||||||
Plast *Plist
|
Sym_div *LSym
|
||||||
Sym_div *LSym
|
Sym_divu *LSym
|
||||||
Sym_divu *LSym
|
Sym_mod *LSym
|
||||||
Sym_mod *LSym
|
Sym_modu *LSym
|
||||||
Sym_modu *LSym
|
Plan9privates *LSym
|
||||||
Plan9privates *LSym
|
Curp *Prog
|
||||||
Curp *Prog
|
Printp *Prog
|
||||||
Printp *Prog
|
Blitrl *Prog
|
||||||
Blitrl *Prog
|
Elitrl *Prog
|
||||||
Elitrl *Prog
|
Rexflag int
|
||||||
Rexflag int
|
Vexflag int
|
||||||
Vexflag int
|
Rep int
|
||||||
Rep int
|
Repn int
|
||||||
Repn int
|
Lock int
|
||||||
Lock int
|
Asmode int
|
||||||
Asmode int
|
Andptr []byte
|
||||||
Andptr []byte
|
And [100]uint8
|
||||||
And [100]uint8
|
Instoffset int64
|
||||||
Instoffset int64
|
Autosize int32
|
||||||
Autosize int32
|
Armsize int32
|
||||||
Armsize int32
|
Pc int64
|
||||||
Pc int64
|
DiagFunc func(string, ...interface{})
|
||||||
DiagFunc func(string, ...interface{})
|
Mode int
|
||||||
Mode int
|
Cursym *LSym
|
||||||
Cursym *LSym
|
Version int
|
||||||
Version int
|
Textp *LSym
|
||||||
Textp *LSym
|
Etextp *LSym
|
||||||
Etextp *LSym
|
Errors int
|
||||||
Errors int
|
|
||||||
|
|
||||||
// state for writing objects
|
// state for writing objects
|
||||||
Text *LSym
|
Text *LSym
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ func flushplist(ctxt *Link, freeProgs bool) {
|
||||||
continue
|
continue
|
||||||
|
|
||||||
case ADATA:
|
case ADATA:
|
||||||
savedata(ctxt, p.From.Sym, p, "<input>")
|
savedata(ctxt, p)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
case ATEXT:
|
case ATEXT:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue