Crate object

source ·
Expand description

object

The object crate provides a unified interface to working with object files across platforms. It supports reading relocatable object files and executable files, and writing relocatable object files and some executable files.

Raw struct definitions

Raw structs are defined for: ELF, Mach-O, PE/COFF, XCOFF, archive. Types and traits for zerocopy support are defined in the pod and endian modules.

Unified read API

The read module provides a unified read API using the read::Object trait. There is an implementation of this trait for read::File, which allows reading any file format, as well as implementations for each file format.

Low level read API

The read submodules define helpers that operate on the raw structs. These can be used instead of the unified API, or in conjunction with it to access details that are not available via the unified API.

Unified write API

The [mod@write] module provides a unified write API for relocatable object files using [write::Object]. This does not support writing executable files.

Low level write API

The [mod@write#modules] submodules define helpers for writing the raw structs.

Shared definitions

The crate provides a number of definitions that are used by both the read and write APIs. These are defined at the top level module, but none of these are the main entry points of the crate.

Re-exports

Modules

  • Archive definitions.
  • ELF definitions.
  • Types for compile-time and run-time endianness.
  • Mach-O definitions.
  • PE/COFF definitions.
  • Tools for converting file format structures to and from bytes.
  • Interface for reading object files.

Enums