Skip to content

Commit fdc0422

Browse files
committed
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 <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent e8fab40 commit fdc0422

File tree

3 files changed

+52
-55
lines changed

3 files changed

+52
-55
lines changed

src/cmd/internal/obj/data.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,12 @@ func Symgrow(ctxt *Link, s *LSym, lsiz int64) {
5252
s.P = s.P[:siz]
5353
}
5454

55-
func savedata(ctxt *Link, s *LSym, p *Prog, file string) {
55+
func savedata(ctxt *Link, p *Prog) {
56+
s := p.From.Sym
5657
off := int32(p.From.Offset)
5758
siz := int32(p.From3.Offset)
5859
if off < 0 || siz < 0 || off >= 1<<30 || siz >= 100 {
59-
log.Fatalf("%s: mangled input file", file)
60-
}
61-
if ctxt.Enforce_data_order != 0 && off < int32(len(s.P)) {
62-
ctxt.Diag("data out of order (already have %d)\n%v", len(s.P), p)
60+
log.Fatalf("savedata: bad off=%d siz=%d", off, siz)
6361
}
6462
if s.Type == SBSS || s.Type == STLSBSS {
6563
ctxt.Diag("cannot supply data for BSS var")

src/cmd/internal/obj/link.go

Lines changed: 48 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -602,55 +602,54 @@ const (
602602
// Link holds the context for writing object code from a compiler
603603
// to be linker input or for reading that input into the linker.
604604
type Link struct {
605-
Goarm int32
606-
Headtype int
607-
Arch *LinkArch
608-
Debugasm int32
609-
Debugvlog int32
610-
Debugdivmod int32
611-
Debugpcln int32
612-
Flag_shared int32
613-
Flag_dynlink bool
614-
Flag_optimize bool
615-
Bso *Biobuf
616-
Pathname string
617-
Windows int32
618-
Goroot string
619-
Goroot_final string
620-
Enforce_data_order int32
621-
Hash map[SymVer]*LSym
622-
LineHist LineHist
623-
Imports []string
624-
Plist *Plist
625-
Plast *Plist
626-
Sym_div *LSym
627-
Sym_divu *LSym
628-
Sym_mod *LSym
629-
Sym_modu *LSym
630-
Plan9privates *LSym
631-
Curp *Prog
632-
Printp *Prog
633-
Blitrl *Prog
634-
Elitrl *Prog
635-
Rexflag int
636-
Vexflag int
637-
Rep int
638-
Repn int
639-
Lock int
640-
Asmode int
641-
Andptr []byte
642-
And [100]uint8
643-
Instoffset int64
644-
Autosize int32
645-
Armsize int32
646-
Pc int64
647-
DiagFunc func(string, ...interface{})
648-
Mode int
649-
Cursym *LSym
650-
Version int
651-
Textp *LSym
652-
Etextp *LSym
653-
Errors int
605+
Goarm int32
606+
Headtype int
607+
Arch *LinkArch
608+
Debugasm int32
609+
Debugvlog int32
610+
Debugdivmod int32
611+
Debugpcln int32
612+
Flag_shared int32
613+
Flag_dynlink bool
614+
Flag_optimize bool
615+
Bso *Biobuf
616+
Pathname string
617+
Windows int32
618+
Goroot string
619+
Goroot_final string
620+
Hash map[SymVer]*LSym
621+
LineHist LineHist
622+
Imports []string
623+
Plist *Plist
624+
Plast *Plist
625+
Sym_div *LSym
626+
Sym_divu *LSym
627+
Sym_mod *LSym
628+
Sym_modu *LSym
629+
Plan9privates *LSym
630+
Curp *Prog
631+
Printp *Prog
632+
Blitrl *Prog
633+
Elitrl *Prog
634+
Rexflag int
635+
Vexflag int
636+
Rep int
637+
Repn int
638+
Lock int
639+
Asmode int
640+
Andptr []byte
641+
And [100]uint8
642+
Instoffset int64
643+
Autosize int32
644+
Armsize int32
645+
Pc int64
646+
DiagFunc func(string, ...interface{})
647+
Mode int
648+
Cursym *LSym
649+
Version int
650+
Textp *LSym
651+
Etextp *LSym
652+
Errors int
654653

655654
// state for writing objects
656655
Text *LSym

src/cmd/internal/obj/objfile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func flushplist(ctxt *Link, freeProgs bool) {
201201
continue
202202

203203
case ADATA:
204-
savedata(ctxt, p.From.Sym, p, "<input>")
204+
savedata(ctxt, p)
205205
continue
206206

207207
case ATEXT:

0 commit comments

Comments
 (0)