Commit 3167ff7c authored by Dave Cheney's avatar Dave Cheney

cmd/internal/*: only call ctx.Bso.Flush when something has been written

In many places where ctx.Bso.Flush is used as the target for some debug
logging, ctx.Bso.Flush is called unconditionally. In the majority of
cases where debug logging is not enabled, this means Flush is called
many times when there is nothing to be flushed (it will be called anyway
when ctx.Bso is eventually closed), sometimes in a loop.

Avoid this by moving the ctx.Bso.Flush call into the same condition
block as the debug print. This pattern was previously applied
sporadically.

Change-Id: I0444cb235cc8b9bac51a59b2e44e59872db2be06
Reviewed-on: https://go-review.googlesource.com/27579
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
parent 1472221a
...@@ -714,8 +714,8 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) { ...@@ -714,8 +714,8 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
if ctxt.Autosize == 0 && !(cursym.Text.Mark&LEAF != 0) { if ctxt.Autosize == 0 && !(cursym.Text.Mark&LEAF != 0) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "save suppressed in: %s\n", cursym.Text.From.Sym.Name) fmt.Fprintf(ctxt.Bso, "save suppressed in: %s\n", cursym.Text.From.Sym.Name)
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
cursym.Text.Mark |= LEAF cursym.Text.Mark |= LEAF
} }
......
...@@ -145,8 +145,8 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) { ...@@ -145,8 +145,8 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
*/ */
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f noops\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f noops\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
var q *obj.Prog var q *obj.Prog
var q1 *obj.Prog var q1 *obj.Prog
......
...@@ -276,8 +276,8 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) { ...@@ -276,8 +276,8 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
*/ */
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f noops\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f noops\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
var q *obj.Prog var q *obj.Prog
var q1 *obj.Prog var q1 *obj.Prog
......
...@@ -243,8 +243,8 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) { ...@@ -243,8 +243,8 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
*/ */
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f noops\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f noops\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
var q *obj.Prog var q *obj.Prog
var q1 *obj.Prog var q1 *obj.Prog
......
...@@ -601,13 +601,13 @@ func addgotsym(ctxt *ld.Link, s *ld.Symbol) { ...@@ -601,13 +601,13 @@ func addgotsym(ctxt *ld.Link, s *ld.Symbol) {
func asmb(ctxt *ld.Link) { func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f codeblk\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f codeblk\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
if ld.Iself { if ld.Iself {
ld.Asmbelfsetup(ctxt) ld.Asmbelfsetup(ctxt)
...@@ -625,8 +625,8 @@ func asmb(ctxt *ld.Link) { ...@@ -625,8 +625,8 @@ func asmb(ctxt *ld.Link) {
if ld.Segrodata.Filelen > 0 { if ld.Segrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(int64(ld.Segrodata.Fileoff)) ld.Cseek(int64(ld.Segrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
...@@ -634,8 +634,8 @@ func asmb(ctxt *ld.Link) { ...@@ -634,8 +634,8 @@ func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(int64(ld.Segdata.Fileoff)) ld.Cseek(int64(ld.Segdata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen)) ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
...@@ -679,8 +679,8 @@ func asmb(ctxt *ld.Link) { ...@@ -679,8 +679,8 @@ func asmb(ctxt *ld.Link) {
if !*ld.FlagS { if !*ld.FlagS {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
switch ld.HEADTYPE { switch ld.HEADTYPE {
default: default:
case obj.Hplan9: case obj.Hplan9:
...@@ -751,8 +751,8 @@ func asmb(ctxt *ld.Link) { ...@@ -751,8 +751,8 @@ func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f headr\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f headr\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(0) ld.Cseek(0)
switch ld.HEADTYPE { switch ld.HEADTYPE {
default: default:
......
...@@ -584,8 +584,8 @@ func addgotsym(ctxt *ld.Link, s *ld.Symbol) { ...@@ -584,8 +584,8 @@ func addgotsym(ctxt *ld.Link, s *ld.Symbol) {
func asmb(ctxt *ld.Link) { func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
if ld.Iself { if ld.Iself {
ld.Asmbelfsetup(ctxt) ld.Asmbelfsetup(ctxt)
...@@ -602,8 +602,8 @@ func asmb(ctxt *ld.Link) { ...@@ -602,8 +602,8 @@ func asmb(ctxt *ld.Link) {
if ld.Segrodata.Filelen > 0 { if ld.Segrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(int64(ld.Segrodata.Fileoff)) ld.Cseek(int64(ld.Segrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
...@@ -611,8 +611,8 @@ func asmb(ctxt *ld.Link) { ...@@ -611,8 +611,8 @@ func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(int64(ld.Segdata.Fileoff)) ld.Cseek(int64(ld.Segdata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen)) ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
...@@ -634,8 +634,8 @@ func asmb(ctxt *ld.Link) { ...@@ -634,8 +634,8 @@ func asmb(ctxt *ld.Link) {
// TODO: rationalize // TODO: rationalize
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
switch ld.HEADTYPE { switch ld.HEADTYPE {
default: default:
if ld.Iself { if ld.Iself {
...@@ -690,8 +690,8 @@ func asmb(ctxt *ld.Link) { ...@@ -690,8 +690,8 @@ func asmb(ctxt *ld.Link) {
ctxt.Cursym = nil ctxt.Cursym = nil
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f header\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f header\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(0) ld.Cseek(0)
switch ld.HEADTYPE { switch ld.HEADTYPE {
default: default:
......
...@@ -393,8 +393,8 @@ func archrelocvariant(ctxt *ld.Link, r *ld.Reloc, s *ld.Symbol, t int64) int64 { ...@@ -393,8 +393,8 @@ func archrelocvariant(ctxt *ld.Link, r *ld.Reloc, s *ld.Symbol, t int64) int64 {
func asmb(ctxt *ld.Link) { func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
if ld.Iself { if ld.Iself {
ld.Asmbelfsetup(ctxt) ld.Asmbelfsetup(ctxt)
...@@ -411,8 +411,8 @@ func asmb(ctxt *ld.Link) { ...@@ -411,8 +411,8 @@ func asmb(ctxt *ld.Link) {
if ld.Segrodata.Filelen > 0 { if ld.Segrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(int64(ld.Segrodata.Fileoff)) ld.Cseek(int64(ld.Segrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
...@@ -420,8 +420,8 @@ func asmb(ctxt *ld.Link) { ...@@ -420,8 +420,8 @@ func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(int64(ld.Segdata.Fileoff)) ld.Cseek(int64(ld.Segdata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen)) ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
...@@ -443,8 +443,8 @@ func asmb(ctxt *ld.Link) { ...@@ -443,8 +443,8 @@ func asmb(ctxt *ld.Link) {
// TODO: rationalize // TODO: rationalize
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
switch ld.HEADTYPE { switch ld.HEADTYPE {
default: default:
if ld.Iself { if ld.Iself {
...@@ -499,8 +499,8 @@ func asmb(ctxt *ld.Link) { ...@@ -499,8 +499,8 @@ func asmb(ctxt *ld.Link) {
ctxt.Cursym = nil ctxt.Cursym = nil
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f header\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f header\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(0) ld.Cseek(0)
switch ld.HEADTYPE { switch ld.HEADTYPE {
default: default:
......
...@@ -649,8 +649,8 @@ func relocsym(ctxt *Link, s *Symbol) { ...@@ -649,8 +649,8 @@ func relocsym(ctxt *Link, s *Symbol) {
func (ctxt *Link) reloc() { func (ctxt *Link) reloc() {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f reloc\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f reloc\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
for _, s := range ctxt.Textp { for _, s := range ctxt.Textp {
relocsym(ctxt, s) relocsym(ctxt, s)
...@@ -725,8 +725,8 @@ func dynreloc(ctxt *Link, data *[obj.SXREF][]*Symbol) { ...@@ -725,8 +725,8 @@ func dynreloc(ctxt *Link, data *[obj.SXREF][]*Symbol) {
} }
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f reloc\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f reloc\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
for _, s := range ctxt.Textp { for _, s := range ctxt.Textp {
dynrelocsym(ctxt, s) dynrelocsym(ctxt, s)
...@@ -805,9 +805,8 @@ func CodeblkPad(ctxt *Link, addr int64, size int64, pad []byte) { ...@@ -805,9 +805,8 @@ func CodeblkPad(ctxt *Link, addr int64, size int64, pad []byte) {
for ; addr < eaddr; addr++ { for ; addr < eaddr; addr++ {
fmt.Fprintf(ctxt.Bso, " %.2x", 0) fmt.Fprintf(ctxt.Bso, " %.2x", 0)
} }
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
} }
func blk(ctxt *Link, syms []*Symbol, addr, size int64, pad []byte) { func blk(ctxt *Link, syms []*Symbol, addr, size int64, pad []byte) {
...@@ -1191,8 +1190,8 @@ var datap []*Symbol ...@@ -1191,8 +1190,8 @@ var datap []*Symbol
func (ctxt *Link) dodata() { func (ctxt *Link) dodata() {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f dodata\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f dodata\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
// Collect data symbols by type into data. // Collect data symbols by type into data.
var data [obj.SXREF][]*Symbol var data [obj.SXREF][]*Symbol
......
...@@ -655,8 +655,8 @@ func objfile(ctxt *Link, lib *Library) { ...@@ -655,8 +655,8 @@ func objfile(ctxt *Link, lib *Library) {
if ctxt.Debugvlog > 1 { if ctxt.Debugvlog > 1 {
fmt.Fprintf(ctxt.Bso, "%5.2f ldobj: %s (%s)\n", obj.Cputime(), lib.File, pkg) fmt.Fprintf(ctxt.Bso, "%5.2f ldobj: %s (%s)\n", obj.Cputime(), lib.File, pkg)
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
f, err := bio.Open(lib.File) f, err := bio.Open(lib.File)
if err != nil { if err != nil {
Exitf("cannot open file %s: %v", lib.File, err) Exitf("cannot open file %s: %v", lib.File, err)
...@@ -1945,8 +1945,8 @@ func genasmsym(ctxt *Link, put func(*Link, *Symbol, string, int, int64, int64, i ...@@ -1945,8 +1945,8 @@ func genasmsym(ctxt *Link, put func(*Link, *Symbol, string, int, int64, int64, i
// Something underhanded is going on. Say nothing. // Something underhanded is going on. Say nothing.
if ctxt.Debugvlog != 0 || *flagN { if ctxt.Debugvlog != 0 || *flagN {
fmt.Fprintf(ctxt.Bso, "%5.2f symsize = %d\n", obj.Cputime(), uint32(Symsize)) fmt.Fprintf(ctxt.Bso, "%5.2f symsize = %d\n", obj.Cputime(), uint32(Symsize))
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
} }
func Symaddr(ctxt *Link, s *Symbol) int64 { func Symaddr(ctxt *Link, s *Symbol) int64 {
......
...@@ -176,8 +176,8 @@ func Main() { ...@@ -176,8 +176,8 @@ func Main() {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "HEADER = -H%d -T0x%x -D0x%x -R0x%x\n", HEADTYPE, uint64(*FlagTextAddr), uint64(*FlagDataAddr), uint32(*FlagRound)) fmt.Fprintf(ctxt.Bso, "HEADER = -H%d -T0x%x -D0x%x -R0x%x\n", HEADTYPE, uint64(*FlagTextAddr), uint64(*FlagDataAddr), uint32(*FlagRound))
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
if Buildmode == BuildmodeShared { if Buildmode == BuildmodeShared {
for i := 0; i < flag.NArg(); i++ { for i := 0; i < flag.NArg(); i++ {
......
...@@ -185,8 +185,8 @@ func archrelocvariant(ctxt *ld.Link, r *ld.Reloc, s *ld.Symbol, t int64) int64 { ...@@ -185,8 +185,8 @@ func archrelocvariant(ctxt *ld.Link, r *ld.Reloc, s *ld.Symbol, t int64) int64 {
func asmb(ctxt *ld.Link) { func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
if ld.Iself { if ld.Iself {
ld.Asmbelfsetup(ctxt) ld.Asmbelfsetup(ctxt)
...@@ -203,8 +203,8 @@ func asmb(ctxt *ld.Link) { ...@@ -203,8 +203,8 @@ func asmb(ctxt *ld.Link) {
if ld.Segrodata.Filelen > 0 { if ld.Segrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(int64(ld.Segrodata.Fileoff)) ld.Cseek(int64(ld.Segrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
...@@ -212,8 +212,8 @@ func asmb(ctxt *ld.Link) { ...@@ -212,8 +212,8 @@ func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(int64(ld.Segdata.Fileoff)) ld.Cseek(int64(ld.Segdata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen)) ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
...@@ -230,8 +230,8 @@ func asmb(ctxt *ld.Link) { ...@@ -230,8 +230,8 @@ func asmb(ctxt *ld.Link) {
// TODO: rationalize // TODO: rationalize
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
switch ld.HEADTYPE { switch ld.HEADTYPE {
default: default:
if ld.Iself { if ld.Iself {
...@@ -278,8 +278,8 @@ func asmb(ctxt *ld.Link) { ...@@ -278,8 +278,8 @@ func asmb(ctxt *ld.Link) {
ctxt.Cursym = nil ctxt.Cursym = nil
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f header\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f header\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(0) ld.Cseek(0)
switch ld.HEADTYPE { switch ld.HEADTYPE {
default: default:
......
...@@ -806,8 +806,8 @@ func ensureglinkresolver(ctxt *ld.Link) *ld.Symbol { ...@@ -806,8 +806,8 @@ func ensureglinkresolver(ctxt *ld.Link) *ld.Symbol {
func asmb(ctxt *ld.Link) { func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
if ld.Iself { if ld.Iself {
ld.Asmbelfsetup(ctxt) ld.Asmbelfsetup(ctxt)
...@@ -824,8 +824,8 @@ func asmb(ctxt *ld.Link) { ...@@ -824,8 +824,8 @@ func asmb(ctxt *ld.Link) {
if ld.Segrodata.Filelen > 0 { if ld.Segrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(int64(ld.Segrodata.Fileoff)) ld.Cseek(int64(ld.Segrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
...@@ -833,8 +833,8 @@ func asmb(ctxt *ld.Link) { ...@@ -833,8 +833,8 @@ func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(int64(ld.Segdata.Fileoff)) ld.Cseek(int64(ld.Segdata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen)) ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
...@@ -851,8 +851,8 @@ func asmb(ctxt *ld.Link) { ...@@ -851,8 +851,8 @@ func asmb(ctxt *ld.Link) {
// TODO: rationalize // TODO: rationalize
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
switch ld.HEADTYPE { switch ld.HEADTYPE {
default: default:
if ld.Iself { if ld.Iself {
...@@ -899,8 +899,8 @@ func asmb(ctxt *ld.Link) { ...@@ -899,8 +899,8 @@ func asmb(ctxt *ld.Link) {
ctxt.Cursym = nil ctxt.Cursym = nil
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f header\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f header\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(0) ld.Cseek(0)
switch ld.HEADTYPE { switch ld.HEADTYPE {
default: default:
......
...@@ -501,8 +501,8 @@ func addgotsym(ctxt *ld.Link, s *ld.Symbol) { ...@@ -501,8 +501,8 @@ func addgotsym(ctxt *ld.Link, s *ld.Symbol) {
func asmb(ctxt *ld.Link) { func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
if ld.Iself { if ld.Iself {
ld.Asmbelfsetup(ctxt) ld.Asmbelfsetup(ctxt)
...@@ -519,8 +519,8 @@ func asmb(ctxt *ld.Link) { ...@@ -519,8 +519,8 @@ func asmb(ctxt *ld.Link) {
if ld.Segrodata.Filelen > 0 { if ld.Segrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(int64(ld.Segrodata.Fileoff)) ld.Cseek(int64(ld.Segrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
...@@ -528,8 +528,8 @@ func asmb(ctxt *ld.Link) { ...@@ -528,8 +528,8 @@ func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(int64(ld.Segdata.Fileoff)) ld.Cseek(int64(ld.Segdata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen)) ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
...@@ -548,8 +548,8 @@ func asmb(ctxt *ld.Link) { ...@@ -548,8 +548,8 @@ func asmb(ctxt *ld.Link) {
} }
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
symo = uint32(ld.Segdwarf.Fileoff + ld.Segdwarf.Filelen) symo = uint32(ld.Segdwarf.Fileoff + ld.Segdwarf.Filelen)
symo = uint32(ld.Rnd(int64(symo), int64(*ld.FlagRound))) symo = uint32(ld.Rnd(int64(symo), int64(*ld.FlagRound)))
...@@ -573,8 +573,8 @@ func asmb(ctxt *ld.Link) { ...@@ -573,8 +573,8 @@ func asmb(ctxt *ld.Link) {
ctxt.Cursym = nil ctxt.Cursym = nil
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f header\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f header\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(0) ld.Cseek(0)
switch ld.HEADTYPE { switch ld.HEADTYPE {
default: default:
......
...@@ -627,8 +627,8 @@ func addgotsym(ctxt *ld.Link, s *ld.Symbol) { ...@@ -627,8 +627,8 @@ func addgotsym(ctxt *ld.Link, s *ld.Symbol) {
func asmb(ctxt *ld.Link) { func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f asmb\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
if ld.Iself { if ld.Iself {
ld.Asmbelfsetup(ctxt) ld.Asmbelfsetup(ctxt)
...@@ -646,8 +646,8 @@ func asmb(ctxt *ld.Link) { ...@@ -646,8 +646,8 @@ func asmb(ctxt *ld.Link) {
if ld.Segrodata.Filelen > 0 { if ld.Segrodata.Filelen > 0 {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f rodatblk\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(int64(ld.Segrodata.Fileoff)) ld.Cseek(int64(ld.Segrodata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen)) ld.Datblk(ctxt, int64(ld.Segrodata.Vaddr), int64(ld.Segrodata.Filelen))
...@@ -655,8 +655,8 @@ func asmb(ctxt *ld.Link) { ...@@ -655,8 +655,8 @@ func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f datblk\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(int64(ld.Segdata.Fileoff)) ld.Cseek(int64(ld.Segdata.Fileoff))
ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen)) ld.Datblk(ctxt, int64(ld.Segdata.Vaddr), int64(ld.Segdata.Filelen))
...@@ -677,8 +677,8 @@ func asmb(ctxt *ld.Link) { ...@@ -677,8 +677,8 @@ func asmb(ctxt *ld.Link) {
// TODO: rationalize // TODO: rationalize
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f sym\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
switch ld.HEADTYPE { switch ld.HEADTYPE {
default: default:
if ld.Iself { if ld.Iself {
...@@ -741,8 +741,8 @@ func asmb(ctxt *ld.Link) { ...@@ -741,8 +741,8 @@ func asmb(ctxt *ld.Link) {
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f headr\n", obj.Cputime()) fmt.Fprintf(ctxt.Bso, "%5.2f headr\n", obj.Cputime())
ctxt.Bso.Flush()
} }
ctxt.Bso.Flush()
ld.Cseek(0) ld.Cseek(0)
switch ld.HEADTYPE { switch ld.HEADTYPE {
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment