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§
- Section
Table - The table of section headers in an XCOFF file.
- Symbol
Iterator - An iterator for symbol entries in an XCOFF file.
- Symbol
Table - A table of symbol entries in an XCOFF file.
- Xcoff
Comdat - A COMDAT section group in a
XcoffFile. - Xcoff
Comdat Iterator - An iterator for the COMDAT section groups in a
XcoffFile. - Xcoff
Comdat Section Iterator - An iterator for the sections in a COMDAT section group in a
XcoffFile. - Xcoff
File - A partially parsed XCOFF file.
- Xcoff
Relocation Iterator - An iterator for the relocations in an
XcoffSection. - Xcoff
Section - A section in an
XcoffFile. - Xcoff
Section Iterator - An iterator for the sections in an
XcoffFile. - Xcoff
Segment - A loadable section in an
XcoffFile. - Xcoff
Segment Iterator - An iterator for the segments in an
XcoffFile. - Xcoff
Symbol - A symbol in an
XcoffFile. - Xcoff
Symbol Iterator - An iterator for the symbols in an
XcoffFile. - Xcoff
Symbol Table - A symbol table in an
XcoffFile.
Traits§
- AuxHeader
- A trait for generic access to
xcoff::AuxHeader32andxcoff::AuxHeader64. - Csect
Aux - A trait for generic access to
xcoff::CsectAux32andxcoff::CsectAux64. - FileAux
- A trait for generic access to
xcoff::FileAux32andxcoff::FileAux64. - File
Header - A trait for generic access to
xcoff::FileHeader32andxcoff::FileHeader64. - Rel
- A trait for generic access to
xcoff::Rel32andxcoff::Rel64. - Section
Header - A trait for generic access to
xcoff::SectionHeader32andxcoff::SectionHeader64. - Symbol
- A trait for generic access to
xcoff::Symbol32andxcoff::Symbol64.
Type Aliases§
- Xcoff
Comdat32 - A COMDAT section group in a
XcoffFile32. - Xcoff
Comdat64 - A COMDAT section group in a
XcoffFile64. - Xcoff
Comdat Iterator32 - An iterator for the COMDAT section groups in a
XcoffFile32. - Xcoff
Comdat Iterator64 - An iterator for the COMDAT section groups in a
XcoffFile64. - Xcoff
Comdat Section Iterator32 - An iterator for the sections in a COMDAT section group in a
XcoffFile32. - Xcoff
Comdat Section Iterator64 - An iterator for the sections in a COMDAT section group in a
XcoffFile64. - Xcoff
File32 - A 32-bit XCOFF object file.
- Xcoff
File64 - A 64-bit XCOFF object file.
- Xcoff
Relocation Iterator32 - An iterator for the relocations in an
XcoffSection32. - Xcoff
Relocation Iterator64 - An iterator for the relocations in an
XcoffSection64. - Xcoff
Section32 - A section in an
XcoffFile32. - Xcoff
Section64 - A section in an
XcoffFile64. - Xcoff
Section Iterator32 - An iterator for the sections in an
XcoffFile32. - Xcoff
Section Iterator64 - An iterator for the sections in an
XcoffFile64. - Xcoff
Segment32 - A segment in an
XcoffFile32. - Xcoff
Segment64 - A segment in an
XcoffFile64. - Xcoff
Segment Iterator32 - An iterator for the segments in an
XcoffFile32. - Xcoff
Segment Iterator64 - An iterator for the segments in an
XcoffFile64. - Xcoff
Symbol32 - A symbol in an
XcoffFile32. - Xcoff
Symbol64 - A symbol in an
XcoffFile64. - Xcoff
Symbol Iterator32 - An iterator for the symbols in an
XcoffFile32. - Xcoff
Symbol Iterator64 - An iterator for the symbols in an
XcoffFile64. - Xcoff
Symbol Table32 - A symbol table in an
XcoffFile32. - Xcoff
Symbol Table64 - A symbol table in an
XcoffFile64.