|
|
|
@ -4,8 +4,6 @@ use crate::common::SectionInfo;
|
|
|
|
|
use crate::common::{Relocatable, Section};
|
|
|
|
|
use crate::error::Error;
|
|
|
|
|
|
|
|
|
|
use super::ElfObject;
|
|
|
|
|
|
|
|
|
|
pub enum SegmentType {
|
|
|
|
|
Text,
|
|
|
|
|
Data,
|
|
|
|
@ -43,9 +41,9 @@ impl Loadable {
|
|
|
|
|
text.chain(rodata).chain(data).chain(bss)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn program_bytes<'l>(
|
|
|
|
|
pub fn program_bytes<'l, R: Relocatable>(
|
|
|
|
|
&'l self,
|
|
|
|
|
objects: &'l [ElfObject],
|
|
|
|
|
objects: &'l [R],
|
|
|
|
|
) -> impl Iterator<Item = Result<&'l [u8], Error>> {
|
|
|
|
|
let text_iter = self.text.iter();
|
|
|
|
|
let rodata_iter = self.rodata.iter();
|
|
|
|
@ -62,9 +60,9 @@ impl Loadable {
|
|
|
|
|
data1.chain(data2)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn data_bytes<'l>(
|
|
|
|
|
pub fn data_bytes<'l, R: Relocatable>(
|
|
|
|
|
&'l self,
|
|
|
|
|
objects: &'l [ElfObject],
|
|
|
|
|
objects: &'l [R],
|
|
|
|
|
) -> impl Iterator<Item = Result<&'l [u8], Error>> {
|
|
|
|
|
let iter = self.data.iter().filter_map(move |si| match si.data_index {
|
|
|
|
|
None => None,
|