var errNoFallocate … const outbufMode … type OutBuf … func (out *OutBuf) Open(name string) error { … } func NewOutBuf(arch *sys.Arch) *OutBuf { … } var viewError … func (out *OutBuf) View(start uint64) (*OutBuf, error) { … } var viewCloseError … func (out *OutBuf) Close() error { … } // ErrorClose closes the output file (if any). // It is supposed to be called only at exit on error, so it doesn't do // any clean up or buffer flushing, just closes the file. func (out *OutBuf) ErrorClose() { … } // isMmapped returns true if the OutBuf is mmaped. func (out *OutBuf) isMmapped() bool { … } // Data returns the whole written OutBuf as a byte slice. func (out *OutBuf) Data() []byte { … } // copyHeap copies the heap to the mmapped section of memory, returning true if // a copy takes place. func (out *OutBuf) copyHeap() bool { … } const maxOutBufHeapLen … // writeLoc determines the write location if a buffer is mmaped. // We maintain two write buffers, an mmapped section, and a heap section for // writing. When the mmapped section is full, we switch over the heap memory // for writing. func (out *OutBuf) writeLoc(lenToWrite int64) (int64, []byte) { … } func (out *OutBuf) SeekSet(p int64) { … } func (out *OutBuf) Offset() int64 { … } // Write writes the contents of v to the buffer. func (out *OutBuf) Write(v []byte) (int, error) { … } func (out *OutBuf) Write8(v uint8) { … } // WriteByte is an alias for Write8 to fulfill the io.ByteWriter interface. func (out *OutBuf) WriteByte(v byte) error { … } func (out *OutBuf) Write16(v uint16) { … } func (out *OutBuf) Write32(v uint32) { … } func (out *OutBuf) Write32b(v uint32) { … } func (out *OutBuf) Write64(v uint64) { … } func (out *OutBuf) Write64b(v uint64) { … } func (out *OutBuf) WriteString(s string) { … } // WriteStringN writes the first n bytes of s. // If n is larger than len(s) then it is padded with zero bytes. func (out *OutBuf) WriteStringN(s string, n int) { … } // WriteStringPad writes the first n bytes of s. // If n is larger than len(s) then it is padded with the bytes in pad (repeated as needed). func (out *OutBuf) WriteStringPad(s string, n int, pad []byte) { … } // WriteSym writes the content of a Symbol, and returns the output buffer // that we just wrote, so we can apply further edit to the symbol content. // For generator symbols, it also sets the symbol's Data to the output // buffer. func (out *OutBuf) WriteSym(ldr *loader.Loader, s loader.Sym) []byte { … }