elflib
Version:
ELF file reader and writer
93 lines (92 loc) • 5.82 kB
TypeScript
import * as ELF from './types/index.js';
import { uint32, uint64 } from './types/primitive.js';
/** Get a consolidates array of all the symbols in the file.
* @param elf the ELF file.
* @returns an array of symbols. */
export declare function getSymbols(elf: ELF.File): ELF.Symbol[];
/** Get all the symbols that are addressed inside a given section.
* @param elf the ELF file.
* @param {ELF.Section | uint32} sectionOrIndex either the section or the index of the section.
* @returns {ELF.Symbol[]} an array of symbols that are addressed in the section. */
export declare function getSymbolsInSection(elf: ELF.File, sectionOrIndex: ELF.Section | uint32): ELF.Symbol[];
/** Get all the symbols that are addressed inside a given segment.
* @param {ELF.Segment | uint32} segmentOrIndex either the segment or the index of the segment.
* @returns {ELF.Symbol[]} an array of symbols that are addressed in the segment. */
/** Get all the section that are addressed inside a given segment.
* @param {ELF.Segment | uint32} segmentOrIndex either the segment or the index of the segment.
* @returns {ELF.Section[]} an array of sections that are addressed in the segment. */
/** Get the first section in which a symbol is addressed.
* @param {ELF.Symbol} symbol The symbol
* @returns {ELF.Section[]} an array of sections that contain the symbol.
*/
export declare function getSectionsForSymbol(elf: ELF.File, symbol: ELF.Symbol): ELF.Section[];
/** Get all sections in which a symbol is addressed.
* @param {ELF.Symbol} symbol The symbol
* @returns {ELF.Section} the first section which contains the symbol. */
export declare function getSectionForSymbol(elf: ELF.File, symbol: ELF.Symbol): ELF.Section;
/** Get the first segment in which a symbol is addressed.
* @param {ELF.Symbol} symbol The symbol
* @returns {ELF.Section} all segments which contain the symbol. */
/** Get the first segment in which a symbol is addressed.
* @param {ELF.Symbol} symbol The symbol
* @returns {ELF.Section} the first segment which contains the symbol. */
/** Find all symbols inside that overlap a given virtual memory location.
* @param {uint32 | uint64} location The virtual memory address.
* @returns {ELF.Symbol[]} an array of symbols that contain the location. */
export declare function getSymbolsAtVirtualMemoryLocation(elf: ELF.File, location: uint32 | uint64): ELF.Symbol[];
/** Find all symbols inside that overlap a given physical memory location.
* @param {uint32 | uint64} location The physical memory address.
* @returns {ELF.Symbol[]} an array of symbols that contain the location.
*/
export declare function getSymbolsAtPhysicalMemoryLocation(elf: ELF.File, location: uint32 | uint64): ELF.Symbol[];
/** Get all the sections that overlap a given virtual memory location
* @param {uint32 | uint64} location The virtual memory address.
* @returns {ELF.Section[]} an array of sections that find the location inside of them.
*/
export declare function getSectionsAtVirtualMemoryLocation(elf: ELF.File, location: uint32 | uint64): ELF.Section[];
/** Get all the sections that overlap a given physical memory location
* @param {uint32 | uint64} location The physical memory address.
* @returns {ELF.Section[]} an array of sections that find the location inside of them.
*/
export declare function getSectionsAtPhysicalMemoryLocation(elf: ELF.File, location: uint32 | uint64): ELF.Section[];
/** Get all the segments that overlap a given virtual memory location
* @param {uint32 | uint64} location The virtual memory address.
* @returns {ELF.Section} all segments which contain the address. */
/** Get all the segments that overlap a given physical memory location
* @param {uint32 | uint64} location The physical memory address.
* @returns {ELF.Section} all segments which contain the address. */
/** translate a virtual address to a physical address, if possible.
* @param location The virtual memory address.
* @returns the physical address. */
/** translate a virtual address to an offset in the ELF file, if possible.
* @param {uint32 | uint64} location The virtual memory address.
* @returns {uint32 | uint64} the file offset. */
/** translate a physical address to a virtual address.
* @param {uint32 | uint64} location The physical memory address.
* @returns {uint32 | uint64} the virtual address. */
/** translate a physical address to an offset in the ELF file.
* @param {uint32 | uint64} location The physical memory address.
* @returns {uint32 | uint64} the file offset. */
/** translate a file offset to a physical address, if possible.
* @param {uint32} location The file offset.
* @returns {uint32 | uint64} the physical address. */
/** translate a file offset to a virtual address, if possible.
* @param {uint32} location The file offset.
* @returns {uint32 | uint64} the virtual address. */
/** Get the first section that matches the name (case-insensitive).
* @param {string} sectionName the name of the section to find.
* @returns {ELF.Section} The first section that matches the name
*/
/** Get all sections that matches the name (case-insensitive).
* @param {string} sectionName the name of the sections to find.
* @returns {ELF.Section[]} an array of sections that match the name.
*/
/** Get the first symbol that matches the name (case-insensitive).
* @param {string} symbolName the name of the symbol to find.
* @returns {ELF.Symbol[]} an array of symbols that match the name.
*/
export declare function getSymbolByName(elf: ELF.File, symbolName: string): ELF.Symbol | undefined;
/** Get all symbols that matches the name (case-insensitive).
* @param {string} symbolName the name of the symbols to find.
* @returns {ELF.Symbol[]} an array of symbols that match the name. */
export declare function getSymbolsByName(elf: ELF.File, symbolName: string): ELF.Symbol[];