Module xcoff

Source
Expand description

Support for reading AIX XCOFF files.

Traits are used to abstract over the difference between 32-bit and 64-bit XCOFF. The primary trait for this is FileHeader.

§High level API

XcoffFile implements the Object trait for XCOFF files. XcoffFile is parameterised by FileHeader to allow reading both 32-bit and 64-bit XCOFF. There are type aliases for these parameters (XcoffFile32 and XcoffFile64).

§Low level API

The FileHeader trait can be directly used to parse both xcoff::FileHeader32 and xcoff::FileHeader64.

§Example for low level API

use object::xcoff;
use object::read::xcoff::{FileHeader, SectionHeader, Symbol};
use std::error::Error;
use std::fs;

/// Reads a file and displays the name of each section and symbol.
fn main() -> Result<(), Box<dyn Error>> {
   let data = fs::read("path/to/binary")?;
   let mut offset = 0;
   let header = xcoff::FileHeader64::parse(&*data, &mut offset)?;
   let aux_header = header.aux_header(&*data, &mut offset)?;
   let sections = header.sections(&*data, &mut offset)?;
   let symbols = header.symbols(&*data)?;
   for section in sections.iter() {
       println!("{}", String::from_utf8_lossy(section.name()));
   }
   for (_index, symbol) in symbols.iter() {
       println!("{}", String::from_utf8_lossy(symbol.name(symbols.strings())?));
   }
   Ok(())
}

Structs§

SectionTable
The table of section headers in an XCOFF file.
SymbolIterator
An iterator for symbol entries in an XCOFF file.
SymbolTable
A table of symbol entries in an XCOFF file.
XcoffComdat
A COMDAT section group in a XcoffFile.
XcoffComdatIterator
An iterator for the COMDAT section groups in a XcoffFile.
XcoffComdatSectionIterator
An iterator for the sections in a COMDAT section group in a XcoffFile.
XcoffFile
A partially parsed XCOFF file.
XcoffRelocationIterator
An iterator for the relocations in an XcoffSection.
XcoffSection
A section in an XcoffFile.
XcoffSectionIterator
An iterator for the sections in an XcoffFile.
XcoffSegment
A loadable section in an XcoffFile.
XcoffSegmentIterator
An iterator for the segments in an XcoffFile.
XcoffSymbol
A symbol in an XcoffFile.
XcoffSymbolIterator
An iterator for the symbols in an XcoffFile.
XcoffSymbolTable
A symbol table in an XcoffFile.

Traits§

AuxHeader
A trait for generic access to xcoff::AuxHeader32 and xcoff::AuxHeader64.
CsectAux
A trait for generic access to xcoff::CsectAux32 and xcoff::CsectAux64.
FileAux
A trait for generic access to xcoff::FileAux32 and xcoff::FileAux64.
FileHeader
A trait for generic access to xcoff::FileHeader32 and xcoff::FileHeader64.
Rel
A trait for generic access to xcoff::Rel32 and xcoff::Rel64.
SectionHeader
A trait for generic access to xcoff::SectionHeader32 and xcoff::SectionHeader64.
Symbol
A trait for generic access to xcoff::Symbol32 and xcoff::Symbol64.

Type Aliases§

XcoffComdat32
A COMDAT section group in a XcoffFile32.
XcoffComdat64
A COMDAT section group in a XcoffFile64.
XcoffComdatIterator32
An iterator for the COMDAT section groups in a XcoffFile32.
XcoffComdatIterator64
An iterator for the COMDAT section groups in a XcoffFile64.
XcoffComdatSectionIterator32
An iterator for the sections in a COMDAT section group in a XcoffFile32.
XcoffComdatSectionIterator64
An iterator for the sections in a COMDAT section group in a XcoffFile64.
XcoffFile32
A 32-bit XCOFF object file.
XcoffFile64
A 64-bit XCOFF object file.
XcoffRelocationIterator32
An iterator for the relocations in an XcoffSection32.
XcoffRelocationIterator64
An iterator for the relocations in an XcoffSection64.
XcoffSection32
A section in an XcoffFile32.
XcoffSection64
A section in an XcoffFile64.
XcoffSectionIterator32
An iterator for the sections in an XcoffFile32.
XcoffSectionIterator64
An iterator for the sections in an XcoffFile64.
XcoffSegment32
A segment in an XcoffFile32.
XcoffSegment64
A segment in an XcoffFile64.
XcoffSegmentIterator32
An iterator for the segments in an XcoffFile32.
XcoffSegmentIterator64
An iterator for the segments in an XcoffFile64.
XcoffSymbol32
A symbol in an XcoffFile32.
XcoffSymbol64
A symbol in an XcoffFile64.
XcoffSymbolIterator32
An iterator for the symbols in an XcoffFile32.
XcoffSymbolIterator64
An iterator for the symbols in an XcoffFile64.
XcoffSymbolTable32
A symbol table in an XcoffFile32.
XcoffSymbolTable64
A symbol table in an XcoffFile64.