mirror of
https://github.com/encounter/object.git
synced 2026-07-10 12:18:39 -07:00
OMF quality pass
- Format with rustfmt; fix clippy lints - Add module documentation - Reject invalid record types instead of silently skipping - Recognize the DWARF segment class as debug sections - Add read_core,omf to the feature test matrix
This commit is contained in:
@@ -7,7 +7,7 @@ use crate::read::{
|
||||
Object, ObjectKind, ObjectSection, ReadRef, Result, SectionIndex, SectionKind, SymbolIndex,
|
||||
SymbolKind,
|
||||
};
|
||||
use crate::{omf, SubArchitecture};
|
||||
use crate::{SubArchitecture, omf};
|
||||
|
||||
use super::{
|
||||
OmfComdat, OmfComdatData, OmfComdatIterator, OmfComdatSelection, OmfDataChunk, OmfFixup,
|
||||
@@ -282,7 +282,10 @@ impl<'data, R: ReadRef<'data>> OmfFile<'data, R> {
|
||||
break;
|
||||
}
|
||||
_ => {
|
||||
// Skip unknown record types
|
||||
if !omf::record_type::is_valid(record_type) {
|
||||
return Err(Error("Invalid OMF record type"));
|
||||
}
|
||||
// Skip unhandled record types (e.g. LINNUM, LINSYM)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-1
@@ -1,4 +1,16 @@
|
||||
//! Support for reading OMF files.
|
||||
//! Support for reading OMF (Relocatable Object Module Format) files.
|
||||
//!
|
||||
//! OMF is the object file format used by most DOS and early Windows
|
||||
//! compilers, such as Borland C++ and Open Watcom. Both 16-bit and 32-bit
|
||||
//! variants are supported, including vendor extensions such as COMDAT
|
||||
//! records and Borland virtual segments.
|
||||
//!
|
||||
//! [`OmfFile`] implements the [`Object`](crate::read::Object) trait for
|
||||
//! OMF files.
|
||||
//!
|
||||
//! OMF doesn't have a notion of sections; instead, data is contributed to
|
||||
//! segments (`SEGDEF`) and COMDATs. This implementation maps both to
|
||||
//! sections in the unified read API.
|
||||
|
||||
mod comdat;
|
||||
pub use comdat::*;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::read::ReadRef;
|
||||
use crate::{
|
||||
omf, Relocation, RelocationEncoding, RelocationFlags, RelocationKind, RelocationTarget,
|
||||
SectionIndex,
|
||||
Relocation, RelocationEncoding, RelocationFlags, RelocationKind, RelocationTarget,
|
||||
SectionIndex, omf,
|
||||
};
|
||||
|
||||
use super::{FrameMethod, OmfFile, TargetMethod};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use crate::read::{self, Error, ObjectSegment, ReadRef, Result, SectionKind};
|
||||
use crate::{omf, Permissions, SegmentFlags};
|
||||
use crate::{Permissions, SegmentFlags, omf};
|
||||
|
||||
use super::{expand_iterated_data, iterated_data_expanded_len, OmfFile, OmfFixup};
|
||||
use super::{OmfFile, OmfFixup, expand_iterated_data, iterated_data_expanded_len};
|
||||
|
||||
/// A section in an OMF file.
|
||||
///
|
||||
|
||||
@@ -130,6 +130,7 @@ fn cmd_features() -> Result<(), DynError> {
|
||||
"read_core,write_core,coff",
|
||||
"read_core,write_core,build_core,elf",
|
||||
"read_core,write_core,macho",
|
||||
"read_core,omf",
|
||||
"read_core,write_core,pe",
|
||||
"read_core,write_core,xcoff",
|
||||
"read_core,wasm",
|
||||
|
||||
Reference in New Issue
Block a user