-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: RuntimeMemoryImage: support relocatable object files
Add initial support for the analysis of relocatable object files. These files do not include information about the runtime memory layout, i.e., segments. Ghidra handles such files by assigning addresses to sections in `ElfProgramBuilder.processSectionHeaders`. The algorithm is essentially: ``` base_address <- 0x100_000 for each section in section_headers do: if not section.is_alloc() or section.sh_type == SHT_NULL or section.size == 0 then: continue end if alignment <- section.sh_addralign section.address <- align(base_address, alignment) base_address <- base_address + section.sh_size end for ``` Importantly, the above is not the exact algorithm used by Ghidra, but only an approximation that aims to be correct for the invocation of Ghidra with the pcode extractor plugin. Add an implementation of this algorithm to `MemorySegment` and use it from `MemoryImage::new` when an relocatable object file is given.
- Loading branch information
Valentin Obst
committed
Feb 27, 2024
1 parent
b086b47
commit 5436969
Showing
4 changed files
with
129 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters