mirror of
https://github.com/encounter/object.git
synced 2026-07-10 12:18:39 -07:00
Adapt OMF to upstream API changes (permissions, subtractor)
This commit is contained in:
@@ -136,6 +136,7 @@ impl<'data, 'file, R: ReadRef<'data>> Iterator for OmfRelocationIterator<'data,
|
||||
target,
|
||||
addend: (reloc.target_displacement as i64) + base_addend,
|
||||
implicit_addend: false,
|
||||
subtractor: None,
|
||||
flags: RelocationFlags::Omf {
|
||||
location: reloc.location,
|
||||
mode: if reloc.is_segment_relative {
|
||||
|
||||
+14
-2
@@ -1,7 +1,7 @@
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use crate::read::{self, ObjectSegment, ReadRef, Result};
|
||||
use crate::{omf, SegmentFlags};
|
||||
use crate::read::{self, ObjectSegment, ReadRef, Result, SectionKind};
|
||||
use crate::{omf, Permissions, SegmentFlags};
|
||||
|
||||
use super::{OmfFile, OmfFixup};
|
||||
|
||||
@@ -126,6 +126,18 @@ impl<'data, 'file, R: ReadRef<'data>> ObjectSegment<'data> for OmfSegmentRef<'da
|
||||
fn flags(&self) -> SegmentFlags {
|
||||
SegmentFlags::None
|
||||
}
|
||||
|
||||
fn permissions(&self) -> Permissions {
|
||||
// OMF segment definitions don't carry permission flags, so derive them
|
||||
// from the segment's class name.
|
||||
match self.file.segment_section_kind(self.index) {
|
||||
SectionKind::Text => Permissions::new(true, false, true),
|
||||
SectionKind::ReadOnlyData | SectionKind::ReadOnlyString | SectionKind::Debug => {
|
||||
Permissions::new(true, false, false)
|
||||
}
|
||||
_ => Permissions::new(true, true, false),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// An iterator over OMF segments.
|
||||
|
||||
Reference in New Issue
Block a user