From f2662884b88233e3b754d68a64133052959d20fc Mon Sep 17 00:00:00 2001 From: everettjf Date: Wed, 29 Dec 2021 10:03:45 +0800 Subject: [PATCH 1/4] Add unified rwe_flags (SEGMENT_RWE_FLAG_READ | SEGMENT_RWE_FLAG_WRITE | SEGMENT_RWE_FLAG_EXECUTE) for ObjectSegment --- crates/examples/src/bin/segments.rs | 61 +++++++++++++++++++++++++++++ src/common.rs | 7 ++++ src/read/any.rs | 4 ++ src/read/coff/section.rs | 17 ++++++++ src/read/elf/segment.rs | 17 ++++++++ src/read/macho/segment.rs | 17 ++++++++ src/read/pe/section.rs | 17 ++++++++ src/read/traits.rs | 7 ++++ 8 files changed, 147 insertions(+) create mode 100644 crates/examples/src/bin/segments.rs diff --git a/crates/examples/src/bin/segments.rs b/crates/examples/src/bin/segments.rs new file mode 100644 index 00000000..d81f965d --- /dev/null +++ b/crates/examples/src/bin/segments.rs @@ -0,0 +1,61 @@ +use object::{ + Object, ObjectSegment, SEGMENT_RWE_FLAG_EXECUTE, SEGMENT_RWE_FLAG_READ, SEGMENT_RWE_FLAG_WRITE, +}; +use std::{env, fs, process}; + +fn main() { + let mut args = env::args().skip(1); + if args.len() < 1 { + eprintln!("Usage: {} ", env::args().next().unwrap()); + process::exit(1); + } + + let file_path = args.next().unwrap(); + + let file = match fs::File::open(&file_path) { + Ok(file) => file, + Err(err) => { + println!("Failed to open file '{}': {}", file_path, err,); + return; + } + }; + let file = match unsafe { memmap2::Mmap::map(&file) } { + Ok(mmap) => mmap, + Err(err) => { + println!("Failed to map file '{}': {}", file_path, err,); + return; + } + }; + + match object::File::parse(&*file) { + Ok(object) => print_segments(&object), + Err(err) => { + println!("Failed to parse file segments '{}': {}", file_path, err,); + return; + } + }; +} + +fn print_segments(object: &object::File) { + for segment in object.segments() { + println!("-------------------------"); + println!( + "name = {}", + segment.name().unwrap_or_default().unwrap_or_default() + ); + println!("address = 0x{:016x}", segment.address()); + println!("size = {}", segment.size()); + println!("file range = {:?}", segment.file_range()); + let rwe_flag = segment.rwe_flags(); + println!("rwe flags = {}", rwe_flag); + if rwe_flag & SEGMENT_RWE_FLAG_READ > 0 { + println!(" - Read"); + } + if rwe_flag & SEGMENT_RWE_FLAG_WRITE > 0 { + println!(" - Write"); + } + if rwe_flag & SEGMENT_RWE_FLAG_EXECUTE > 0 { + println!(" - Execute"); + } + } +} diff --git a/src/common.rs b/src/common.rs index c86665c2..9ef96a77 100644 --- a/src/common.rs +++ b/src/common.rs @@ -415,3 +415,10 @@ pub enum SymbolFlags
{ associative_section: Option
, }, } + +/// Unified segment rwe_flag of read permission +pub const SEGMENT_RWE_FLAG_READ: u32 = 0x01; +/// Unified segment rwe_flag of write permission +pub const SEGMENT_RWE_FLAG_WRITE: u32 = 0x02; +/// Unified segment rwe_flag of execute permission +pub const SEGMENT_RWE_FLAG_EXECUTE: u32 = 0x04; diff --git a/src/read/any.rs b/src/read/any.rs index ce99bc31..7c9bc25b 100644 --- a/src/read/any.rs +++ b/src/read/any.rs @@ -563,6 +563,10 @@ impl<'data, 'file, R: ReadRef<'data>> ObjectSegment<'data> for Segment<'data, 'f fn name(&self) -> Result> { with_inner!(self.inner, SegmentInternal, |x| x.name()) } + + fn rwe_flags(&self) -> u32 { + with_inner!(self.inner, SegmentInternal, |x| x.rwe_flags()) + } } /// An iterator of the sections of a `File`. diff --git a/src/read/coff/section.rs b/src/read/coff/section.rs index cb2edec9..39eb5b29 100644 --- a/src/read/coff/section.rs +++ b/src/read/coff/section.rs @@ -8,6 +8,7 @@ use crate::read::{ self, CompressedData, CompressedFileRange, Error, ObjectSection, ObjectSegment, ReadError, ReadRef, Result, SectionFlags, SectionIndex, SectionKind, }; +use crate::{SEGMENT_RWE_FLAG_EXECUTE, SEGMENT_RWE_FLAG_READ, SEGMENT_RWE_FLAG_WRITE}; use super::{CoffFile, CoffRelocationIterator}; @@ -189,6 +190,22 @@ impl<'data, 'file, R: ReadRef<'data>> ObjectSegment<'data> for CoffSegment<'data .read_error("Non UTF-8 COFF section name") .map(Some) } + + #[inline] + fn rwe_flags(&self) -> u32 { + let value = self.section.characteristics.get(LE); + let mut flag = 0; + if value & pe::IMAGE_SCN_MEM_READ > 0 { + flag |= SEGMENT_RWE_FLAG_READ; + } + if value & pe::IMAGE_SCN_MEM_WRITE > 0 { + flag |= SEGMENT_RWE_FLAG_WRITE + } + if value & pe::IMAGE_SCN_MEM_EXECUTE > 0 { + flag |= SEGMENT_RWE_FLAG_EXECUTE; + } + flag + } } /// An iterator over the sections of a `CoffFile`. diff --git a/src/read/elf/segment.rs b/src/read/elf/segment.rs index a64a4ba5..fa45a1ec 100644 --- a/src/read/elf/segment.rs +++ b/src/read/elf/segment.rs @@ -5,6 +5,7 @@ use crate::elf; use crate::endian::{self, Endianness}; use crate::pod::Pod; use crate::read::{self, Bytes, ObjectSegment, ReadError, ReadRef}; +use crate::{SEGMENT_RWE_FLAG_EXECUTE, SEGMENT_RWE_FLAG_READ, SEGMENT_RWE_FLAG_WRITE}; use super::{ElfFile, FileHeader, NoteIterator}; @@ -128,6 +129,22 @@ where fn name(&self) -> read::Result> { Ok(None) } + + #[inline] + fn rwe_flags(&self) -> u32 { + let value = self.segment.p_flags(self.file.endian); + let mut flag = 0; + if value & elf::PF_R > 0 { + flag |= SEGMENT_RWE_FLAG_READ; + } + if value & elf::PF_W > 0 { + flag |= SEGMENT_RWE_FLAG_WRITE + } + if value & elf::PF_X > 0 { + flag |= SEGMENT_RWE_FLAG_EXECUTE; + } + flag + } } /// A trait for generic access to `ProgramHeader32` and `ProgramHeader64`. diff --git a/src/read/macho/segment.rs b/src/read/macho/segment.rs index 3a09379d..16c30b8a 100644 --- a/src/read/macho/segment.rs +++ b/src/read/macho/segment.rs @@ -5,6 +5,7 @@ use crate::endian::{self, Endianness}; use crate::macho; use crate::pod::Pod; use crate::read::{self, ObjectSegment, ReadError, ReadRef, Result}; +use crate::{SEGMENT_RWE_FLAG_EXECUTE, SEGMENT_RWE_FLAG_READ, SEGMENT_RWE_FLAG_WRITE}; use super::{LoadCommandData, MachHeader, MachOFile, Section}; @@ -133,6 +134,22 @@ where .read_error("Non UTF-8 Mach-O segment name")?, )) } + + #[inline] + fn rwe_flags(&self) -> u32 { + let value = self.internal.segment.initprot(self.file.endian); + let mut flag = 0; + if value & macho::VM_PROT_READ > 0 { + flag |= SEGMENT_RWE_FLAG_READ; + } + if value & macho::VM_PROT_WRITE > 0 { + flag |= SEGMENT_RWE_FLAG_WRITE + } + if value & macho::VM_PROT_EXECUTE > 0 { + flag |= SEGMENT_RWE_FLAG_EXECUTE; + } + flag + } } #[derive(Debug, Clone, Copy)] diff --git a/src/read/pe/section.rs b/src/read/pe/section.rs index bc4a6e0c..f6ac8230 100644 --- a/src/read/pe/section.rs +++ b/src/read/pe/section.rs @@ -7,6 +7,7 @@ use crate::read::{ self, CompressedData, CompressedFileRange, ObjectSection, ObjectSegment, ReadError, ReadRef, Relocation, Result, SectionFlags, SectionIndex, SectionKind, }; +use crate::{SEGMENT_RWE_FLAG_EXECUTE, SEGMENT_RWE_FLAG_READ, SEGMENT_RWE_FLAG_WRITE}; use super::{ImageNtHeaders, PeFile, SectionTable}; @@ -123,6 +124,22 @@ where .read_error("Non UTF-8 PE section name")?, )) } + + #[inline] + fn rwe_flags(&self) -> u32 { + let value = self.section.characteristics.get(LE); + let mut flag = 0; + if value & pe::IMAGE_SCN_MEM_READ > 0 { + flag |= SEGMENT_RWE_FLAG_READ; + } + if value & pe::IMAGE_SCN_MEM_WRITE > 0 { + flag |= SEGMENT_RWE_FLAG_WRITE + } + if value & pe::IMAGE_SCN_MEM_EXECUTE > 0 { + flag |= SEGMENT_RWE_FLAG_EXECUTE; + } + flag + } } /// An iterator over the sections of a `PeFile32`. diff --git a/src/read/traits.rs b/src/read/traits.rs index 2581d497..2151850d 100644 --- a/src/read/traits.rs +++ b/src/read/traits.rs @@ -261,6 +261,13 @@ pub trait ObjectSegment<'data>: read::private::Sealed { /// /// Returns an error if the name is not UTF-8. fn name(&self) -> Result>; + + /// Return read/write/execute flag of segment. + /// + /// Returns 0 if none of r/w/e flags exist. + /// Otherwise returns value of + /// SEGMENT_RWE_FLAG_READ | SEGMENT_RWE_FLAG_WRITE | SEGMENT_RWE_FLAG_EXECUTE + fn rwe_flags(&self) -> u32; } /// A section defined in an object file. From fb883a488d98a55f2e17eebc01c52533317f33ca Mon Sep 17 00:00:00 2001 From: everettjf Date: Thu, 30 Dec 2021 23:54:36 +0800 Subject: [PATCH 2/4] introduce SegmentFlags for unified segment --- crates/examples/src/bin/segments.rs | 61 ----------------------------- src/common.rs | 32 +++++++++++---- src/read/any.rs | 8 ++-- src/read/coff/section.rs | 19 ++------- src/read/elf/segment.rs | 19 ++------- src/read/macho/segment.rs | 20 +++------- src/read/pe/section.rs | 19 ++------- src/read/traits.rs | 12 ++---- 8 files changed, 50 insertions(+), 140 deletions(-) delete mode 100644 crates/examples/src/bin/segments.rs diff --git a/crates/examples/src/bin/segments.rs b/crates/examples/src/bin/segments.rs deleted file mode 100644 index d81f965d..00000000 --- a/crates/examples/src/bin/segments.rs +++ /dev/null @@ -1,61 +0,0 @@ -use object::{ - Object, ObjectSegment, SEGMENT_RWE_FLAG_EXECUTE, SEGMENT_RWE_FLAG_READ, SEGMENT_RWE_FLAG_WRITE, -}; -use std::{env, fs, process}; - -fn main() { - let mut args = env::args().skip(1); - if args.len() < 1 { - eprintln!("Usage: {} ", env::args().next().unwrap()); - process::exit(1); - } - - let file_path = args.next().unwrap(); - - let file = match fs::File::open(&file_path) { - Ok(file) => file, - Err(err) => { - println!("Failed to open file '{}': {}", file_path, err,); - return; - } - }; - let file = match unsafe { memmap2::Mmap::map(&file) } { - Ok(mmap) => mmap, - Err(err) => { - println!("Failed to map file '{}': {}", file_path, err,); - return; - } - }; - - match object::File::parse(&*file) { - Ok(object) => print_segments(&object), - Err(err) => { - println!("Failed to parse file segments '{}': {}", file_path, err,); - return; - } - }; -} - -fn print_segments(object: &object::File) { - for segment in object.segments() { - println!("-------------------------"); - println!( - "name = {}", - segment.name().unwrap_or_default().unwrap_or_default() - ); - println!("address = 0x{:016x}", segment.address()); - println!("size = {}", segment.size()); - println!("file range = {:?}", segment.file_range()); - let rwe_flag = segment.rwe_flags(); - println!("rwe flags = {}", rwe_flag); - if rwe_flag & SEGMENT_RWE_FLAG_READ > 0 { - println!(" - Read"); - } - if rwe_flag & SEGMENT_RWE_FLAG_WRITE > 0 { - println!(" - Write"); - } - if rwe_flag & SEGMENT_RWE_FLAG_EXECUTE > 0 { - println!(" - Execute"); - } - } -} diff --git a/src/common.rs b/src/common.rs index 9ef96a77..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] @@ -415,10 +440,3 @@ pub enum SymbolFlags
{ associative_section: Option
, }, } - -/// Unified segment rwe_flag of read permission -pub const SEGMENT_RWE_FLAG_READ: u32 = 0x01; -/// Unified segment rwe_flag of write permission -pub const SEGMENT_RWE_FLAG_WRITE: u32 = 0x02; -/// Unified segment rwe_flag of execute permission -pub const SEGMENT_RWE_FLAG_EXECUTE: u32 = 0x04; diff --git a/src/read/any.rs b/src/read/any.rs index 7c9bc25b..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}; @@ -564,8 +564,8 @@ impl<'data, 'file, R: ReadRef<'data>> ObjectSegment<'data> for Segment<'data, 'f with_inner!(self.inner, SegmentInternal, |x| x.name()) } - fn rwe_flags(&self) -> u32 { - with_inner!(self.inner, SegmentInternal, |x| x.rwe_flags()) + fn flags(&self) -> SegmentFlags { + with_inner!(self.inner, SegmentInternal, |x| x.flags()) } } diff --git a/src/read/coff/section.rs b/src/read/coff/section.rs index 39eb5b29..731e37ca 100644 --- a/src/read/coff/section.rs +++ b/src/read/coff/section.rs @@ -6,9 +6,8 @@ use crate::pe; use crate::read::util::StringTable; use crate::read::{ self, CompressedData, CompressedFileRange, Error, ObjectSection, ObjectSegment, ReadError, - ReadRef, Result, SectionFlags, SectionIndex, SectionKind, + ReadRef, Result, SectionFlags, SectionIndex, SectionKind, SegmentFlags, }; -use crate::{SEGMENT_RWE_FLAG_EXECUTE, SEGMENT_RWE_FLAG_READ, SEGMENT_RWE_FLAG_WRITE}; use super::{CoffFile, CoffRelocationIterator}; @@ -192,19 +191,9 @@ impl<'data, 'file, R: ReadRef<'data>> ObjectSegment<'data> for CoffSegment<'data } #[inline] - fn rwe_flags(&self) -> u32 { - let value = self.section.characteristics.get(LE); - let mut flag = 0; - if value & pe::IMAGE_SCN_MEM_READ > 0 { - flag |= SEGMENT_RWE_FLAG_READ; - } - if value & pe::IMAGE_SCN_MEM_WRITE > 0 { - flag |= SEGMENT_RWE_FLAG_WRITE - } - if value & pe::IMAGE_SCN_MEM_EXECUTE > 0 { - flag |= SEGMENT_RWE_FLAG_EXECUTE; - } - flag + fn flags(&self) -> SegmentFlags { + let characteristics = self.section.characteristics.get(LE); + SegmentFlags::Coff { characteristics } } } diff --git a/src/read/elf/segment.rs b/src/read/elf/segment.rs index fa45a1ec..874ea92b 100644 --- a/src/read/elf/segment.rs +++ b/src/read/elf/segment.rs @@ -4,8 +4,7 @@ use core::{mem, slice, str}; use crate::elf; use crate::endian::{self, Endianness}; use crate::pod::Pod; -use crate::read::{self, Bytes, ObjectSegment, ReadError, ReadRef}; -use crate::{SEGMENT_RWE_FLAG_EXECUTE, SEGMENT_RWE_FLAG_READ, SEGMENT_RWE_FLAG_WRITE}; +use crate::read::{self, Bytes, ObjectSegment, ReadError, ReadRef, SegmentFlags}; use super::{ElfFile, FileHeader, NoteIterator}; @@ -131,19 +130,9 @@ where } #[inline] - fn rwe_flags(&self) -> u32 { - let value = self.segment.p_flags(self.file.endian); - let mut flag = 0; - if value & elf::PF_R > 0 { - flag |= SEGMENT_RWE_FLAG_READ; - } - if value & elf::PF_W > 0 { - flag |= SEGMENT_RWE_FLAG_WRITE - } - if value & elf::PF_X > 0 { - flag |= SEGMENT_RWE_FLAG_EXECUTE; - } - flag + fn flags(&self) -> SegmentFlags { + let p_flags = self.segment.p_flags(self.file.endian); + SegmentFlags::Elf { p_flags } } } diff --git a/src/read/macho/segment.rs b/src/read/macho/segment.rs index 16c30b8a..2023282c 100644 --- a/src/read/macho/segment.rs +++ b/src/read/macho/segment.rs @@ -4,8 +4,7 @@ use core::{result, slice, str}; use crate::endian::{self, Endianness}; use crate::macho; use crate::pod::Pod; -use crate::read::{self, ObjectSegment, ReadError, ReadRef, Result}; -use crate::{SEGMENT_RWE_FLAG_EXECUTE, SEGMENT_RWE_FLAG_READ, SEGMENT_RWE_FLAG_WRITE}; +use crate::read::{self, ObjectSegment, ReadError, ReadRef, Result, SegmentFlags}; use super::{LoadCommandData, MachHeader, MachOFile, Section}; @@ -136,19 +135,10 @@ where } #[inline] - fn rwe_flags(&self) -> u32 { - let value = self.internal.segment.initprot(self.file.endian); - let mut flag = 0; - if value & macho::VM_PROT_READ > 0 { - flag |= SEGMENT_RWE_FLAG_READ; - } - if value & macho::VM_PROT_WRITE > 0 { - flag |= SEGMENT_RWE_FLAG_WRITE - } - if value & macho::VM_PROT_EXECUTE > 0 { - flag |= SEGMENT_RWE_FLAG_EXECUTE; - } - flag + fn flags(&self) -> SegmentFlags { + let maxprot = self.internal.segment.maxprot(self.file.endian); + let initprot = self.internal.segment.initprot(self.file.endian); + SegmentFlags::MachO { maxprot, initprot } } } diff --git a/src/read/pe/section.rs b/src/read/pe/section.rs index f6ac8230..70ac6264 100644 --- a/src/read/pe/section.rs +++ b/src/read/pe/section.rs @@ -5,9 +5,8 @@ use crate::endian::LittleEndian as LE; use crate::pe; use crate::read::{ self, CompressedData, CompressedFileRange, ObjectSection, ObjectSegment, ReadError, ReadRef, - Relocation, Result, SectionFlags, SectionIndex, SectionKind, + Relocation, Result, SectionFlags, SectionIndex, SectionKind, SegmentFlags, }; -use crate::{SEGMENT_RWE_FLAG_EXECUTE, SEGMENT_RWE_FLAG_READ, SEGMENT_RWE_FLAG_WRITE}; use super::{ImageNtHeaders, PeFile, SectionTable}; @@ -126,19 +125,9 @@ where } #[inline] - fn rwe_flags(&self) -> u32 { - let value = self.section.characteristics.get(LE); - let mut flag = 0; - if value & pe::IMAGE_SCN_MEM_READ > 0 { - flag |= SEGMENT_RWE_FLAG_READ; - } - if value & pe::IMAGE_SCN_MEM_WRITE > 0 { - flag |= SEGMENT_RWE_FLAG_WRITE - } - if value & pe::IMAGE_SCN_MEM_EXECUTE > 0 { - flag |= SEGMENT_RWE_FLAG_EXECUTE; - } - flag + fn flags(&self) -> SegmentFlags { + let characteristics = self.section.characteristics.get(LE); + SegmentFlags::Coff { characteristics } } } diff --git a/src/read/traits.rs b/src/read/traits.rs index 2151850d..f1a473e0 100644 --- a/src/read/traits.rs +++ b/src/read/traits.rs @@ -4,8 +4,8 @@ use alloc::vec::Vec; use crate::read::{ self, Architecture, CodeView, ComdatKind, CompressedData, CompressedFileRange, Export, FileFlags, Import, ObjectKind, ObjectMap, Relocation, Result, SectionFlags, SectionIndex, - SectionKind, SymbolFlags, SymbolIndex, SymbolKind, SymbolMap, SymbolMapName, SymbolScope, - SymbolSection, + SectionKind, SegmentFlags, SymbolFlags, SymbolIndex, SymbolKind, SymbolMap, SymbolMapName, + SymbolScope, SymbolSection, }; use crate::Endianness; @@ -262,12 +262,8 @@ pub trait ObjectSegment<'data>: read::private::Sealed { /// Returns an error if the name is not UTF-8. fn name(&self) -> Result>; - /// Return read/write/execute flag of segment. - /// - /// Returns 0 if none of r/w/e flags exist. - /// Otherwise returns value of - /// SEGMENT_RWE_FLAG_READ | SEGMENT_RWE_FLAG_WRITE | SEGMENT_RWE_FLAG_EXECUTE - fn rwe_flags(&self) -> u32; + /// Return the flags of segment. + fn flags(&self) -> SegmentFlags; } /// A section defined in an object file. From c11d0f42dba40cd8e1ef56833cd3facb6cc686ff Mon Sep 17 00:00:00 2001 From: everettjf Date: Fri, 31 Dec 2021 10:31:32 +0800 Subject: [PATCH 3/4] fix wasm compile error --- src/read/wasm.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/read/wasm.rs b/src/read/wasm.rs index ba006394..6efb79ca 100644 --- a/src/read/wasm.rs +++ b/src/read/wasm.rs @@ -503,6 +503,11 @@ impl<'data, 'file, R> ObjectSegment<'data> for WasmSegment<'data, 'file, R> { fn name(&self) -> Result> { unreachable!() } + + #[inline] + fn flags(&self) -> SegmentFlags { + unreachable!() + } } /// An iterator over the sections of a `WasmFile`. From ae3108c10f98aa3edb5223441a73945a459055e3 Mon Sep 17 00:00:00 2001 From: everettjf Date: Fri, 31 Dec 2021 23:39:28 +0800 Subject: [PATCH 4/4] fix wasm compile error --- src/read/wasm.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/read/wasm.rs b/src/read/wasm.rs index 6efb79ca..0113f597 100644 --- a/src/read/wasm.rs +++ b/src/read/wasm.rs @@ -13,8 +13,8 @@ use crate::read::{ self, Architecture, ComdatKind, CompressedData, CompressedFileRange, Error, Export, FileFlags, Import, NoDynamicRelocationIterator, Object, ObjectComdat, ObjectKind, ObjectSection, ObjectSegment, ObjectSymbol, ObjectSymbolTable, ReadError, ReadRef, Relocation, Result, - SectionFlags, SectionIndex, SectionKind, SymbolFlags, SymbolIndex, SymbolKind, SymbolScope, - SymbolSection, + SectionFlags, SectionIndex, SectionKind, SegmentFlags, SymbolFlags, SymbolIndex, SymbolKind, + SymbolScope, SymbolSection, }; const SECTION_CUSTOM: usize = 0;