pub struct ElfBuilder { /* private fields */ }Expand description
ELF file builder
Implementations§
Source§impl ElfBuilder
impl ElfBuilder
Sourcepub fn with_thumb_funcs(self, thumb: bool) -> Self
pub fn with_thumb_funcs(self, thumb: bool) -> Self
#598: mark the object’s functions as A32-encoded (cortex-r5 path) —
suppresses the Thumb interworking bit on STT_FUNC st_values and on
e_entry. Call BEFORE with_entry.
Sourcepub fn with_entry(self, entry: u32) -> Self
pub fn with_entry(self, entry: u32) -> Self
Set entry point
For ARM Thumb targets, bit 0 is automatically set to indicate Thumb mode.
Cortex-M is Thumb-only, so function addresses in ELF must have bit 0 set.
A32 objects (with_thumb_funcs(false), #598) keep bit 0 clear.
Sourcepub fn add_section(&mut self, section: Section)
pub fn add_section(&mut self, section: Section)
Add a section
Sourcepub fn add_symbol(&mut self, symbol: Symbol)
pub fn add_symbol(&mut self, symbol: Symbol)
Add a symbol
Sourcepub fn add_symbol_indexed(&mut self, symbol: Symbol) -> u32
pub fn add_symbol_indexed(&mut self, symbol: Symbol) -> u32
Add a symbol and return its 1-based index in .symtab (index 0 is the
reserved null symbol). Use when a later relocation must reference this
symbol — e.g. the .text base symbol the DWARF .rel.debug_* records
resolve against (VCR-DBG-001).
Sourcepub fn add_program_header(&mut self, ph: ProgramHeader)
pub fn add_program_header(&mut self, ph: ProgramHeader)
Add a program header (segment)
Sourcepub fn add_relocation(&mut self, reloc: Relocation)
pub fn add_relocation(&mut self, reloc: Relocation)
Add a relocation entry for the .text section
Sourcepub fn add_section_relocations(
&mut self,
target_section: &str,
relocs: Vec<Relocation>,
)
pub fn add_section_relocations( &mut self, target_section: &str, relocs: Vec<Relocation>, )
Add a relocation table targeting a non-.text section by name (e.g.
.debug_line). Produces a separate .rel.<name> section whose sh_info
points at the named section. The section must already have been added via
[add_section]; if no matching section exists at build time the table is
silently dropped. Used by VCR-DBG-001 to relocate the DWARF .text
references so a host linker fixes them up alongside .text.
Sourcepub fn add_undefined_symbol(&mut self, name: &str) -> u32
pub fn add_undefined_symbol(&mut self, name: &str) -> u32
Add an undefined external symbol (e.g., __meld_dispatch_import) Returns the symbol index (1-based, accounting for null symbol)