/// Parse the raw ELF file data.
Parse the raw ELF file data.
Parse the raw ELF file data .
pub fn parse(data: &'data [u8]) -> read::Result<Self> {
        let data = Bytes(data);
        let header = Elf::parse(data)?;
        let endian = header.endian()?;
        let segments = header.program_headers(endian, data)?;
        let sections = header.sections(endian, data)?;
        let symbols = sections.symbols(endian, data, elf::SHT_SYMTAB)?;
        // TODO: get dynamic symbols from DT_SYMTAB if there are no sections
        let dynamic_symbols = sections.symbols(endian, data, elf::SHT_DYNSYM)?;
        // The API we provide requires a mapping from section to relocations, so build it now.
        let relocations = sections.relocation_sections(endian, symbols.section())?;
        Ok(ElfFile {
            endian,
            header,
            segments,
            sections,
            relocations,
            symbols,
            dynamic_symbols,
            data,
        })
    }
pub fn parse ( data : & ' data [ u8 ] ) -> read :: Result < Self > { let data = Bytes ( data ) ; let header = Elf :: parse ( data ) ? ; let endian = header . endian ( ) ? ; let segments = header . program_headers ( endian , data ) ? ; let sections = header . sections ( endian , data ) ? ; let symbols = sections . symbols ( endian , data , elf :: SHT_SYMTAB ) ? ; // TODO: get dynamic symbols from DT_SYMTAB if there are no sections let dynamic_symbols = sections . symbols ( endian , data , elf :: SHT_DYNSYM ) ? ; // The API we provide requires a mapping from section to relocations, so build it now. let relocations = sections . relocation_sections ( endian , symbols . section ( ) ) ? ; Ok ( ElfFile { endian , header , segments , sections , relocations , symbols , dynamic_symbols , data , } ) }
Parse the raw ELF file data.
Parse the raw ELF file data .
data
&'data [u8]