Implementation of InitBeforeRelocationDoneHook and SkipEntrypoint module options

This commit is contained in:
Maschell
2020-12-26 16:01:46 +01:00
parent 6e352b0085
commit 98c8de7479
5 changed files with 38 additions and 23 deletions

View File

@@ -132,12 +132,19 @@ public:
return this->export_name;
}
bool isInitBeforeEntrypoint() const {
return this->initBeforeEntrypoint;
bool isSkipEntrypoint() const {
return this->skipEntrypoint;
}
void setInitBeforeEntrypoint(bool value) {
this->initBeforeEntrypoint = value;
bool isInitBeforeRelocationDoneHook() const {
return this->initBeforeRelocationDoneHook;
}
void setSkipEntrypoint(bool value) {
this->skipEntrypoint = value;
}
void setInitBeforeRelocationDoneHook(bool value) {
this->initBeforeRelocationDoneHook = value;
}
private:
@@ -155,5 +162,6 @@ private:
uint32_t startAddress = 0;
uint32_t endAddress = 0;
uint32_t entrypoint = 0;
bool initBeforeEntrypoint = false;
bool skipEntrypoint = false;
bool initBeforeRelocationDoneHook = false;
};

View File

@@ -189,10 +189,15 @@ std::optional<ModuleData> ModuleDataFactory::load(std::string path, uint32_t *de
if (key.compare("export_name") == 0) {
DEBUG_FUNCTION_LINE("export_name = %s", value.c_str());
moduleData.setExportName(value);
} else if (key.compare("initBeforeEntrypoint") == 0) {
} else if (key.compare("skipEntrypoint") == 0) {
if (value.compare("true") == 0) {
DEBUG_FUNCTION_LINE("initBeforeEntrypoint = %s", value.c_str());
moduleData.setInitBeforeEntrypoint(true);
DEBUG_FUNCTION_LINE("skipEntrypoint = %s", value.c_str());
moduleData.setSkipEntrypoint(true);
}
} else if (key.compare("initBeforeRelocationDoneHook") == 0) {
if (value.compare("true") == 0) {
DEBUG_FUNCTION_LINE("initBeforeRelocationDoneHook = %s", value.c_str());
moduleData.setInitBeforeRelocationDoneHook(true);
}
}
if (key.compare("wums") == 0) {

View File

@@ -71,7 +71,8 @@ bool ModuleDataPersistence::saveModuleData(module_information_t *moduleInformati
module_data->startAddress = module.getStartAddress();
module_data->endAddress = module.getEndAddress();
module_data->entrypoint = module.getEntrypoint();
module_data->initBeforeEntrypoint = module.isInitBeforeEntrypoint();
module_data->skipEntrypoint = module.isSkipEntrypoint();
module_data->initBeforeRelocationDoneHook = module.isInitBeforeRelocationDoneHook();
moduleInformation->number_used_modules++;
@@ -105,7 +106,8 @@ std::vector<ModuleData> ModuleDataPersistence::loadModuleData(module_information
moduleData.setStartAddress(module_data->startAddress);
moduleData.setEndAddress(module_data->endAddress);
moduleData.setExportName(module_data->module_export_name);
moduleData.setInitBeforeEntrypoint(module_data->initBeforeEntrypoint);
moduleData.setSkipEntrypoint(module_data->skipEntrypoint);
moduleData.setInitBeforeRelocationDoneHook(module_data->initBeforeRelocationDoneHook);
for (uint32_t j = 0; j < EXPORT_ENTRY_LIST_LENGTH; j++) {
export_data_t *export_entry = &(module_data->export_entries[j]);