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