mirror of
https://github.com/hedge-dev/XenonRecomp.git
synced 2025-07-23 05:23:59 +00:00
Symbol table
This commit is contained in:
@@ -1,16 +1,10 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <expected>
|
||||
|
||||
struct Section;
|
||||
enum SectionFlags : uint8_t
|
||||
{
|
||||
SectionFlags_None = 0,
|
||||
SectionFlags_Data = 1,
|
||||
SectionFlags_Code = 2
|
||||
};
|
||||
#include <section.h>
|
||||
#include "symbol_table.h"
|
||||
|
||||
struct Image
|
||||
{
|
||||
@@ -19,7 +13,8 @@ struct Image
|
||||
uint32_t size{};
|
||||
|
||||
size_t entry_point{};
|
||||
std::vector<Section> sections{};
|
||||
std::set<Section, SectionComparer> sections{};
|
||||
SymbolTable symbols{};
|
||||
|
||||
/**
|
||||
* \brief Map data to image by RVA
|
||||
@@ -46,28 +41,4 @@ struct Image
|
||||
static std::expected<Image, int> ParseImage(const uint8_t* data, size_t size);
|
||||
};
|
||||
|
||||
struct Section
|
||||
{
|
||||
std::string name{};
|
||||
size_t base{};
|
||||
uint32_t size{};
|
||||
SectionFlags flags{};
|
||||
uint8_t* data{};
|
||||
|
||||
bool operator<(size_t address) const
|
||||
{
|
||||
return address < base;
|
||||
}
|
||||
|
||||
bool operator>(size_t address) const
|
||||
{
|
||||
return address >= (base + size);
|
||||
}
|
||||
|
||||
bool operator==(size_t address) const
|
||||
{
|
||||
return address >= base && address < base + size;
|
||||
}
|
||||
};
|
||||
|
||||
Image ElfLoadImage(const uint8_t* data, size_t size);
|
||||
|
Reference in New Issue
Block a user