mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Revert "[dev.link] cmd/link: remove buffered file I/O from OutBuf"
This reverts commit b2def42d9e.
Reason for revert: trybots failing
Change-Id: I920be6d8de158b1e513154ac0eb0c8fa0cffa9f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/228657
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
b2def42d9e
commit
7fe3f30bbb
15 changed files with 135 additions and 41 deletions
|
|
@ -32,6 +32,7 @@
|
|||
package ld
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"cmd/internal/gcprog"
|
||||
"cmd/internal/objabi"
|
||||
|
|
@ -957,10 +958,11 @@ 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 := make([]byte, size)
|
||||
out := &OutBuf{heap: buf}
|
||||
buf := bytes.NewBuffer(make([]byte, 0, size))
|
||||
out := &OutBuf{w: bufio.NewWriter(buf)}
|
||||
writeDatblkToOutBuf(ctxt, out, addr, size)
|
||||
return buf
|
||||
out.Flush()
|
||||
return buf.Bytes()
|
||||
}
|
||||
|
||||
func writeDatblkToOutBuf(ctxt *Link, out *OutBuf, addr int64, size int64) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue