elfwriter

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package elfwriter is a package to write ELF files without having their entire contents in memory at any one time.

Original work started from https://github.com/go-delve/delve/blob/master/pkg/elfwriter/writer.go and additional functionality added on top.

This package does not provide completeness guarantees, only features needed to write core files are implemented, notably missing: - Consistency and soundness of relocations - Consistency and preservation of linked sections (when target removed (sh_link)) - partially supported - Consistency and existence of overlapping segments when a section removed (offset, range check)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Note

type Note struct {
	Type elf.NType
	Name string
	Data []byte
}

type Option

type Option func(w *Writer)

func WithDebugCompressionEnabled

func WithDebugCompressionEnabled(b bool) Option

type WriteCloserSeeker

type WriteCloserSeeker interface {
	io.Writer
	io.Seeker
	io.Closer
}

WriteCloserSeeker is the union of io.Writer, io.Closer and io.Seeker.

type Writer

type Writer struct {
	Progs    []*elf.Prog
	Sections []*elf.Section
	// contains filtered or unexported fields
}

Writer writes ELF files.

func New

func New(w WriteCloserSeeker, fhdr *elf.FileHeader, opts ...Option) (*Writer, error)

New creates a new Writer.

func (*Writer) Close

func (w *Writer) Close() error

Close closes the WriteCloseSeeker.

func (*Writer) Write

func (w *Writer) Write() error

Write writes the segments (program headers) and sections to output.

func (*Writer) WriteNotes

func (w *Writer) WriteNotes(notes []Note) *elf.ProgHeader

WriteNotes writes notes to the current location, returns a ProgHeader describing the notes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL