elfwriter

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

elfwriter is a package to write ELF files without having their entire contents in memory at any one time. This package is incomplete, only features needed to write core files are implemented, notably missing: - program headers at the beginning of the file

Index

Constants

View Source
const (
	DelveHeaderNoteType = 0x444C5645 // DLVE
	DelveThreadNodeType = 0x444C5654 // DLVT

	DelveHeaderTargetPidPrefix  = "Target Pid: "
	DelveHeaderEntryPointPrefix = "Entry Point: "
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Note

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

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 {
	Err      error
	Progs    []*elf.ProgHeader
	Sections []*elf.SectionHeader
	// contains filtered or unexported fields
}

Writer writes ELF files.

func New

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

New creates a new Writer.

func (*Writer) Align

func (w *Writer) Align(align int64)

Align writes as many padding bytes as needed to make the current file offset a multiple of align.

func (*Writer) Here

func (w *Writer) Here() int64

Here returns the current seek offset from the start of the file.

func (*Writer) Write

func (w *Writer) Write(buf []byte)

func (*Writer) WriteNotes

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

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

func (*Writer) WriteProgramHeaders

func (w *Writer) WriteProgramHeaders()

WriteProgramHeaders writes the program headers at the current location and patches the file header accordingly.

func (*Writer) WriteSectionHeaders

func (w *Writer) WriteSectionHeaders()

WriteSectionHeaders writes the section headers at the current location and patches the file header accordingly.

Jump to

Keyboard shortcuts

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