RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
COFF::COFFFormat::Section Class Reference

A COFF section. More...

#include <coff.h>

Inheritance diagram for COFF::COFFFormat::Section:
Microsoft::PEFormat::Section Microsoft::PEFormat::BaseRelocationsSection Microsoft::PEFormat::ExportsSection Microsoft::PEFormat::ImportsSection Microsoft::PEFormat::ResourcesSection

Classes

struct  COFF_Flags
 
struct  ECOFF_Flags
 
struct  PECOFF_Flags
 
struct  TICOFF_Flags
 
struct  XCOFF_Flags
 

Public Member Functions

void Clear ()
 
 Section (uint32_t flags=0, std::shared_ptr< Linker::Contents > image=nullptr)
 
bool PresentInFile (COFFVariantType coff_variant) const
 
bool PresentInMemory (COFFVariantType coff_variant) const
 
void ReadSectionHeader (Linker::Reader &rd, COFFFormat &coff_format)
 Reads an entry in the section header table.
 
void WriteSectionHeader (Linker::Writer &wr, const COFFFormat &coff_format)
 Writes an entry in the section header table.
 
virtual uint32_t ImageSize (const COFFFormat &coff_format) const
 Retrieves the size of the section (for PE, the size of the section as stored in the file)
 
virtual void ReadSectionData (Linker::Reader &rd, const COFFFormat &coff_format)
 Reads the section contents from a stream, can be overloaded by subclasses.
 
virtual void WriteSectionData (Linker::Writer &wr, const COFFFormat &coff_format) const
 Writes the section contents to a stream, can be overloaded by subclasses.
 
virtual void Dump (Dumper::Dumper &dump, const COFFFormat &format, unsigned section_index) const
 Displays the section information and contents.
 

Public Attributes

std::string name
 The name of the section (COFF name: s_name)
 
offset_t physical_address = 0
 The physical address of the section (expected to be identical to the virtual address) (COFF name: s_paddr)
 
offset_t address = 0
 The virtual address of the section (COFF name: s_vaddr)
 
offset_t size = 0
 The size of the section (COFF name: s_size)
 
offset_t section_pointer = 0
 Offset of stored image data from COFF header start (COFF name: s_scnptr)
 
offset_t relocation_pointer = 0
 Offset to COFF relocations (COFF name: s_relptr)
 
offset_t line_number_pointer = 0
 unused (COFF name: s_lnnoptr)
 
uint32_t relocation_count = 0
 COFF relocation count (COFF name: s_nreloc)
 
uint32_t line_number_count = 0
 unused (COFF name: s_nlnno)
 
uint32_t flags = 0
 COFF section flags, determines the type of the section (text, data, bss, etc.) (COFF name: s_flags)
 
uint16_t memory_page_number = 0
 TICOFF specific field.
 
std::shared_ptr< Linker::Contentsimage
 The stored image data.
 
std::vector< std::unique_ptr< Relocation > > relocations
 Collection of COFF relocations.
 

Static Public Attributes

static constexpr uint32_t TEXT = 0x0020
 COFF section flag: Section contains executable instructions (COFF name: STYP_TEXT)
 
static constexpr uint32_t DATA = 0x0040
 COFF section flag: Section contains initialized data (COFF name: STYP_DATA)
 
static constexpr uint32_t BSS = 0x0080
 COFF section flag: Section contains uninitialized data (COFF name: STYP_BSS)
 

Detailed Description

A COFF section.

Member Data Documentation

◆ physical_address

offset_t COFF::COFFFormat::Section::physical_address = 0

The physical address of the section (expected to be identical to the virtual address) (COFF name: s_paddr)

For PE/COFF, this field is reinterpreted as the size of the section in memory


The documentation for this class was generated from the following files: