Struct elfio::DynamicSectionAccessor [−][src]
pub struct DynamicSectionAccessor<'a> { /* fields omitted */ }
Expand description
A section data accessor intended to dynamic tables
For example:
use std::fs::File; use std::io; use std::io::{BufReader, Error}; use elfio::Elfio; fn main() -> io::Result<()> { let elf_file = File::open("tests/files/hello_32")?; let mut reader = BufReader::new(elf_file); let mut elf = Elfio::new(); elf.load(&mut reader)?; let section = match elf.get_section_by_name(&".dynamic") { Some(s) => s, None => return Err(Error::new(io::ErrorKind::Other, "section not found")), }; let dyns = elfio::DynamicSectionAccessor::new(&elf, section); assert_eq!(dyns.get_entries_num(), 20); // Dynamic section at offset 0x4a0 contains 20 entries: // Tag Type Name/Value // 0x00000001 (NEEDED) Shared library: [libc.so.6] // 0x0000000c (INIT) 0x804824c // 0x0000000d (FINI) 0x8048458 // 0x6ffffef5 (GNU_HASH) 0x8048148 let dynamic = dyns.get_entry(3).unwrap(); assert_eq!(dynamic.tag, 0x6ffffef5); assert_eq!(dynamic.value, 0x8048148); Ok(()) }
Implementations
Creates a new instance of the relocation table accessor
Returns number of symbols