elflib
Version:
ELF file reader and writer
91 lines (90 loc) • 3.49 kB
TypeScript
import { uint32, uint64 } from './primitive.js';
import { RPLFileInfo } from './rplfileinfo.js';
import { Structs } from './structs.js';
import { Symbol as ELFSymbol } from './symbol.js';
import * as Enums from './enums.js';
import { Relocation } from './relocation.js';
import { File } from './index.js';
export declare class Section extends Structs.Section {
constructor();
/** Get the section's name. */
getName(elf: File): '<null>' | '<compressed>' | string;
/** The index of this section */
index: number;
/** The raw binary data of this section */
protected _data: Uint8Array;
/** The raw binary data of this section */
get data(): Uint8Array;
set data(data: Uint8Array);
/** The uncompressed size of this section in bytes, if it's compressed.
* If the section is not compressed, this is identical to {@link Section.size}. */
get sizeUncompressed(): number;
get crc32Hash(): Promise<number>;
/** Offset from the start of the {@link Header.shstrIndex section headers string table}
* to the address of this section's name in said table, if any. */
get nameOffset(): uint32;
/** The type of this section. */
get type(): Enums.SectionType;
/** The flags for this section. */
get flags(): uint32;
/** The virtual address of this section. */
get addr(): uint32 | uint64;
/** The absolute offset of the section in the file. */
get offset(): uint32;
/** The size of this section, in bytes. */
get size(): uint32;
/** A section linked to this section. For example for a symbol section the
* linked section is a string table section providing names for symbols. */
get link(): uint32;
/** Section type specific info for this section. */
get info(): uint32;
/** The alignment requirement of this section. */
get addrAlign(): uint32;
/** The size of each "entity" in this section, if applicable.
* For example, if this is a symbol table section, this is the size of a symbol entry. */
get entSize(): uint32;
set nameOffset(nameOffset: uint32);
set type(type: Enums.SectionType);
set flags(flags: uint32);
set addr(addr: uint32 | uint64);
set offset(offset: uint32);
set size(size: uint32);
set link(link: uint32);
set info(info: uint32);
set addrAlign(addrAlign: uint32);
set entSize(entSize: uint32);
}
/** A string table section. */
export declare class StringSection extends Section {
get size(): number;
get data(): Uint8Array;
set data(data: Uint8Array);
/** The strings parsed from this section in the case of a string table section. */
strings: {
[index: number]: string;
};
}
/** A symbol table section. */
export declare class SymbolSection extends Section {
get size(): number;
get data(): Uint8Array;
set data(data: Uint8Array);
/** The symbols parsed from this section. */
symbols: ELFSymbol[];
}
/** A relocation table section. */
export declare class RelocationSection extends Section {
get size(): number;
get data(): Uint8Array;
set data(data: Uint8Array);
/** The relocations parsed from this section. */
relocations: Relocation[];
}
/** RPL-exclusive CRC hashes section. */
export declare class RPLCrcSection extends Section {
}
/** RPL-exclusive file information section. */
export declare class RPLFileInfoSection extends Section {
/** The parsed RPL file information. */
fileinfo: RPLFileInfo;
}