Expand description
‘elfio’ is a Rust library intended for reading and generation files in the ELF binary format. The library supports processing of ELF files for 32- and 64-bit architectures regardless of their endianess
For example:
use std::fs::File;
use std::io;
use std::io::BufReader;
use elfio::Elfio;
fn main() -> io::Result<()> {
let elf_file = File::open("tests/files/hello_64")?;
let mut file_reader = BufReader::new(elf_file);
let mut elf = elfio::Elfio::new();
elf.load(&mut file_reader)?;
match elf.get_type() {
elfio::constant::ET_REL => println!("Object ELF file"),
elfio::constant::ET_EXEC => println!("Executable ELF file"),
elfio::constant::ET_DYN => println!("Shared library ELF file"),
elfio::constant::ET_CORE => println!("Core ELF file"),
_ => println!("ELF type is not recognized"),
}
Ok(())
}
Modules§
- constant
- The constants defined by ELF standard and used by ELFIO trait
Structs§
- Array
- An array element
- Array
Section Accessor - A section data accessor intended to array tables. The accessor is useful for manipulation of such sections as .ctors, .dtors, .init_array and .fini_array
- Dynamic
- A dynamic table element
- Dynamic
Section Accessor - A section data accessor intended to dynamic tables
- Elfio
- Elfio - the main struct of the library. All access to ELF files attributes starts from this object. The object provides functions to access ELF file header attributes as well as the list of segments and sections of this file.
- ModInfo
Section Accessor - A section data accessor intended to modinfo tables. The accessor is useful for kernel modules data
- Note
- A note entry. The note is used by compilers and other tools to mark an object file with special information that has special meaning to a particular tool set.
- Note
Section Accessor - A section data accessor intended to note sections
- Relocation
- A relocation entry. The relocation contains information that describes how to modify section contents, thus allowing executable and shared object files to hold the right information for a process’s program image.
- Relocation
Section Accessor - A section data accessor intended to relocation tables
- String
Section Accessor - A section data accessor intended to string tables
- Symbol
- A struct represents a single symbol from symbol table section
- Symbol
Section Accessor - A section data accessor intended to symbol tables
Traits§
- ElfSection
Access Trait - Read/Write access to section properties
- ElfSegment
Access Trait - Read/Write access to segment properties
- Elfio
Read Seek - A trait for reading ELF file payload from a file or memory. Currently, it is implemented for std::fs::File, std::io::BufReader and std::io::Cursor
Type Aliases§
- Elf32
Addr - Unsigned program address for 32-bit
- Elf32
Off - Unsigned file offset for 32-bit
- Elf64
Addr - Unsigned program address for 64-bit
- Elf64
Off - Unsigned file offset for 64-bit
- ElfHalf
- Unsigned medium integer
- ElfSword
- Signed large integer
- ElfSxword
- Signed long integer
- ElfWord
- Unsigned large integer
- ElfXword
- Unsigned long integer