Module Ast.Symbol
Symbol references and relocations.
Same_section_and_unit is for references that the assembler can resolve directly, such as PC-relative branches within a function. These use 19-bit signed offsets giving +/-1MB range.
Needs_reloc is for references requiring linker involvement:
- ADRP instructions need PAGE relocations because they compute page-aligned addresses that the assembler can't resolve until link time.
- ADR instructions for local labels within the same section and compilation unit use Same_section_and_unit (no relocation needed).
- Calls to runtime functions (e.g. caml_call_gc) in other compilation units need CALL26/JUMP26 relocations.
- GOT-relative references for position-independent code.
type _ reloc_directive = | LOWER_TWELVE : [ `Twelve ] reloc_directive| GOT_PAGE : [ `Twenty_one ] reloc_directive| GOT_PAGE_OFF : [ `Twelve ] reloc_directive| GOT_LOWER_TWELVE : [ `Twelve ] reloc_directive| PAGE : [ `Twenty_one ] reloc_directive| PAGE_OFF : [ `Twelve ] reloc_directive| CALL26 : [ `Twenty_six ] reloc_directive| JUMP26 : [ `Twenty_six ] reloc_directive
type 'w same_unit_or_reloc = | Same_section_and_unit : [ `Nineteen ] same_unit_or_reloc| Needs_reloc : 'w reloc_directive -> 'w same_unit_or_reloc
val create_label :
'w same_unit_or_reloc ->
?offset:int ->
Asm_targets.Asm_label.t ->
'w tval create_symbol :
'w same_unit_or_reloc ->
?offset:int ->
Asm_targets.Asm_symbol.t ->
'w tval is_label : _ t -> boolReturns true if the target is a label.
val print_target : Format.formatter -> target -> unitval print : Format.formatter -> _ t -> unit