jon.recoil.org

Module Arm64_binary_emitter.Encode_directive

module Asm_section = Asm_targets.Asm_section
module Symbol = Arm64_ast.Ast.Symbol
val eval_constant : Section_state.t -> all_sections:All_section_states.t -> D.Directive.Constant.t -> int64 option
val emit_directive : Section_state.t -> current_section:Asm_section.t ref -> all_sections:All_section_states.t -> D.Directive.t -> unit
val is_rela_platform : unit -> bool

Returns true if we're on a RELA platform (Linux ELF) where addends are stored in the relocation entry rather than in the instruction/data. On REL platforms (macOS Mach-O), addends are encoded in the instruction.

val resolve_local_label_for_elf : all_sections:All_section_states.t -> target:Symbol.target -> sym_offset:int -> string * int

On Linux ELF, local labels (starting with .L) don't have symbol table entries. The assembler converts them to section symbol + offset. This function performs that conversion. Returns (symbol_name, addend) where symbol_name is either the original label or the section name, and addend includes the offset within the section plus any original offset. On macOS, returns the original label name and offset unchanged.

val emit_relocs_for_all_symbol_refs : bool ref

When true, emit relocations for ALL 8-byte symbol references (matching assembler behavior). When false, only emit relocations for cross-section references and resolve same-section refs at emit time. Set to true for verification against the assembler.