pub trait TextSectionBuilder {
    fn append(&mut self, labeled: bool, data: &[u8], align: Option<u32>) -> u64;
    fn resolve_reloc(
        &mut self,
        offset: u64,
        reloc: Reloc,
        addend: Addend,
        target: u32
    ) -> bool; fn force_veneers(&mut self); fn finish(&mut self) -> Vec<u8>; }
Expand description

An object that can be used to create the text section of an executable.

This primarily handles resolving relative relocations at text-section-assembly time rather than at load/link time. This architecture-specific logic is sort of like a linker, but only for one object file at a time.

Required Methods

Appends data to the text section with the align specified.

If labeled is true then the offset of the final data is used to resolve relocations in resolve_reloc in the future.

This function returns the offset at which the data was placed in the text section.

Attempts to resolve a relocation for this function.

The offset is the offset of the relocation, within the text section. The reloc is the kind of relocation. The addend is the value to add to the relocation. The target is the labeled function that is the target of this relocation.

Labeled functions are created with the append function above by setting the labeled parameter to true.

If this builder does not know how to handle reloc then this function will return false. Otherwise this function will return true and this relocation will be resolved in the final bytes returned by finish.

A debug-only option which is used to for

Completes this text section, filling out any final details, and returns the bytes of the text section.

Implementors