aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj/objfile.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2016-04-06 21:45:29 -0700
committerMatthew Dempsky <mdempsky@google.com>2016-04-07 06:09:54 +0000
commit4b7e36cdfe8e0c3579a2503a81474fe43db4db69 (patch)
tree63c27cdcb02f807697dda6a3b73601799c1838ea /src/cmd/internal/obj/objfile.go
parentb17b95301a549d168d96e38310d06216f595e53b (diff)
downloadgo-4b7e36cdfe8e0c3579a2503a81474fe43db4db69.tar.xz
cmd: extract obj's Biobuf code into new bio package
API could still be made more Go-ey. Updates #15165. Change-Id: I514ffceffa43c293ae5d7e5f1e9193fda0098865 Reviewed-on: https://go-review.googlesource.com/21644 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/internal/obj/objfile.go')
-rw-r--r--src/cmd/internal/obj/objfile.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cmd/internal/obj/objfile.go b/src/cmd/internal/obj/objfile.go
index bdd3bfc826..405cbf446a 100644
--- a/src/cmd/internal/obj/objfile.go
+++ b/src/cmd/internal/obj/objfile.go
@@ -109,6 +109,7 @@ package obj
import (
"bufio"
+ "cmd/internal/bio"
"cmd/internal/sys"
"fmt"
"log"
@@ -120,7 +121,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 *Biobuf) {
+func Writeobjdirect(ctxt *Link, b *bio.Buf) {
Flushplist(ctxt)
WriteObjFile(ctxt, b)
}
@@ -373,16 +374,16 @@ func (w *objWriter) writeLengths() {
w.writeInt(int64(w.nFile))
}
-func newObjWriter(ctxt *Link, b *Biobuf) *objWriter {
+func newObjWriter(ctxt *Link, b *bio.Buf) *objWriter {
return &objWriter{
ctxt: ctxt,
- wr: b.w,
+ wr: b.Writer(),
vrefIdx: make(map[string]int),
refIdx: make(map[string]int),
}
}
-func WriteObjFile(ctxt *Link, b *Biobuf) {
+func WriteObjFile(ctxt *Link, b *bio.Buf) {
w := newObjWriter(ctxt, b)
// Magic header