safeelf

package
v0.0.0-...-50520c6 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package safeelf provides safe (from panics) wrappers around ELF parsing

Index

Constants

View Source
const ELFCLASS32 = elf.ELFCLASS32
View Source
const ELFCLASS64 = elf.ELFCLASS64
View Source
const EM_AARCH64 = elf.EM_AARCH64
View Source
const EM_X86_64 = elf.EM_X86_64
View Source
const ET_DYN = elf.ET_DYN
View Source
const ET_EXEC = elf.ET_EXEC
View Source
const PF_R = elf.PF_R
View Source
const PF_W = elf.PF_W
View Source
const PF_X = elf.PF_X
View Source
const PT_LOAD = elf.PT_LOAD
View Source
const PT_TLS = elf.PT_TLS
View Source
const SHF_ALLOC = elf.SHF_ALLOC
View Source
const SHF_COMPRESSED = elf.SHF_COMPRESSED
View Source
const SHF_EXECINSTR = elf.SHF_EXECINSTR
View Source
const SHF_WRITE = elf.SHF_WRITE
View Source
const SHN_ABS = elf.SHN_ABS
View Source
const SHN_COMMON = elf.SHN_COMMON
View Source
const SHN_UNDEF = elf.SHN_UNDEF
View Source
const SHT_DYNAMIC = elf.SHT_DYNAMIC
View Source
const SHT_DYNSYM = elf.SHT_DYNSYM
View Source
const SHT_GNU_HASH = elf.SHT_GNU_HASH
View Source
const SHT_GNU_VERDEF = elf.SHT_GNU_VERDEF
View Source
const SHT_GNU_VERNEED = elf.SHT_GNU_VERNEED
View Source
const SHT_GNU_VERSYM = elf.SHT_GNU_VERSYM
View Source
const SHT_HASH = elf.SHT_HASH
View Source
const SHT_NOBITS = elf.SHT_NOBITS
View Source
const SHT_NOTE = elf.SHT_NOTE
View Source
const SHT_PROGBITS = elf.SHT_PROGBITS
View Source
const SHT_REL = elf.SHT_REL
View Source
const SHT_RELA = elf.SHT_RELA //nolint:misspell
View Source
const SHT_SYMTAB = elf.SHT_SYMTAB
View Source
const STB_GLOBAL = elf.STB_GLOBAL
View Source
const STB_WEAK = elf.STB_WEAK
View Source
const STT_FILE = elf.STT_FILE
View Source
const STT_FUNC = elf.STT_FUNC
View Source
const STT_OBJECT = elf.STT_OBJECT
View Source
const Sym32Size = elf.Sym32Size
View Source
const Sym64Size = elf.Sym64Size

Variables

View Source
var ErrNoSymbols = elf.ErrNoSymbols

Functions

This section is empty.

Types

type File

type File struct {
	*elf.File
}

File is a safe wrapper around *elf.File that handles any panics in parsing

func NewFile

func NewFile(r io.ReaderAt) (safe *File, err error)

NewFile reads an ELF safely.

Any panic during parsing is turned into an error. This is necessary since there are a bunch of unfixed bugs in debug/elf.

https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+debug%2Felf+in%3Atitle

func Open

func Open(path string) (safe *File, err error)

Open reads an ELF from a file.

It works like NewFile, with the exception that safe.Close will close the underlying file.

func (*File) DWARF

func (se *File) DWARF() (d *dwarf.Data, err error)

DWARF is the safe version of elf.File.DWARF.

func (*File) DynamicSymbols

func (se *File) DynamicSymbols() (syms []Symbol, err error)

DynamicSymbols is the safe version of elf.File.DynamicSymbols.

func (*File) SectionsByType

func (se *File) SectionsByType(typ elf.SectionType) []*elf.Section

SectionsByType returns all sections in the file with the specified section type.

func (*File) Symbols

func (se *File) Symbols() (syms []Symbol, err error)

Symbols is the safe version of elf.File.Symbols.

type Machine

type Machine = elf.Machine

type Prog

type Prog = elf.Prog

type Section

type Section = elf.Section

type SectionFlag

type SectionFlag = elf.SectionFlag

type SectionHeader

type SectionHeader = elf.SectionHeader

type SectionIndex

type SectionIndex = elf.SectionIndex

type SectionType

type SectionType = elf.SectionType

type SymBind

type SymBind = elf.SymBind

func ST_BIND

func ST_BIND(info uint8) SymBind

type SymType

type SymType = elf.SymType

func ST_TYPE

func ST_TYPE(info uint8) SymType

type Symbol

type Symbol = elf.Symbol

Jump to

Keyboard shortcuts

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