[dev.link] cmd/link: remove buffered file I/O from OutBuf

Change-Id: I72b1e57631fe4a31597fd0452ee1beb14378febb
Reviewed-on: https://go-review.googlesource.com/c/go/+/228317
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Jeremy Faller 2020-04-15 13:23:29 -04:00
parent 95a5a0dee9
commit b2def42d9e
15 changed files with 41 additions and 135 deletions

View file

@ -32,7 +32,6 @@
package ld
import (
"bufio"
"bytes"
"cmd/internal/gcprog"
"cmd/internal/objabi"
@ -958,11 +957,10 @@ func Datblk(ctxt *Link, out *OutBuf, addr, size int64) {
// Used only on Wasm for now.
func DatblkBytes(ctxt *Link, addr int64, size int64) []byte {
buf := bytes.NewBuffer(make([]byte, 0, size))
out := &OutBuf{w: bufio.NewWriter(buf)}
buf := make([]byte, size)
out := &OutBuf{heap: buf}
writeDatblkToOutBuf(ctxt, out, addr, size)
out.Flush()
return buf.Bytes()
return buf
}
func writeDatblkToOutBuf(ctxt *Link, out *OutBuf, addr int64, size int64) {