mirror of
https://github.com/wiiu-env/WUMSLoader.git
synced 2026-09-02 08:34:17 -05:00
Allocate everything on the stack instead of the heap
This commit is contained in:
@@ -65,12 +65,12 @@ dyn_linking_import_t * DynamicLinkingHelper::getOrAddImport(dyn_linking_relocati
|
||||
return result;
|
||||
}
|
||||
|
||||
bool DynamicLinkingHelper::addReloationEntry(dyn_linking_relocation_data_t * linking_data, dyn_linking_relocation_entry_t * linking_entries, uint32_t linking_entry_length, RelocationData * relocationData) {
|
||||
return addReloationEntry(linking_data, linking_entries, linking_entry_length, relocationData->getType(), relocationData->getOffset(), relocationData->getAddend(), relocationData->getDestination(), relocationData->getName(), relocationData->getImportRPLInformation());
|
||||
bool DynamicLinkingHelper::addReloationEntry(dyn_linking_relocation_data_t * linking_data, dyn_linking_relocation_entry_t * linking_entries, uint32_t linking_entry_length, const RelocationData& relocationData) {
|
||||
return addReloationEntry(linking_data, linking_entries, linking_entry_length, relocationData.getType(), relocationData.getOffset(), relocationData.getAddend(), relocationData.getDestination(), relocationData.getName(), relocationData.getImportRPLInformation());
|
||||
}
|
||||
|
||||
bool DynamicLinkingHelper::addReloationEntry(dyn_linking_relocation_data_t * linking_data, dyn_linking_relocation_entry_t * linking_entries, uint32_t linking_entry_length, char type, size_t offset, int32_t addend, void *destination, std::string name, ImportRPLInformation * rplInfo) {
|
||||
dyn_linking_import_t * importInfoGbl = DynamicLinkingHelper::getOrAddImport(linking_data, rplInfo->getName().c_str(),rplInfo->isData());
|
||||
bool DynamicLinkingHelper::addReloationEntry(dyn_linking_relocation_data_t * linking_data, dyn_linking_relocation_entry_t * linking_entries, uint32_t linking_entry_length, char type, size_t offset, int32_t addend, void *destination, std::string name, const ImportRPLInformation& rplInfo) {
|
||||
dyn_linking_import_t * importInfoGbl = DynamicLinkingHelper::getOrAddImport(linking_data, rplInfo.getName().c_str(),rplInfo.isData());
|
||||
if(importInfoGbl == NULL) {
|
||||
DEBUG_FUNCTION_LINE("Getting import info failed. Probably maximum of %d rpl files to import reached.\n",DYN_LINK_IMPORT_LIST_LENGTH);
|
||||
return false;
|
||||
|
||||
@@ -46,9 +46,9 @@ public:
|
||||
**/
|
||||
static dyn_linking_import_t * getOrAddImport(dyn_linking_relocation_data_t * data, const char * importName, bool isData);
|
||||
|
||||
static bool addReloationEntry(dyn_linking_relocation_data_t * linking_data, dyn_linking_relocation_entry_t * linking_entries, uint32_t linking_entry_length, RelocationData * relocationData);
|
||||
static bool addReloationEntry(dyn_linking_relocation_data_t * linking_data, dyn_linking_relocation_entry_t * linking_entries, uint32_t linking_entry_length, const RelocationData& relocationData);
|
||||
|
||||
static bool addReloationEntry(dyn_linking_relocation_data_t * linking_data, dyn_linking_relocation_entry_t * linking_entries, uint32_t linking_entry_length, char type, size_t offset, int32_t addend, void *destination, std::string name, ImportRPLInformation * rplInfo);
|
||||
static bool addReloationEntry(dyn_linking_relocation_data_t * linking_data, dyn_linking_relocation_entry_t * linking_entries, uint32_t linking_entry_length, char type, size_t offset, int32_t addend, void *destination, std::string name, const ImportRPLInformation& rplInfo);
|
||||
|
||||
static bool addReloationEntry(dyn_linking_relocation_entry_t * linking_entries, uint32_t linking_entry_length, char type, size_t offset, int32_t addend, void *destination, dyn_linking_function_t * functionName, dyn_linking_import_t * importInfo);
|
||||
private:
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <optional>
|
||||
#include "utils/logger.h"
|
||||
|
||||
class ImportRPLInformation {
|
||||
@@ -31,7 +32,7 @@ public:
|
||||
~ImportRPLInformation() {
|
||||
}
|
||||
|
||||
static ImportRPLInformation * createImportRPLInformation(std::string rawSectionName) {
|
||||
static std::optional<ImportRPLInformation> createImportRPLInformation(std::string rawSectionName) {
|
||||
std::string fimport = ".fimport_";
|
||||
std::string dimport = ".dimport_";
|
||||
|
||||
@@ -40,7 +41,7 @@ public:
|
||||
std::string rplName = "";
|
||||
|
||||
if(rawSectionName.size() < fimport.size()) {
|
||||
return NULL;
|
||||
return std::nullopt;
|
||||
} else if (std::equal(fimport.begin(), fimport.end(), rawSectionName.begin())) {
|
||||
rplName = rawSectionName.substr(fimport.size());
|
||||
} else if (std::equal(dimport.begin(), dimport.end(), rawSectionName.begin())) {
|
||||
@@ -48,16 +49,16 @@ public:
|
||||
data = true;
|
||||
} else {
|
||||
DEBUG_FUNCTION_LINE("invalid section name\n");
|
||||
return NULL;
|
||||
return std::nullopt;
|
||||
}
|
||||
return new ImportRPLInformation(rplName, data);
|
||||
return ImportRPLInformation(rplName, data);
|
||||
}
|
||||
|
||||
std::string getName() {
|
||||
std::string getName() const {
|
||||
return name;
|
||||
}
|
||||
|
||||
bool isData() {
|
||||
bool isData() const {
|
||||
return _isData;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "ModuleData.h"
|
||||
#include "utils/StringTools.h"
|
||||
|
||||
std::string ModuleData::toString() {
|
||||
std::string ModuleData::toString() const {
|
||||
std::string res = StringTools::strfmt("Entrypoint %08X, bss: %08X (%d), bss: %08X (%d)\n", getEntrypoint(), getBSSAddr(), getBSSSize(), getSBSSAddr(), getSBSSSize());
|
||||
for (auto const& reloc : relocation_data_list) {
|
||||
if(reloc != NULL) {
|
||||
res += reloc->toString();
|
||||
}
|
||||
for (auto const &reloc : relocation_data_list) {
|
||||
res += reloc.toString();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include "RelocationData.h"
|
||||
#include "SectionInfo.h"
|
||||
|
||||
class ModuleData {
|
||||
public:
|
||||
@@ -27,11 +29,6 @@ public:
|
||||
}
|
||||
|
||||
~ModuleData() {
|
||||
for (auto const& reloc : relocation_data_list) {
|
||||
if(reloc != NULL) {
|
||||
delete reloc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setBSSLocation(uint32_t addr, uint32_t size) {
|
||||
@@ -56,45 +53,46 @@ public:
|
||||
this->endAddress = endAddress;
|
||||
}
|
||||
|
||||
void addRelocationData(RelocationData * relocation_data) {
|
||||
void addRelocationData(const RelocationData& relocation_data) {
|
||||
relocation_data_list.push_back(relocation_data);
|
||||
}
|
||||
|
||||
std::vector<RelocationData *> getRelocationDataList() {
|
||||
const std::vector<RelocationData>& getRelocationDataList() const {
|
||||
return relocation_data_list;
|
||||
}
|
||||
|
||||
uint32_t getBSSAddr() {
|
||||
uint32_t getBSSAddr() const {
|
||||
return bssAddr;
|
||||
}
|
||||
|
||||
uint32_t getBSSSize() {
|
||||
uint32_t getBSSSize() const{
|
||||
return bssSize;
|
||||
}
|
||||
|
||||
uint32_t getSBSSAddr() {
|
||||
uint32_t getSBSSAddr() const{
|
||||
return sbssAddr;
|
||||
}
|
||||
|
||||
uint32_t getSBSSSize() {
|
||||
uint32_t getSBSSSize() const{
|
||||
return sbssSize;
|
||||
}
|
||||
|
||||
uint32_t getEntrypoint() {
|
||||
uint32_t getEntrypoint() const{
|
||||
return entrypoint;
|
||||
}
|
||||
|
||||
uint32_t getStartAddress() {
|
||||
uint32_t getStartAddress() const{
|
||||
return startAddress;
|
||||
}
|
||||
|
||||
uint32_t getEndAddress() {
|
||||
uint32_t getEndAddress() const{
|
||||
return endAddress;
|
||||
}
|
||||
|
||||
std::string toString();
|
||||
std::string toString() const;
|
||||
private:
|
||||
std::vector<RelocationData *> relocation_data_list;
|
||||
std::vector<RelocationData> relocation_data_list;
|
||||
std::map<std::string, SectionInfo> section_info_list;
|
||||
|
||||
uint32_t bssAddr = 0;
|
||||
uint32_t bssSize = 0;
|
||||
|
||||
@@ -23,21 +23,18 @@
|
||||
#include "elfio/elfio.hpp"
|
||||
#include "utils/utils.h"
|
||||
#include "ElfUtils.h"
|
||||
#include "SectionInfo.h"
|
||||
|
||||
using namespace ELFIO;
|
||||
|
||||
ModuleData * ModuleDataFactory::load(std::string path, uint32_t destination_address, uint32_t maximum_size, relocation_trampolin_entry_t * trampolin_data, uint32_t trampolin_data_length) {
|
||||
std::optional<ModuleData> ModuleDataFactory::load(std::string path, uint32_t destination_address, uint32_t maximum_size, relocation_trampolin_entry_t * trampolin_data, uint32_t trampolin_data_length) {
|
||||
elfio reader;
|
||||
ModuleData * moduleData = new ModuleData();
|
||||
if(moduleData == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
ModuleData moduleData;
|
||||
|
||||
// Load ELF data
|
||||
if (!reader.load(path)) {
|
||||
DEBUG_FUNCTION_LINE("Can't find or process %s", path.c_str());
|
||||
delete moduleData;
|
||||
return NULL;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
uint32_t sec_num = reader.sections.size();
|
||||
@@ -82,8 +79,7 @@ ModuleData * ModuleDataFactory::load(std::string path, uint32_t destination_addr
|
||||
} else {
|
||||
DEBUG_FUNCTION_LINE("Unhandled case");
|
||||
free(destinations);
|
||||
delete moduleData;
|
||||
return NULL;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const char* p = reader.sections[i]->get_data();
|
||||
@@ -98,10 +94,10 @@ ModuleData * ModuleDataFactory::load(std::string path, uint32_t destination_addr
|
||||
|
||||
//nextAddress = ROUNDUP(destination + sectionSize,0x100);
|
||||
if(psec->get_name().compare(".bss") == 0) {
|
||||
moduleData->setBSSLocation(destination, sectionSize);
|
||||
moduleData.setBSSLocation(destination, sectionSize);
|
||||
DEBUG_FUNCTION_LINE("Saved %s section info. Location: %08X size: %08X", psec->get_name().c_str(), destination, sectionSize);
|
||||
} else if(psec->get_name().compare(".sbss") == 0) {
|
||||
moduleData->setSBSSLocation(destination, sectionSize);
|
||||
moduleData.setSBSSLocation(destination, sectionSize);
|
||||
DEBUG_FUNCTION_LINE("Saved %s section info. Location: %08X size: %08X", psec->get_name().c_str(), destination, sectionSize);
|
||||
}
|
||||
totalSize += sectionSize;
|
||||
@@ -122,15 +118,14 @@ ModuleData * ModuleDataFactory::load(std::string path, uint32_t destination_addr
|
||||
if (!linkSection(reader, psec->get_index(), (uint32_t) destinations[psec->get_index()], offset_text, offset_data, trampolin_data, trampolin_data_length)) {
|
||||
DEBUG_FUNCTION_LINE("elfLink failed");
|
||||
free(destinations);
|
||||
delete moduleData;
|
||||
return NULL;
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::vector<RelocationData*> relocationData = getImportRelocationData(reader, destinations);
|
||||
std::vector<RelocationData> relocationData = getImportRelocationData(reader, destinations);
|
||||
|
||||
for (auto const& reloc : relocationData) {
|
||||
moduleData->addRelocationData(reloc);
|
||||
moduleData.addRelocationData(reloc);
|
||||
}
|
||||
|
||||
DCFlushRange((void*)destination_address, totalSize);
|
||||
@@ -138,9 +133,9 @@ ModuleData * ModuleDataFactory::load(std::string path, uint32_t destination_addr
|
||||
|
||||
free(destinations);
|
||||
|
||||
moduleData->setEntrypoint(entrypoint);
|
||||
moduleData->setStartAddress(destination_address);
|
||||
moduleData->setEndAddress(endAddress);
|
||||
moduleData.setEntrypoint(entrypoint);
|
||||
moduleData.setStartAddress(destination_address);
|
||||
moduleData.setEndAddress(endAddress);
|
||||
DEBUG_FUNCTION_LINE("Saved entrypoint as %08X", entrypoint);
|
||||
DEBUG_FUNCTION_LINE("Saved startAddress as %08X", destination_address);
|
||||
DEBUG_FUNCTION_LINE("Saved endAddress as %08X", endAddress);
|
||||
@@ -148,8 +143,8 @@ ModuleData * ModuleDataFactory::load(std::string path, uint32_t destination_addr
|
||||
return moduleData;
|
||||
}
|
||||
|
||||
std::vector<RelocationData*> ModuleDataFactory::getImportRelocationData(elfio& reader, uint8_t ** destinations) {
|
||||
std::vector<RelocationData*> result;
|
||||
std::vector<RelocationData> ModuleDataFactory::getImportRelocationData(elfio& reader, uint8_t ** destinations) {
|
||||
std::vector<RelocationData> result;
|
||||
std::map<uint32_t,std::string> infoMap;
|
||||
|
||||
uint32_t sec_num = reader.sections.size();
|
||||
@@ -183,8 +178,8 @@ std::vector<RelocationData*> ModuleDataFactory::getImportRelocationData(elfio& r
|
||||
if(adjusted_sym_value < 0xC0000000) {
|
||||
continue;
|
||||
}
|
||||
ImportRPLInformation * rplInfo = ImportRPLInformation::createImportRPLInformation(infoMap[sym_section_index]);
|
||||
if(rplInfo == NULL) {
|
||||
std::optional<ImportRPLInformation> rplInfo = ImportRPLInformation::createImportRPLInformation(infoMap[sym_section_index]);
|
||||
if(!rplInfo) {
|
||||
DEBUG_FUNCTION_LINE("Failed to create import information");
|
||||
break;
|
||||
}
|
||||
@@ -192,7 +187,7 @@ std::vector<RelocationData*> ModuleDataFactory::getImportRelocationData(elfio& r
|
||||
uint32_t section_index = psec->get_info();
|
||||
|
||||
// When these relocations are performed, we don't need the 0xC0000000 offset anymore.
|
||||
RelocationData * relocationData = new RelocationData(type, offset - 0x02000000, addend, (void*)(destinations[section_index] + 0x02000000), sym_name, rplInfo);
|
||||
RelocationData relocationData(type, offset - 0x02000000, addend, (void*)(destinations[section_index] + 0x02000000), sym_name, rplInfo.value());
|
||||
//relocationData->printInformation();
|
||||
result.push_back(relocationData);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
class ModuleDataFactory {
|
||||
public:
|
||||
static ModuleData * load(std::string path, uint32_t destination_address, uint32_t maximum_size, relocation_trampolin_entry_t * trampolin_data, uint32_t trampolin_data_length);
|
||||
static std::optional<ModuleData> load(std::string path, uint32_t destination_address, uint32_t maximum_size, relocation_trampolin_entry_t * trampolin_data, uint32_t trampolin_data_length);
|
||||
static bool linkSection(ELFIO::elfio& reader, uint32_t section_index, uint32_t destination, uint32_t base_text, uint32_t base_data, relocation_trampolin_entry_t * trampolin_data, uint32_t trampolin_data_length);
|
||||
static std::vector<RelocationData*> getImportRelocationData(ELFIO::elfio& reader, uint8_t ** destinations);
|
||||
static std::vector<RelocationData> getImportRelocationData(ELFIO::elfio& reader, uint8_t ** destinations);
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "ModuleData.h"
|
||||
#include "RelocationData.h"
|
||||
|
||||
bool ModuleDataPersistence::saveModuleData(module_information_t * moduleInformation, ModuleData * module) {
|
||||
bool ModuleDataPersistence::saveModuleData(module_information_t * moduleInformation, const ModuleData& module) {
|
||||
int32_t module_count = moduleInformation->number_used_modules;
|
||||
|
||||
if(module_count >= MAXIMUM_MODULES) {
|
||||
@@ -16,9 +16,9 @@ bool ModuleDataPersistence::saveModuleData(module_information_t * moduleInformat
|
||||
// Copy data to global struct.
|
||||
module_information_single_t * module_data = &(moduleInformation->module_data[module_count]);
|
||||
|
||||
DEBUG_FUNCTION_LINE("Saving reloation data for module at %08X", module->getEntrypoint());
|
||||
DEBUG_FUNCTION_LINE("Saving reloation data for module at %08X", module.getEntrypoint());
|
||||
// Relocation
|
||||
std::vector<RelocationData *> relocationData = module->getRelocationDataList();
|
||||
std::vector<RelocationData> relocationData = module.getRelocationDataList();
|
||||
for (auto const& reloc : relocationData) {
|
||||
if(!DynamicLinkingHelper::addReloationEntry(&(moduleInformation->linking_data), module_data->linking_entries, DYN_LINK_RELOCATION_LIST_LENGTH, reloc)) {
|
||||
DEBUG_FUNCTION_LINE("Failed to add relocation entry\n");
|
||||
@@ -26,14 +26,14 @@ bool ModuleDataPersistence::saveModuleData(module_information_t * moduleInformat
|
||||
}
|
||||
}
|
||||
|
||||
module_data->bssAddr = module->getBSSAddr();
|
||||
module_data->bssSize = module->getBSSSize();
|
||||
module_data->sbssAddr = module->getSBSSAddr();
|
||||
module_data->sbssSize = module->getSBSSSize();
|
||||
module_data->startAddress = module->getStartAddress();
|
||||
module_data->endAddress = module->getEndAddress();
|
||||
module_data->bssAddr = module.getBSSAddr();
|
||||
module_data->bssSize = module.getBSSSize();
|
||||
module_data->sbssAddr = module.getSBSSAddr();
|
||||
module_data->sbssSize = module.getSBSSSize();
|
||||
module_data->startAddress = module.getStartAddress();
|
||||
module_data->endAddress = module.getEndAddress();
|
||||
|
||||
module_data->entrypoint = module->getEntrypoint();
|
||||
module_data->entrypoint = module.getEntrypoint();
|
||||
|
||||
moduleInformation->number_used_modules++;
|
||||
|
||||
@@ -43,8 +43,8 @@ bool ModuleDataPersistence::saveModuleData(module_information_t * moduleInformat
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<ModuleData*> ModuleDataPersistence::loadModuleData(module_information_t * moduleInformation) {
|
||||
std::vector<ModuleData*> result;
|
||||
std::vector<ModuleData> ModuleDataPersistence::loadModuleData(module_information_t * moduleInformation) {
|
||||
std::vector<ModuleData> result;
|
||||
if(moduleInformation == NULL) {
|
||||
DEBUG_FUNCTION_LINE("moduleInformation == NULL\n");
|
||||
return result;
|
||||
@@ -60,16 +60,12 @@ std::vector<ModuleData*> ModuleDataPersistence::loadModuleData(module_informatio
|
||||
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 = new ModuleData();
|
||||
if(moduleData == NULL){
|
||||
DEBUG_FUNCTION_LINE("Failed to allocate data for ModuleData object\n");
|
||||
continue;
|
||||
}
|
||||
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 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);
|
||||
|
||||
for(uint32_t j = 0; j < DYN_LINK_RELOCATION_LIST_LENGTH; j++) {
|
||||
dyn_linking_relocation_entry_t * linking_entry = &(module_data->linking_entries[j]);
|
||||
@@ -95,17 +91,10 @@ std::vector<ModuleData*> ModuleDataPersistence::loadModuleData(module_informatio
|
||||
DEBUG_FUNCTION_LINE("functionEntry->functionName was NULL, skipping relocation entry\n");
|
||||
continue;
|
||||
}
|
||||
ImportRPLInformation * rplInfo = new ImportRPLInformation(importEntry->importName, importEntry->isData);
|
||||
if(rplInfo == NULL){
|
||||
DEBUG_FUNCTION_LINE("Failed to allocate ImportRPLInformation object. Skipping relocation entry.\n");
|
||||
continue;
|
||||
}
|
||||
RelocationData * reloc = new RelocationData(linking_entry->type, linking_entry->offset, linking_entry->addend, linking_entry->destination, functionEntry->functionName, rplInfo);
|
||||
if(reloc == NULL){
|
||||
DEBUG_FUNCTION_LINE("Failed to allocate RelocationData object. Skipping relocation entry.\n");
|
||||
continue;
|
||||
}
|
||||
moduleData->addRelocationData(reloc);
|
||||
ImportRPLInformation rplInfo(importEntry->importName, importEntry->isData);
|
||||
RelocationData reloc(linking_entry->type, linking_entry->offset, linking_entry->addend, linking_entry->destination, functionEntry->functionName, rplInfo);
|
||||
|
||||
moduleData.addRelocationData(reloc);
|
||||
}
|
||||
result.push_back(moduleData);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
class ModuleDataPersistence {
|
||||
public:
|
||||
static bool saveModuleData(module_information_t * moduleInformation, ModuleData * module);
|
||||
static std::vector<ModuleData*> loadModuleData(module_information_t * moduleInformation);
|
||||
static bool saveModuleData(module_information_t * moduleInformation, const ModuleData& module);
|
||||
static std::vector<ModuleData> loadModuleData(module_information_t * moduleInformation);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "RelocationData.h"
|
||||
#include "utils/StringTools.h"
|
||||
|
||||
std::string RelocationData::toString(){
|
||||
return StringTools::strfmt("%s destination: %08X offset: %08X type: %02X addend: %d rplName: %s isData: %d \n",name.c_str(), destination, offset, type, addend, rplInfo->getName().c_str(), rplInfo->isData() );
|
||||
std::string RelocationData::toString() const{
|
||||
return StringTools::strfmt("%s destination: %08X offset: %08X type: %02X addend: %d rplName: %s isData: %d \n",name.c_str(), destination, offset, type, addend, rplInfo.getName().c_str(), rplInfo.isData() );
|
||||
}
|
||||
|
||||
@@ -23,51 +23,47 @@
|
||||
class RelocationData {
|
||||
|
||||
public:
|
||||
RelocationData(char type, size_t offset, int32_t addend, void *destination, std::string name, ImportRPLInformation * rplInfo) {
|
||||
RelocationData(char type, size_t offset, int32_t addend, void *destination, std::string name, const ImportRPLInformation& rplInfo): rplInfo(rplInfo) {
|
||||
this->type = type;
|
||||
this->offset = offset;
|
||||
this->addend = addend;
|
||||
this->destination = destination;
|
||||
this->name = name;
|
||||
this->rplInfo = rplInfo;
|
||||
}
|
||||
|
||||
~RelocationData() {
|
||||
if(rplInfo != NULL) {
|
||||
delete rplInfo;
|
||||
}
|
||||
}
|
||||
|
||||
char getType() {
|
||||
char getType() const{
|
||||
return type;
|
||||
}
|
||||
|
||||
size_t getOffset() {
|
||||
size_t getOffset() const{
|
||||
return offset;
|
||||
}
|
||||
|
||||
int32_t getAddend() {
|
||||
int32_t getAddend() const{
|
||||
return addend;
|
||||
}
|
||||
|
||||
void * getDestination() {
|
||||
void * getDestination() const{
|
||||
return destination;
|
||||
}
|
||||
|
||||
std::string getName() {
|
||||
std::string getName() const{
|
||||
return name;
|
||||
}
|
||||
|
||||
ImportRPLInformation * getImportRPLInformation() {
|
||||
ImportRPLInformation getImportRPLInformation() const{
|
||||
return rplInfo;
|
||||
}
|
||||
|
||||
std::string toString();
|
||||
std::string toString() const;
|
||||
private:
|
||||
char type;
|
||||
size_t offset;
|
||||
int32_t addend;
|
||||
void *destination;
|
||||
std::string name;
|
||||
ImportRPLInformation * rplInfo;
|
||||
const ImportRPLInformation rplInfo;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user