mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-25 17:00:36 -09:00
GP-699 Process ELF init/fini arrays before applying relocations
This commit is contained in:
@@ -158,8 +158,9 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
|
||||
|
||||
elf.getLoadAdapter().processElf(this, monitor);
|
||||
|
||||
processRelocations(monitor);
|
||||
processEntryPoints(monitor);
|
||||
|
||||
processRelocations(monitor);
|
||||
processImports(monitor);
|
||||
|
||||
monitor.setMessage("Processing PLT/GOT ...");
|
||||
@@ -338,11 +339,10 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
|
||||
|
||||
/**
|
||||
* Processes the GNU version section.
|
||||
* @throws CancelledException
|
||||
*/
|
||||
private void processGNU(TaskMonitor monitor) {
|
||||
if (monitor.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
private void processGNU(TaskMonitor monitor) throws CancelledException {
|
||||
monitor.checkCanceled();
|
||||
|
||||
Address versionTableAddr = null;
|
||||
|
||||
@@ -464,10 +464,8 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
|
||||
}
|
||||
}
|
||||
|
||||
private void processEntryPoints(TaskMonitor monitor) {
|
||||
if (monitor.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
private void processEntryPoints(TaskMonitor monitor) throws CancelledException {
|
||||
monitor.checkCanceled();
|
||||
monitor.setMessage("Creating entry points...");
|
||||
|
||||
long entry = elf.e_entry(); // already adjusted for pre-link
|
||||
@@ -587,11 +585,8 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
|
||||
return msg;
|
||||
}
|
||||
|
||||
private void markupInterpreter(TaskMonitor monitor) {
|
||||
if (monitor.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
private void markupInterpreter(TaskMonitor monitor) throws CancelledException {
|
||||
monitor.checkCanceled();
|
||||
monitor.setMessage("Processing interpreter...");
|
||||
Address interpStrAddr = null;
|
||||
|
||||
@@ -621,10 +616,8 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
|
||||
listing.setComment(interpStrAddr, CodeUnit.EOL_COMMENT, "Initial Elf program interpreter");
|
||||
}
|
||||
|
||||
private void processImports(TaskMonitor monitor) {
|
||||
if (monitor.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
private void processImports(TaskMonitor monitor) throws CancelledException {
|
||||
monitor.checkCanceled();
|
||||
monitor.setMessage("Processing imports...");
|
||||
|
||||
ExternalManager extManager = program.getExternalManager();
|
||||
|
||||
Reference in New Issue
Block a user