[−][src]Struct object::write::Object
A writable object file.
Fields
mangling: Mangling
The symbol name mangling scheme.
Methods
impl Object
[src]
pub fn new(format: BinaryFormat, architecture: Architecture) -> Object
[src]
Create an empty object file.
pub fn format(&self) -> BinaryFormat
[src]
Return the file format.
pub fn architecture(&self) -> Architecture
[src]
Return the architecture.
pub fn mangling(&self) -> Mangling
[src]
Return the current mangling setting.
pub fn set_mangling(&mut self, mangling: Mangling)
[src]
Return the current mangling setting.
pub fn segment_name(&self, segment: StandardSegment) -> &'static [u8]
[src]
Return the name for a standard segment.
This will vary based on the file format.
pub fn section(&self, section: SectionId) -> &Section
[src]
Get the section with the given SectionId
.
pub fn section_mut(&mut self, section: SectionId) -> &mut Section
[src]
Mutably get the section with the given SectionId
.
pub fn append_section_data(
&mut self,
section: SectionId,
data: &[u8],
align: u64
) -> u64
[src]
&mut self,
section: SectionId,
data: &[u8],
align: u64
) -> u64
Append data to an existing section. Returns the section offset of the data.
pub fn append_section_bss(
&mut self,
section: SectionId,
size: u64,
align: u64
) -> u64
[src]
&mut self,
section: SectionId,
size: u64,
align: u64
) -> u64
Append zero-initialized data to an existing section. Returns the section offset of the data.
pub fn section_id(&mut self, section: StandardSection) -> SectionId
[src]
Return the SectionId
of a standard section.
If the section doesn't already exist then it is created.
pub fn add_section(
&mut self,
segment: Vec<u8>,
name: Vec<u8>,
kind: SectionKind
) -> SectionId
[src]
&mut self,
segment: Vec<u8>,
name: Vec<u8>,
kind: SectionKind
) -> SectionId
Add a new section and return its SectionId
.
This also creates a section symbol.
pub fn add_subsection(
&mut self,
section: StandardSection,
name: &[u8],
data: &[u8],
align: u64
) -> (SectionId, u64)
[src]
&mut self,
section: StandardSection,
name: &[u8],
data: &[u8],
align: u64
) -> (SectionId, u64)
Add a subsection. Returns the SectionId
and section offset of the data.
pub fn symbol_id(&self, name: &[u8]) -> Option<SymbolId>
[src]
Get the SymbolId
of the symbol with the given name.
pub fn symbol(&self, symbol: SymbolId) -> &Symbol
[src]
Get the symbol with the given SymbolId
.
pub fn symbol_mut(&mut self, symbol: SymbolId) -> &mut Symbol
[src]
Mutably get the symbol with the given SymbolId
.
pub fn add_symbol(&mut self, symbol: Symbol) -> SymbolId
[src]
Add a new symbol and return its SymbolId
.
pub fn add_file_symbol(&mut self, name: Vec<u8>) -> SymbolId
[src]
Add a new file symbol and return its SymbolId
.
pub fn section_symbol(&mut self, section_id: SectionId) -> SymbolId
[src]
Get the symbol for a section.
pub fn add_symbol_data(
&mut self,
symbol: SymbolId,
section: SectionId,
data: &[u8],
align: u64
) -> u64
[src]
&mut self,
symbol: SymbolId,
section: SectionId,
data: &[u8],
align: u64
) -> u64
Append data to an existing section, and update a symbol to refer to it.
Returns the section offset of the data.
pub fn symbol_section_and_offset(
&mut self,
symbol_id: SymbolId
) -> Result<(SymbolId, u64), ()>
[src]
&mut self,
symbol_id: SymbolId
) -> Result<(SymbolId, u64), ()>
Convert a symbol to a section symbol and offset.
Returns an error if the symbol is not defined.
pub fn add_relocation(
&mut self,
section: SectionId,
relocation: Relocation
) -> Result<(), String>
[src]
&mut self,
section: SectionId,
relocation: Relocation
) -> Result<(), String>
Add a relocation to a section.
Relocations must only be added after the referenced symbols have been added and defined (if applicable).
pub fn write(&self) -> Result<Vec<u8>, String>
[src]
Write the object to a Vec
.
Trait Implementations
Auto Trait Implementations
impl Unpin for Object
impl Send for Object
impl Sync for Object
impl UnwindSafe for Object
impl RefUnwindSafe for Object
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,