diff --git a/relocator/src/ModuleDataMinimal.h b/relocator/src/ModuleDataMinimal.h
new file mode 100644
index 0000000..d12f405
--- /dev/null
+++ b/relocator/src/ModuleDataMinimal.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+ * Copyright (C) 2018-2021 Maschell
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ ****************************************************************************/
+
+#include "../../source/module/RelocationData.h"
+#include "../../source/module/HookData.h"
+
+#pragma once
+
+class ModuleDataMinimal {
+public:
+ ModuleDataMinimal() = default;
+
+ ~ModuleDataMinimal() = default;
+
+ void setExportName(const std::string &name) {
+ this->export_name = name;
+ }
+
+ [[nodiscard]] std::string getExportName() const {
+ return this->export_name;
+ }
+
+ void addRelocationData(const RelocationData &relocation_data) {
+ relocation_data_list.push_back(relocation_data);
+ }
+
+ [[nodiscard]] const std::vector &getRelocationDataList() const {
+ return relocation_data_list;
+ }
+
+ void addHookData(const HookData &data) {
+ hook_data_list.push_back(data);
+ }
+
+ [[nodiscard]] const std::vector &getHookDataList() const {
+ return hook_data_list;
+ }
+
+ void setEntrypoint(uint32_t addr) {
+ this->entrypoint = addr;
+ }
+
+ [[nodiscard]] uint32_t getEntrypoint() const {
+ return entrypoint;
+ }
+
+ [[nodiscard]] bool isInitBeforeRelocationDoneHook() const {
+ return this->initBeforeRelocationDoneHook;
+ }
+
+ void setInitBeforeRelocationDoneHook(bool value) {
+ this->initBeforeRelocationDoneHook = value;
+ }
+
+ bool relocationsDone = false;
+private:
+ std::vector relocation_data_list;
+ std::vector hook_data_list;
+ std::string export_name;
+ uint32_t entrypoint = 0;
+ bool initBeforeRelocationDoneHook = false;
+
+};
diff --git a/relocator/src/ModuleDataPersistence.cpp b/relocator/src/ModuleDataPersistence.cpp
index 9ea51ba..5af0764 100644
--- a/relocator/src/ModuleDataPersistence.cpp
+++ b/relocator/src/ModuleDataPersistence.cpp
@@ -3,8 +3,8 @@
#include
#include
-std::vector ModuleDataPersistence::loadModuleData(module_information_t *moduleInformation) {
- std::vector result;
+std::vector ModuleDataPersistence::loadModuleData(module_information_t *moduleInformation) {
+ std::vector result;
if (moduleInformation == nullptr) {
DEBUG_FUNCTION_LINE("moduleInformation == NULL\n");
return result;
@@ -22,25 +22,12 @@ std::vector ModuleDataPersistence::loadModuleData(module_information
for (int32_t i = 0; i < module_count; i++) {
// Copy data from struct.
module_information_single_t *module_data = &(moduleInformation->module_data[i]);
- ModuleData moduleData;
+ ModuleDataMinimal moduleData;
- moduleData.setBSSLocation(module_data->bssAddr, module_data->bssSize);
- moduleData.setSBSSLocation(module_data->sbssAddr, module_data->sbssSize);
moduleData.setEntrypoint(module_data->entrypoint);
- moduleData.setStartAddress(module_data->startAddress);
- moduleData.setEndAddress(module_data->endAddress);
- moduleData.setSkipEntrypoint(module_data->skipEntrypoint);
moduleData.setInitBeforeRelocationDoneHook(module_data->initBeforeRelocationDoneHook);
-
moduleData.setExportName(module_data->module_export_name);
- for (auto &export_entry: module_data->export_entries) {
- if (export_entry.address == 0) {
- continue;
- }
- moduleData.addExportData(ExportData(static_cast(export_entry.type), export_entry.name, reinterpret_cast(export_entry.address)));
- }
-
for (auto &hook_entry: module_data->hook_entries) {
if (hook_entry.target == 0) {
continue;
@@ -76,6 +63,7 @@ std::vector ModuleDataPersistence::loadModuleData(module_information
moduleData.addRelocationData(reloc);
}
+
result.push_back(moduleData);
}
return result;
diff --git a/relocator/src/ModuleDataPersistence.h b/relocator/src/ModuleDataPersistence.h
index b73a3cd..c0d811e 100644
--- a/relocator/src/ModuleDataPersistence.h
+++ b/relocator/src/ModuleDataPersistence.h
@@ -1,9 +1,10 @@
#pragma once
#include
-#include "../../source/module/ModuleData.h"
+#include
+#include "ModuleDataMinimal.h"
class ModuleDataPersistence {
public:
- static std::vector loadModuleData(module_information_t *moduleInformation);
+ static std::vector loadModuleData(module_information_t *moduleInformation);
};
diff --git a/relocator/src/entry.cpp b/relocator/src/entry.cpp
index 3f1d8f0..3059435 100644
--- a/relocator/src/entry.cpp
+++ b/relocator/src/entry.cpp
@@ -1,20 +1,19 @@
#include
#include
-#include
#include
#include
#include
#include