fn CoffObject.new() &CoffObject
fn ElfObject.new() &ElfObject
fn Gen.new(mod &mir.Module) &Gen
fn MachOObject.new() &MachOObject
fn ObjectSection.from[W](input W) !ObjectSection
fn PeLinker.new(coff &CoffObject) &PeLinker
fn X64Abi.from[W](input W) !X64Abi
enum X64Abi {
sysv
windows
}
struct CoffObject {
pub mut:
text_data []u8
data_data []u8
rodata []u8
symbols []CoffSymbol
str_table []u8
sym_by_name map[string]int
text_relocs []CoffRelocation
}
fn (CoffObject) add_symbol #
fn (mut c CoffObject) add_symbol(name string, value u64, is_func bool, section u8) int
fn (CoffObject) add_undefined #
fn (mut c CoffObject) add_undefined(name string) int
fn (CoffObject) add_text_reloc #
fn (mut c CoffObject) add_text_reloc(offset int, sym_idx int, type_ u16)
fn (mut c CoffObject) write(path string)
struct ElfObject {
pub mut:
text_data []u8
data_data []u8
rodata []u8
symbols []ElfSymbol
str_table []u8
text_relocs []ElfRela
shstr_table []u8
}
fn (ElfObject) add_symbol #
fn (mut e ElfObject) add_symbol(name string, value u64, is_func bool, shndx u16) int
fn (ElfObject) add_undefined #
fn (mut e ElfObject) add_undefined(name string) int
fn (ElfObject) add_text_reloc #
fn (mut e ElfObject) add_text_reloc(offset u64, sym_idx int, type_ int, addend i64)
fn (mut e ElfObject) write(path string)
struct Gen {
mod &mir.Module
mut:
elf &ElfObject
macho &MachOObject
coff &CoffObject
obj_format ObjectFormat
abi X64Abi
stack_map map[int]int
alloca_offsets map[int]int
stack_size int
curr_offset int
block_offsets map[int]int
pending_labels map[int][]int
reg_map map[int]int
used_regs []int
cur_func_ret_type int
cur_func_abi_ret_indirect bool
sret_save_offset int
}
fn (Gen) link_executable #
fn (mut g Gen) link_executable(path string) !
fn (mut g Gen) write_file(path string)
struct MachOObject {
pub mut:
text_data []u8
data_data []u8
rodata []u8
relocs []MachORelocationInfo
symbols []MachOSymbol
str_table []u8
sym_by_name map[string]int
}
fn (MachOObject) add_symbol #
fn (mut m MachOObject) add_symbol(name string, value u64, is_ext bool, sect u8) int
fn (MachOObject) add_undefined #
fn (mut m MachOObject) add_undefined(name string) int
fn (MachOObject) add_reloc #
fn (mut m MachOObject) add_reloc(addr int, sym_idx int, typ int, pcrel bool, length int)
fn (mut m MachOObject) write(path string)
struct PeLinker {
coff &CoffObject
mut:
imports []PeImport
}
fn (mut l PeLinker) write(path string) !
fn (mut l PeLinker) image() ![]u8