RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
|
A generated Global Offset Table. More...
#include <table_section.h>
Public Member Functions | |
GlobalOffsetTable (::EndianType endian_type, std::string name, int flags=Readable) | |
GlobalOffsetTable (std::string name, int flags=Readable) | |
void | AddEntry (GOTEntry entry) |
![]() | |
TableSection (::EndianType endian_type, std::string name, int flags=Readable) | |
TableSection (std::string name, int flags=Readable) | |
offset_t | Size () const override |
offset_t | SetZeroFilled (bool is_zero_filled) override |
void | ReadFile (std::istream &in) override |
Overwrites section data with contents of input stream. | |
void | ReadFile (Reader &rd) override |
Overwrites section data with contents of input stream. | |
offset_t | WriteTable (OutputType &out, offset_t bytes, offset_t offset) const |
Generic function to handle writing entries. | |
offset_t | WriteFile (std::ostream &out, offset_t bytes, offset_t offset=0) const override |
Writes data into file. | |
offset_t | WriteFile (Writer &wr, offset_t bytes, offset_t offset=0) const override |
Writes data of non-zero filled sections. | |
virtual offset_t | WriteFile (std::ostream &out, offset_t bytes, offset_t offset=0) const |
Writes data into file. | |
offset_t | WriteFile (std::ostream &out) const |
Writes data into file. | |
offset_t | WriteFile (Writer &wr, offset_t count, offset_t offset=0) const override |
Writes data of non-zero filled sections. | |
virtual offset_t | WriteFile (Writer &wr, offset_t count, offset_t offset=0) const =0 |
Writes data of non-zero filled sections. | |
virtual offset_t | WriteFile (Writer &wr) const |
Writes data of non-zero filled sections. | |
void | Reset () override |
Clear the section. | |
![]() | |
Section (std::string name, int flags=Readable) | |
void | SetFlag (unsigned newflags) |
Sets the flags of the section. | |
unsigned | GetFlags () const |
bool | IsReadable () const |
void | SetReadable (bool state) |
bool | IsWritable () const |
void | SetWritable (bool state) |
bool | IsExecutable () const |
void | SetExecutable (bool state) |
bool | IsMergeable () const |
void | SetMergeable (bool state) |
bool | IsFixed () const |
bool | IsZeroFilled () const |
offset_t | GetAlign () const |
void | SetAlign (offset_t new_align) |
offset_t | GetStartAddress () const |
offset_t | GetEndAddress () const |
Returns end address (GetStartAddress() + Size()) | |
offset_t | SetAddress (offset_t new_address) |
For non-fixed segments, sets the starting address and makes the fixed. | |
void | ResetAddress (offset_t new_address) |
Forcibly alters the starting address. | |
offset_t | Expand (offset_t new_size) |
Increases the size of the section by the specified amount. | |
offset_t | RealignEnd (offset_t align) |
Expands the section to a size such that its end is at a specified alignment. | |
size_t | ReadData (size_t bytes, offset_t offset, void *buffer) const override |
Attempts to fill a buffer with data. | |
void | WriteWord (size_t bytes, offset_t offset, uint64_t value, EndianType endiantype) |
void | WriteWord (size_t bytes, offset_t offset, uint64_t value) |
void | WriteWord (size_t bytes, uint64_t value, EndianType endiantype) |
Writes value at the current end of the section. | |
void | WriteWord (size_t bytes, uint64_t value) |
Writes value at the current end of the section. | |
offset_t | Append (const void *new_data, size_t length) |
Appends data at the end of a section. | |
offset_t | Append (const char *new_data) |
Appends data at the end of a section. | |
offset_t | Append (const Section &other) |
Appends (or merges) another section. | |
offset_t | Append (Buffer &buffer) |
Appends (or merges) another writable buffer. | |
Position | Start () const |
Retrieves the address of the first byte of the section. | |
Position | Base () const |
Retrieves the address of the start of the segment of the section. | |
offset_t | WriteFile (std::ostream &out) const |
Writes data into file. | |
void | ReadFile (Reader &rd, offset_t count) |
![]() | |
Buffer (size_t size) | |
offset_t | ImageSize () const override |
Retrieves size of stored data. | |
void | ReadFile (Reader &rd, offset_t count) |
![]() | |
std::shared_ptr< const ActualImage > | AsImage () const override |
Retrieves a randomly accessible image. | |
uint64_t | ReadUnsigned (size_t bytes, offset_t offset, EndianType endiantype) const |
Reads an unsigned number at a specific offset. | |
uint64_t | ReadUnsigned (size_t bytes, offset_t offset) const |
Reads an unsigned number at a specific offset with the default endianness. | |
int64_t | ReadSigned (size_t bytes, offset_t offset, EndianType endiantype) const |
Reads a signed number at a specific offset. | |
int64_t | ReadSigned (size_t bytes, offset_t offset) const |
Reads a signed number at a specific offset with the default endianness. | |
int | GetByte (offset_t offset) const |
Retrieve byte at a certain offset (optional, might not be defined) | |
![]() | |
std::shared_ptr< ActualImage > | AsImage () |
Retrieves a randomly accessible image. | |
Additional Inherited Members | |
![]() | |
enum | section_flags { Readable = 1 << 0 , Writable = 1 << 1 , Executable = 1 << 2 , Mergeable = 1 << 3 , ZeroFilled = 1 << 4 , Fixed = 1 << 5 , Resource = 1 << 6 , Optional = 1 << 7 , Stack = 1 << 8 , Heap = 1 << 9 , CustomFlag = 1 << 10 } |
Possible flags for the section. More... | |
![]() | |
static std::shared_ptr< Section > | ReadFromFile (Reader &rd, std::string name, int flags=Readable) |
static std::shared_ptr< Section > | ReadFromFile (Reader &rd, offset_t count, std::string name, int flags=Readable) |
![]() | |
static std::shared_ptr< Buffer > | ReadFromFile (Reader &rd) |
static std::shared_ptr< Buffer > | ReadFromFile (Reader &rd, offset_t count) |
![]() | |
::EndianType | endian_type |
Endianness of table entries. | |
std::vector< GOTEntry > | entries |
List of entries to be stored in the table. | |
![]() | |
std::string | name |
Name of the section. | |
section_flags | flags |
The type of the section. | |
offset_t | bias = 0 |
Difference between the first byte of the section and the zero address associated with the section. | |
std::variant< std::string, uint16_t > | resource_type = " " |
The resource type and ID for a resource section. | |
std::variant< std::string, uint16_t > | resource_id = uint16_t(0) |
std::weak_ptr< Segment > | segment |
The segment a section belongs to. | |
std::string | collection_name |
Section name that collects sections. | |
![]() | |
std::vector< uint8_t > | data |
A generated Global Offset Table.