RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
|
The smallest unit of a Hunk file, it starts with a type word. A HUNK_END or HUNK_BREAK block is represented by this. More...
#include <hunk.h>
Public Types | |
enum | block_type { HUNK_UNIT = 0x3E7 , HUNK_NAME = 0x3E8 , HUNK_CODE = 0x3E9 , HUNK_DATA = 0x3EA , HUNK_BSS = 0x3EB , HUNK_ABSRELOC32 = 0x3EC , HUNK_RELRELOC16 = 0x3ED , HUNK_RELRELOC8 = 0x3EE , HUNK_EXT = 0x3EF , HUNK_SYMBOL = 0x3F0 , HUNK_DEBUG = 0x3F1 , HUNK_END = 0x3F2 , HUNK_HEADER = 0x3F3 , HUNK_OVERLAY = 0x3F5 , HUNK_BREAK = 0x3F6 , HUNK_DRELOC32 = 0x3F7 , HUNK_DRELOC16 = 0x3F8 , HUNK_DRELOC8 = 0x3F9 , HUNK_LIB = 0x3FA , HUNK_INDEX = 0x3FB , HUNK_RELOC32SHORT = 0x3FC , HUNK_RELRELOC32 = 0x3FD , HUNK_ABSRELOC16 = 0x3FE , HUNK_PPC_CODE = 0x4E9 , HUNK_RELRELOC26 = 0x4EC , HUNK_V37_RELOC32SHORT = 0x3F7 } |
Public Member Functions | |
Block (block_type type, bool is_executable=false) | |
virtual void | Read (Linker::Reader &rd) |
Reads the rest of the block after the type word. | |
virtual void | Write (Linker::Writer &wr) const |
Writes the entire block into a file. | |
virtual offset_t | FileSize () const |
Returns the size of the block as stored inside a file. | |
virtual void | Dump (Dumper::Dumper &dump, const Module &module, const Hunk *hunk, unsigned index, offset_t current_offset) const |
void | AddCommonFields (Dumper::Region ®ion, unsigned index) const |
virtual void | AddExtraFields (Dumper::Region ®ion, const Module &module, const Hunk *hunk, unsigned index, offset_t current_offset) const |
Static Public Member Functions | |
static std::shared_ptr< Block > | ReadBlock (Linker::Reader &rd, bool is_executable=false) |
Reads a single block from file. | |
Public Attributes | |
block_type | type |
bool | is_executable = false |
Required because V37 executables define HUNK_DRELOC32 as HUNK_RELOC32SHORT, must block types ignore this field and it is not stored. | |
The smallest unit of a Hunk file, it starts with a type word. A HUNK_END or HUNK_BREAK block is represented by this.
Enumerator | |
---|---|
HUNK_UNIT | First block inside an object file. |
HUNK_NAME | Name of hunk. |
HUNK_CODE | First block of a code segment (hunk) containing Motorola 68k instructions. |
HUNK_DATA | First block of a data segment (hunk) |
HUNK_BSS | First block of a bss segment (hunk) |
HUNK_ABSRELOC32 | Block containing 32-bit relocations. |
HUNK_RELRELOC16 | Block containing 16-bit PC-relative relocations. |
HUNK_RELRELOC8 | Block containing 8-bit PC-relative relocations. |
HUNK_EXT | Block containing externally visible references. |
HUNK_SYMBOL | Block containing a symbol table. |
HUNK_DEBUG | Debug information. |
HUNK_END | Block terminates a hunk. |
HUNK_HEADER | First block inside an executable or library file. |
HUNK_DRELOC32 | Block containing 32-bit data section relative relocations. |
HUNK_DRELOC16 | Block containing 16-bit data section relative relocations. |
HUNK_DRELOC8 | Block containing 8-bit data section relative relocations. |
HUNK_RELOC32SHORT | Block containing 32-bit relocations in a compactified form. |
HUNK_RELRELOC32 | Block containing 32-bit PC-relative relocations. |
HUNK_ABSRELOC16 | Block containing 8-bit relocations. |
HUNK_PPC_CODE | First block of a code segment (hunk) containing PowerPC instructions. |
HUNK_RELRELOC26 | Block containing 26-bit PC-relative relocations inside 4-byte words. |
HUNK_V37_RELOC32SHORT | V37 Block containing 32-bit relocations in a compactified form, only found in executables. |
|
virtual |
Returns the size of the block as stored inside a file.
Reimplemented in Amiga::HunkFormat::TextBlock, Amiga::HunkFormat::HeaderBlock, Amiga::HunkFormat::RelocatableBlock, Amiga::HunkFormat::BssBlock, Amiga::HunkFormat::RelocationBlock, Amiga::HunkFormat::SymbolBlock, Amiga::HunkFormat::DebugBlock, Amiga::HunkFormat::OverlayBlock, Amiga::HunkFormat::LibraryBlock, and Amiga::HunkFormat::IndexBlock.
|
virtual |
Reads the rest of the block after the type word.
Reimplemented in Amiga::HunkFormat::TextBlock, Amiga::HunkFormat::HeaderBlock, Amiga::HunkFormat::RelocatableBlock, Amiga::HunkFormat::RelocationBlock, Amiga::HunkFormat::SymbolBlock, Amiga::HunkFormat::DebugBlock, Amiga::HunkFormat::OverlayBlock, Amiga::HunkFormat::LibraryBlock, and Amiga::HunkFormat::IndexBlock.
|
static |
Reads a single block from file.
rd | The reader |
is_executable | If file is executable, false if object or not known |
|
virtual |
Writes the entire block into a file.
Reimplemented in Amiga::HunkFormat::TextBlock, Amiga::HunkFormat::HeaderBlock, Amiga::HunkFormat::RelocatableBlock, Amiga::HunkFormat::RelocationBlock, Amiga::HunkFormat::SymbolBlock, Amiga::HunkFormat::DebugBlock, Amiga::HunkFormat::OverlayBlock, Amiga::HunkFormat::LibraryBlock, and Amiga::HunkFormat::IndexBlock.