cmd/link/internal, cmd/internal/obj: introduce ctxt.Logf

Replace the various calls to Fprintf(ctxt.Bso, ...) with a helper,
ctxt.Logf. This also addresses the various inconsistent flushing of
ctxt.Bso.

Because we have two Link structures, add Link.Logf in both places.

Change-Id: I23093f9b9b3bf33089a0ffd7f815f92dcd1a1fa1
Reviewed-on: https://go-review.googlesource.com/27730
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Dave Cheney 2016-08-25 12:32:42 +10:00
parent 5f94ff4c87
commit d61c07ffd8
29 changed files with 141 additions and 190 deletions

View file

@ -33,6 +33,7 @@ package obj
import (
"bufio"
"cmd/internal/sys"
"fmt"
)
// An Addr is an argument to an instruction.
@ -687,6 +688,11 @@ func (ctxt *Link) Diag(format string, args ...interface{}) {
ctxt.DiagFunc(format, args...)
}
func (ctxt *Link) Logf(format string, args ...interface{}) {
fmt.Fprintf(ctxt.Bso, format, args...)
ctxt.Bso.Flush()
}
// The smallest possible offset from the hardware stack pointer to a local
// variable on the stack. Architectures that use a link register save its value
// on the stack in the function prologue and so always have a pointer between