Allocate everything on the stack instead of the heap

This commit is contained in:
Maschell
2020-05-17 13:11:52 +02:00
parent d36ad9bf3d
commit b526acbded
20 changed files with 146 additions and 181 deletions

View File

@@ -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;