Expand description
Represents an ELF file under construction.
Implementations§
source§impl<W> Builder<W>where
W: Write + Seek,
impl<W> Builder<W>where
W: Write + Seek,
pub fn set_section_name(&mut self, name: impl AsRef<str>)
sourcepub fn add_symbol<S: Into<String>, R: Read>(
&mut self,
name: S,
src: R
) -> Result<Symbol>
pub fn add_symbol<S: Into<String>, R: Read>(
&mut self,
name: S,
src: R
) -> Result<Symbol>
Define a new symbol in the output file, using the contents of a given reader as the symbol contents.
add_symbol
will read the given reader to completion and copy all of
its data into the output file.
add_symbol
doesn’t check if you define the same symbol name more than
once, but doing so will create a confusing object file that may not
be accepted by an ELF linker.
This function aligns the data to the word size of the destination ELF
file. Use add_symbol_align
instead if you need specific alignment.
sourcepub fn add_symbol_align<S: Into<String>, R: Read>(
&mut self,
name: S,
alignment: usize,
src: R
) -> Result<Symbol>
pub fn add_symbol_align<S: Into<String>, R: Read>(
&mut self,
name: S,
alignment: usize,
src: R
) -> Result<Symbol>
Define a new symbol in the output file with a particular alignment, using the contents of a given reader as the symbol contents.
add_symbol_align
will read the given reader to completion and copy
all of its data into the output file.
add_symbol_align
doesn’t check if you define the same symbol name
more than once, but doing so will create a confusing object file that
may not be accepted by an ELF linker.
sourcepub fn close(self) -> Result<W>
pub fn close(self) -> Result<W>
Finalizes the ELF metadata in the underlying file and then returns that file.
If you don’t call close
then the file will be left in a state where
it contains any symbol data written previously but it lacks the
necessary metadata for an ELF linker to find that data, and thus the
object file will appear to have no symbols at all.