type FileHeader … type File … type SectionHeader … type Section … // Data reads and returns the contents of the ELF section. // Even if the section is stored compressed in the ELF file, // Data returns uncompressed data. // // For an [SHT_NOBITS] section, Data always returns a non-nil error. func (s *Section) Data() ([]byte, error) { … } // stringTable reads and returns the string table given by the // specified link value. func (f *File) stringTable(link uint32) ([]byte, error) { … } // Open returns a new ReadSeeker reading the ELF section. // Even if the section is stored compressed in the ELF file, // the ReadSeeker reads uncompressed data. // // For an [SHT_NOBITS] section, all calls to the opened reader // will return a non-nil error. func (s *Section) Open() io.ReadSeeker { … } type ProgHeader … type Prog … // Open returns a new ReadSeeker reading the ELF program body. func (p *Prog) Open() io.ReadSeeker { … } type Symbol … type FormatError … func (e *FormatError) Error() string { … } // Open opens the named file using [os.Open] and prepares it for use as an ELF binary. func Open(name string) (*File, error) { … } // Close closes the [File]. // If the [File] was created using [NewFile] directly instead of [Open], // Close has no effect. func (f *File) Close() error { … } // SectionByType returns the first section in f with the // given type, or nil if there is no such section. func (f *File) SectionByType(typ SectionType) *Section { … } // NewFile creates a new [File] for accessing an ELF binary in an underlying reader. // The ELF binary is expected to start at position 0 in the ReaderAt. func NewFile(r io.ReaderAt) (*File, error) { … } // getSymbols returns a slice of Symbols from parsing the symbol table // with the given type, along with the associated string table. func (f *File) getSymbols(typ SectionType) ([]Symbol, []byte, error) { … } var ErrNoSymbols … func (f *File) getSymbols32(typ SectionType) ([]Symbol, []byte, error) { … } func (f *File) getSymbols64(typ SectionType) ([]Symbol, []byte, error) { … } // getString extracts a string from an ELF string table. func getString(section []byte, start int) (string, bool) { … } // Section returns a section with the given name, or nil if no such // section exists. func (f *File) Section(name string) *Section { … } // applyRelocations applies relocations to dst. rels is a relocations section // in REL or RELA format. func (f *File) applyRelocations(dst []byte, rels []byte) error { … } // canApplyRelocation reports whether we should try to apply a // relocation to a DWARF data section, given a pointer to the symbol // targeted by the relocation. // Most relocations in DWARF data tend to be section-relative, but // some target non-section symbols (for example, low_PC attrs on // subprogram or compilation unit DIEs that target function symbols). func canApplyRelocation(sym *Symbol) bool { … } func (f *File) applyRelocationsAMD64(dst []byte, rels []byte) error { … } func (f *File) applyRelocations386(dst []byte, rels []byte) error { … } func (f *File) applyRelocationsARM(dst []byte, rels []byte) error { … } func (f *File) applyRelocationsARM64(dst []byte, rels []byte) error { … } func (f *File) applyRelocationsPPC(dst []byte, rels []byte) error { … } func (f *File) applyRelocationsPPC64(dst []byte, rels []byte) error { … } func (f *File) applyRelocationsMIPS(dst []byte, rels []byte) error { … } func (f *File) applyRelocationsMIPS64(dst []byte, rels []byte) error { … } func (f *File) applyRelocationsLOONG64(dst []byte, rels []byte) error { … } func (f *File) applyRelocationsRISCV64(dst []byte, rels []byte) error { … } func (f *File) applyRelocationss390x(dst []byte, rels []byte) error { … } func (f *File) applyRelocationsSPARC64(dst []byte, rels []byte) error { … } func (f *File) DWARF() (*dwarf.Data, error) { … } // Symbols returns the symbol table for f. The symbols will be listed in the order // they appear in f. // // For compatibility with Go 1.0, Symbols omits the null symbol at index 0. // After retrieving the symbols as symtab, an externally supplied index x // corresponds to symtab[x-1], not symtab[x]. func (f *File) Symbols() ([]Symbol, error) { … } // DynamicSymbols returns the dynamic symbol table for f. The symbols // will be listed in the order they appear in f. // // If f has a symbol version table, the returned [File.Symbols] will have // initialized Version and Library fields. // // For compatibility with [File.Symbols], [File.DynamicSymbols] omits the null symbol at index 0. // After retrieving the symbols as symtab, an externally supplied index x // corresponds to symtab[x-1], not symtab[x]. func (f *File) DynamicSymbols() ([]Symbol, error) { … } type ImportedSymbol … // ImportedSymbols returns the names of all symbols // referred to by the binary f that are expected to be // satisfied by other libraries at dynamic load time. // It does not return weak symbols. func (f *File) ImportedSymbols() ([]ImportedSymbol, error) { … } type verneed … // gnuVersionInit parses the GNU version tables // for use by calls to gnuVersion. func (f *File) gnuVersionInit(str []byte) bool { … } // gnuVersion adds Library and Version information to sym, // which came from offset i of the symbol table. func (f *File) gnuVersion(i int) (library string, version string) { … } // ImportedLibraries returns the names of all libraries // referred to by the binary f that are expected to be // linked with the binary at dynamic link time. func (f *File) ImportedLibraries() ([]string, error) { … } // DynString returns the strings listed for the given tag in the file's dynamic // section. // // The tag must be one that takes string values: [DT_NEEDED], [DT_SONAME], [DT_RPATH], or // [DT_RUNPATH]. func (f *File) DynString(tag DynTag) ([]string, error) { … } // DynValue returns the values listed for the given tag in the file's dynamic // section. func (f *File) DynValue(tag DynTag) ([]uint64, error) { … } type nobitsSectionReader … func (*nobitsSectionReader) ReadAt(p []byte, off int64) (n int, err error) { … }