cmd/internal/obj: remove use of package bio

Also add MustClose and MustWriter to cmd/internal/bio, and use them in
cmd/asm.

Change-Id: I07f5df3b66c17bc5b2e6ec9c4357d9b653e354e0
Reviewed-on: https://go-review.googlesource.com/21938
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Matthew Dempsky 2016-04-12 17:58:46 -07:00
parent b623b71509
commit 045411e6f2
5 changed files with 57 additions and 12 deletions

View file

@ -109,7 +109,6 @@ package obj
import (
"bufio"
"cmd/internal/bio"
"cmd/internal/sys"
"fmt"
"log"
@ -120,7 +119,7 @@ import (
// The Go and C compilers, and the assembler, call writeobj to write
// out a Go object file. The linker does not call this; the linker
// does not write out object files.
func Writeobjdirect(ctxt *Link, b *bio.Writer) {
func Writeobjdirect(ctxt *Link, b *bufio.Writer) {
Flushplist(ctxt)
WriteObjFile(ctxt, b)
}
@ -187,16 +186,16 @@ func (w *objWriter) writeLengths() {
w.writeInt(int64(w.nFile))
}
func newObjWriter(ctxt *Link, b *bio.Writer) *objWriter {
func newObjWriter(ctxt *Link, b *bufio.Writer) *objWriter {
return &objWriter{
ctxt: ctxt,
wr: b.Writer,
wr: b,
vrefIdx: make(map[string]int),
refIdx: make(map[string]int),
}
}
func WriteObjFile(ctxt *Link, b *bio.Writer) {
func WriteObjFile(ctxt *Link, b *bufio.Writer) {
w := newObjWriter(ctxt, b)
// Magic header