|
|
@ -1,5 +1,5 @@
|
|
|
|
use crate::common::{Relocatable, Section};
|
|
|
|
|
|
|
|
use crate::common::SectionInfo;
|
|
|
|
use crate::common::SectionInfo;
|
|
|
|
|
|
|
|
use crate::common::{Relocatable, Section};
|
|
|
|
use crate::error::Error;
|
|
|
|
use crate::error::Error;
|
|
|
|
|
|
|
|
|
|
|
|
use super::ElfObject;
|
|
|
|
use super::ElfObject;
|
|
|
@ -44,7 +44,10 @@ impl<'data> OutputData {
|
|
|
|
.map(|(i, s)| (SEGMENT_NAMES[i], s))
|
|
|
|
.map(|(i, s)| (SEGMENT_NAMES[i], s))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn program_bytes<'l>(&'l self, objects: &'l Vec<ElfObject>) -> impl Iterator<Item = Result<&'l [u8], Error>> {
|
|
|
|
pub fn program_bytes<'l>(
|
|
|
|
|
|
|
|
&'l self,
|
|
|
|
|
|
|
|
objects: &'l Vec<ElfObject>,
|
|
|
|
|
|
|
|
) -> impl Iterator<Item = Result<&'l [u8], Error>> {
|
|
|
|
let text_iter = self.0[SI_TEXT].iter();
|
|
|
|
let text_iter = self.0[SI_TEXT].iter();
|
|
|
|
let rodata_iter = self.0[SI_RODATA].iter();
|
|
|
|
let rodata_iter = self.0[SI_RODATA].iter();
|
|
|
|
|
|
|
|
|
|
|
@ -62,8 +65,13 @@ impl<'data> OutputData {
|
|
|
|
iter
|
|
|
|
iter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn data_bytes<'l>(&'l self, objects: &'l Vec<ElfObject>) -> impl Iterator<Item = Result<&'l [u8], Error>> {
|
|
|
|
pub fn data_bytes<'l>(
|
|
|
|
let iter = self.0[SI_DATA].iter().filter_map(move |si| match si.data_index {
|
|
|
|
&'l self,
|
|
|
|
|
|
|
|
objects: &'l Vec<ElfObject>,
|
|
|
|
|
|
|
|
) -> impl Iterator<Item = Result<&'l [u8], Error>> {
|
|
|
|
|
|
|
|
let iter = self.0[SI_DATA]
|
|
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
|
|
.filter_map(move |si| match si.data_index {
|
|
|
|
None => None,
|
|
|
|
None => None,
|
|
|
|
Some(di) => Some(objects[di.0].section_data(di)),
|
|
|
|
Some(di) => Some(objects[di.0].section_data(di)),
|
|
|
|
});
|
|
|
|
});
|
|
|
|