Elfloader library for the Rust programming language.
This library is going to help you load .o file into your system and make you easier to use the global functions and data in this ELF file.
1. rustup override set nightly
2. cargo -Z build-std=core,alloc build [--release]
OR
cargo build [--release]
We can just simply use cargo build [--release]
because of rust-toolchain
and .cargo/config.toml
, then C-compatible static library libelfloader.a
will be generated in directory target/<arch>/[debug|release]
and I have also offered the C header file in include
for detail.
- load
elf header
andsection headers
into memory for Analyze - get section
size
andalignment
information fromsection headers
for Allocation - calculate the required
size
andalign
, and then Allocate memories - load
.text,.data,.bss,.rodata
section into memory - load
symtab
throughsection header
and Resolve all symbols' value - read
relatab
and then Relocate symbols which in target section - now the code can be executed normaly