v2_toberemoved.gen.x64 #
x64 Instruction Encoding Helpers These functions provide type-safe instruction encoding for the x64 backend.
Constants #
const x64_backend_limitation_hint = 'x64: native backend limitation: retry with the C backend or reduce the source to supported x64 features'
const linux_tiny_not_eligible_prefix = 'Linux tiny executable is not eligible: '
const macos_tiny_not_eligible_prefix = 'macOS tiny object is not eligible: '
fn unsupported_external_symbol_message_for_name #
fn unsupported_external_symbol_message_for_name(format ObjectFormat, raw_name string, context string) ?string
fn CoffObject.new #
fn CoffObject.new() &CoffObject
fn ElfObject.new #
fn ElfObject.new() &ElfObject
fn Gen.new #
fn Gen.new(mod &mir.Module) &Gen
fn Gen.new_with_format #
fn Gen.new_with_format(mod &mir.Module, obj_format ObjectFormat) &Gen
fn Gen.new_with_format_and_abi #
fn Gen.new_with_format_and_abi(mod &mir.Module, obj_format ObjectFormat, abi X64Abi) &Gen
fn MachOObject.new #
fn MachOObject.new() &MachOObject
fn ObjectFormat.from #
fn ObjectFormat.from[W](input W) !ObjectFormat
fn ObjectSection.from #
fn ObjectSection.from[W](input W) !ObjectSection
fn PeLinker.new #
fn PeLinker.new(coff &CoffObject) &PeLinker
fn X64Abi.from #
fn X64Abi.from[W](input W) !X64Abi
enum ObjectFormat #
enum ObjectFormat {
elf
macho
coff
}
enum X64Abi #
enum X64Abi {
sysv
windows
}
struct CoffObject #
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 (CoffObject) write #
fn (mut c CoffObject) write(path string)
struct ElfObject #
struct ElfObject {
pub mut:
text_data []u8
data_data []u8
rodata []u8
// Symbol Table
symbols []ElfSymbol
str_table []u8
// Relocations
text_relocs []ElfRela
// Section Names
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 (ElfObject) write #
fn (mut e ElfObject) write(path string)
struct Gen #
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
// Register allocation
reg_map map[int]int
used_regs []int
cur_func_ret_type int
cur_func_abi_ret_indirect bool
cur_func_abi_ret_class mir.AbiValueClass
sret_save_offset int
}
fn (Gen) gen #
fn (mut g Gen) gen()
fn (Gen) link_executable #
fn (mut g Gen) link_executable(path string) !
fn (Gen) link_linux_tiny_executable #
fn (mut g Gen) link_linux_tiny_executable(path string) !
fn (Gen) write_file #
fn (mut g Gen) write_file(path string)
fn (Gen) write_macos_tiny_object #
fn (mut g Gen) write_macos_tiny_object(path string) !
struct MachOObject #
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 (MachOObject) write #
fn (mut m MachOObject) write(path string)
struct PeLinker #
struct PeLinker {
coff &CoffObject
mut:
imports []PeImport
}
fn (PeLinker) write #
fn (mut l PeLinker) write(path string) !
fn (PeLinker) image #
fn (mut l PeLinker) image() ![]u8
- README
- Constants
- fn unsupported_external_symbol_message_for_name
- fn CoffObject.new
- fn ElfObject.new
- fn Gen.new
- fn Gen.new_with_format
- fn Gen.new_with_format_and_abi
- fn MachOObject.new
- fn ObjectFormat.from
- fn ObjectSection.from
- fn PeLinker.new
- fn X64Abi.from
- enum ObjectFormat
- enum X64Abi
- struct CoffObject
- struct ElfObject
- struct Gen
- struct MachOObject
- struct PeLinker