v.gen.elf #
ELF64 Constants
Constants #
const em_x86_64 = u16(62)
fn ElfObject.new #
fn ElfObject.new(machine u16) &ElfObject
new creates an empty ELF64 relocatable object for the specified ELF machine.
struct ElfObject #
struct ElfObject {
machine u16
pub mut:
text_data []u8
data_data []u8
rodata []u8
// Symbol Table
symbols []ElfSymbol
symbol_by_name map[string]int
str_table []u8
// Relocations
text_relocs []ElfRela
// Section Names
shstr_table []u8
}
ElfObject is a minimal ELF64 relocatable object shared by native backends.
fn (ElfObject) add_symbol #
fn (mut e ElfObject) add_symbol(name string, value u64, is_func bool, shndx u16) int
add_symbol adds or upgrades a symbol in the object symbol table.
fn (ElfObject) add_undefined #
fn (mut e ElfObject) add_undefined(name string) int
add_undefined returns a symbol-table entry for an external symbol.
fn (ElfObject) add_text_reloc #
fn (mut e ElfObject) add_text_reloc(offset u64, sym_idx int, type_ int, addend i64)
add_text_reloc appends a relocation against the object's text section.
fn (ElfObject) write #
fn (mut e ElfObject) write(path string)
write serializes the object to an ELF64 relocatable file.