Documentation ¶
Overview ¶
Package fatbin implements a simple fat binary format, and provides facilities for creating fat binaries and accessing its variants.
A fatbin binary is a base binary with a zip archive appended, containing copies of the same binary targeted to different GOOS/GOARCH combinations. The zip archive contains one entry for each supported architecture and operating system combination.
Fatbin currently only supports ELF or Mach-O base binaries.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoSuchImage is returned when the fatbin does not contain an // image for the requested GOOS/GOARCH combination. ErrNoSuchImage = errors.New("image does not exist") // ErrUnknownImageFormat is returned when a binary cannot be read // as a fatbin. ErrUnknownImageFormat = errors.New("unknown image format") )
Functions ¶
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader reads images from a fatbin.
func NewReader ¶
NewReader returns a new fatbin reader from the provided reader. The offset should be the offset of the fatbin archive; size is the total file size. The provided goos and goarch are that of the base binary.
func OpenFile ¶
OpenFile parses the provided ReaderAt with the provided size. The file's contents is parsed to determine the offset of the fatbin's archive. OpenFile returns an error if the file is not a fatbin.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
A Writer is used to append fatbin images to an existing binary.
func NewFileWriter ¶
NewFileWriter returns a writer that can be used to append fatbin images to the binary represented by the provided file. NewFileWriter removes any existing fatbin images that may be attached to the binary. It relies on content sniffing (see Sniff) to determine its offset.
func NewWriter ¶
NewWriter returns a writer that may be used to append fatbin images to the writer w. The writer should be positioned at the end of the base binary image.
func (*Writer) Close ¶
Close should be called after all images have been written. No more images can be written after a call to Close.