pub struct ObjectFile { /* private fields */ }
Expand description
An object file.
This is the final product after assembly source code is fully assembled. This can be loaded in the simulator to run the assembled code.
Implementations§
Source§impl ObjectFile
impl ObjectFile
Sourcepub fn link(a_obj: Self, b_obj: Self) -> Result<Self, AsmErr>
pub fn link(a_obj: Self, b_obj: Self) -> Result<Self, AsmErr>
Links two object files, combining them into one.
The linking algorithm is as follows:
- The list of regions in both object files are merged into one.
- Overlaps between regions are checked. If any are found, error.
- For every symbol in the symbol table, this is added to the new symbol table.
- If any symbols appear more than once in different locations (and neither are external), error (duplicate labels).
- If any symbols appear more than once in different locations (and one is external), pull out any relocation entries (from
.LINKER_INFO
) for the external and match them.
- Merge the remaining relocation table entries.
Sourcepub fn addr_iter(&self) -> impl Iterator<Item = (u16, Option<u16>)> + '_
pub fn addr_iter(&self) -> impl Iterator<Item = (u16, Option<u16>)> + '_
Gets an iterator over all of the memory locations defined in the object file.
Sourcepub fn symbol_table(&self) -> Option<&SymbolTable>
pub fn symbol_table(&self) -> Option<&SymbolTable>
Gets the symbol table if it is present in the object file.
Trait Implementations§
Source§impl Clone for ObjectFile
impl Clone for ObjectFile
Source§fn clone(&self) -> ObjectFile
fn clone(&self) -> ObjectFile
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ObjectFile
impl Debug for ObjectFile
Source§impl PartialEq for ObjectFile
impl PartialEq for ObjectFile
impl Eq for ObjectFile
impl StructuralPartialEq for ObjectFile
Auto Trait Implementations§
impl Freeze for ObjectFile
impl RefUnwindSafe for ObjectFile
impl Send for ObjectFile
impl Sync for ObjectFile
impl Unpin for ObjectFile
impl UnwindSafe for ObjectFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more