diff --git a/src/common.rs b/src/common.rs
index c86665c2..6bf5188d 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -366,6 +366,31 @@ pub enum FileFlags {
},
}
+/// Segment flags that are specific to each file format.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
+#[non_exhaustive]
+pub enum SegmentFlags {
+ /// No segment flags.
+ None,
+ /// ELF segment flags.
+ Elf {
+ /// `p_flags` field in the segment header.
+ p_flags: u32,
+ },
+ /// Mach-O segment flags.
+ MachO {
+ /// `maxprot` field in the segment header.
+ maxprot: u32,
+ /// `initprot` field in the segment header.
+ initprot: u32,
+ },
+ /// COFF segment flags.
+ Coff {
+ /// `Characteristics` field in the segment header.
+ characteristics: u32,
+ },
+}
+
/// Section flags that are specific to each file format.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
diff --git a/src/read/any.rs b/src/read/any.rs
index ce99bc31..02e76dcd 100644
--- a/src/read/any.rs
+++ b/src/read/any.rs
@@ -16,8 +16,8 @@ use crate::read::{
self, Architecture, BinaryFormat, CodeView, ComdatKind, CompressedData, CompressedFileRange,
Error, Export, FileFlags, FileKind, Import, Object, ObjectComdat, ObjectKind, ObjectMap,
ObjectSection, ObjectSegment, ObjectSymbol, ObjectSymbolTable, ReadRef, Relocation, Result,
- SectionFlags, SectionIndex, SectionKind, SymbolFlags, SymbolIndex, SymbolKind, SymbolMap,
- SymbolMapName, SymbolScope, SymbolSection,
+ SectionFlags, SectionIndex, SectionKind, SegmentFlags, SymbolFlags, SymbolIndex, SymbolKind,
+ SymbolMap, SymbolMapName, SymbolScope, SymbolSection,
};
#[allow(unused_imports)]
use crate::{AddressSize, Endian, Endianness};
@@ -563,6 +563,10 @@ impl<'data, 'file, R: ReadRef<'data>> ObjectSegment<'data> for Segment<'data, 'f
fn name(&self) -> Result