1//! Support for reading AIX XCOFF files.
2//!
3//! Traits are used to abstract over the difference between 32-bit and 64-bit XCOFF.
4//! The primary trait for this is [`FileHeader`].
5//!
6//! ## High level API
7//!
8//! [`XcoffFile`] implements the [`Object`](crate::read::Object) trait for XCOFF files.
9//! [`XcoffFile`] is parameterised by [`FileHeader`] to allow reading both 32-bit and
10//! 64-bit XCOFF. There are type aliases for these parameters ([`XcoffFile32`] and
11//! [`XcoffFile64`]).
12//!
13//! ## Low level API
14//!
15//! The [`FileHeader`] trait can be directly used to parse both [`xcoff::FileHeader32`]
16//! and [`xcoff::FileHeader64`].
17//!
18//! ### Example for low level API
19//! ```no_run
20//! use object::xcoff;
21//! use object::read::xcoff::{FileHeader, SectionHeader, Symbol};
22//! use std::error::Error;
23//! use std::fs;
24//!
25//! /// Reads a file and displays the name of each section and symbol.
26//! fn main() -> Result<(), Box<dyn Error>> {
27//! # #[cfg(feature = "std")] {
28//! let data = fs::read("path/to/binary")?;
29//! let mut offset = 0;
30//! let header = xcoff::FileHeader64::parse(&*data, &mut offset)?;
31//! let aux_header = header.aux_header(&*data, &mut offset)?;
32//! let sections = header.sections(&*data, &mut offset)?;
33//! let symbols = header.symbols(&*data)?;
34//! for section in sections.iter() {
35//! println!("{}", String::from_utf8_lossy(section.name()));
36//! }
37//! for (_index, symbol) in symbols.iter() {
38//! println!("{}", String::from_utf8_lossy(symbol.name(symbols.strings())?));
39//! }
40//! # }
41//! Ok(())
42//! }
43//! ```
44#[cfg(doc)]
45use crate::xcoff;
46
47mod file;
48pub use file::*;
49
50mod section;
51pub use section::*;
52
53mod symbol;
54pub use symbol::*;
55
56mod relocation;
57pub use relocation::*;
58
59mod comdat;
60pub use comdat::*;
61
62mod segment;
63pub use segment::*;
64