pub struct Object<'a> {
    pub flags: FileFlags,
    pub mangling: Mangling,
    /* private fields */
}
Expand description

A writable object file.

Fields

flags: FileFlags

File flags that are specific to each file format.

mangling: Mangling

The symbol name mangling scheme.

Implementations

Appends linker directives to the .drectve section to tell the linker to export all symbols with SymbolScope::Dynamic.

This must be called after all symbols have been defined.

Create an empty object file.

Return the file format.

Return the architecture.

Return the current mangling setting.

Specify the mangling setting.

Return the name for a standard segment.

This will vary based on the file format.

Get the section with the given SectionId.

Mutably get the section with the given SectionId.

Set the data for an existing section.

Must not be called for sections that already have data, or that contain uninitialized data.

Append data to an existing section. Returns the section offset of the data.

Append zero-initialized data to an existing section. Returns the section offset of the data.

Return the SectionId of a standard section.

If the section doesn’t already exist then it is created.

Add a new section and return its SectionId.

This also creates a section symbol.

Add a subsection. Returns the SectionId and section offset of the data.

Get the COMDAT section group with the given ComdatId.

Mutably get the COMDAT section group with the given ComdatId.

Add a new COMDAT section group and return its ComdatId.

Get the SymbolId of the symbol with the given name.

Get the symbol with the given SymbolId.

Mutably get the symbol with the given SymbolId.

Add a new symbol and return its SymbolId.

Return true if the file format supports StandardSection::UninitializedTls.

Return true if the file format supports StandardSection::Common.

Add a new common symbol and return its SymbolId.

For Mach-O, this appends the symbol to the __common section.

Add a new file symbol and return its SymbolId.

Get the symbol for a section.

Append data to an existing section, and update a symbol to refer to it.

For Mach-O, this also creates a __thread_vars entry for TLS symbols, and the symbol will indirectly point to the added data via the __thread_vars entry.

Returns the section offset of the data.

Append zero-initialized data to an existing section, and update a symbol to refer to it.

For Mach-O, this also creates a __thread_vars entry for TLS symbols, and the symbol will indirectly point to the added data via the __thread_vars entry.

Returns the section offset of the data.

Update a symbol to refer to the given data within a section.

For Mach-O, this also creates a __thread_vars entry for TLS symbols, and the symbol will indirectly point to the data via the __thread_vars entry.

Convert a symbol to a section symbol and offset.

Returns None if the symbol does not have a section.

Add a relocation to a section.

Relocations must only be added after the referenced symbols have been added and defined (if applicable).

Write the object to a Vec.

Write the object to a Write implementation.

Also flushes the writer.

It is advisable to use a buffered writer like BufWriter instead of an unbuffered writer like File.

Write the object to a WritableBuffer.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.