10#include "relocation.h"
53 std::vector<std::shared_ptr<Section>> sections;
54 std::map<std::string, std::shared_ptr<Section>> section_names;
55 std::map<std::string, Location> symbols;
56 std::map<std::string, Location> local_symbols;
57 std::map<std::string, CommonSymbol> unallocated_symbols;
58 std::vector<SymbolName> imported_symbols;
59 std::map<ExportedSymbol, Location> exported_symbols;
72 void SetupOptions(
char special_char, std::shared_ptr<OutputFormat> output_format, std::shared_ptr<InputFormat> input_format);
76 char special_prefix_char =
'$';
77 std::weak_ptr<Linker::OutputFormat> output_format;
78 std::weak_ptr<Linker::InputFormat> input_format;
81 std::string segment_prefix();
82 std::string segment_of_prefix();
83 std::string segment_at_prefix();
84 std::string with_respect_to_segment_prefix();
85 std::string segment_difference_prefix();
86 std::string import_prefix();
87 std::string segment_of_import_prefix();
88 std::string export_prefix();
89 std::string fix_byte_prefix();
92 std::string resource_prefix();
103 void _AddLocalSymbol(std::string name,
Location location);
111 void _AddGlobalSymbol(std::string name,
Location location);
162 void AddSection(std::shared_ptr<Section> section);
165 void _AddSection(std::shared_ptr<Section> section);
171 const std::vector<std::shared_ptr<Section>>&
Sections()
const;
186 std::shared_ptr<Section>
FindSection(std::string name);
191 std::shared_ptr<Section>
FetchSection(std::string name,
unsigned default_flags);
201 void Append(std::shared_ptr<Section> dst, std::shared_ptr<Section> src);
Represents a currently unallocated variable that should be allocated in the final stages of the linki...
Definition symbol.h:224
Represents a symbol to be exported from the module.
Definition symbol.h:119
Represents a single offset within a section, or an absolute location in memory if the section is null...
Definition location.h:17
Encodes an object module file as a collection of sections, symbols and relocations.
Definition module.h:20
std::shared_ptr< Section > FindSection(std::string name)
Searches for a section with a specific name.
Definition module.cc:491
const std::vector< SymbolName > & GetImportedSymbols() const
Retrieves list of all imported symbols.
Definition module.cc:398
void SetupOptions(char special_char, std::shared_ptr< OutputFormat > output_format, std::shared_ptr< InputFormat > input_format)
Initializes the reader for linking purposes.
Definition module.cc:7
void Append(std::shared_ptr< Section > dst, std::shared_ptr< Section > src)
Appends two of its sections.
Definition module.cc:525
const std::vector< std::shared_ptr< Section > > & Sections() const
Retrieves list of all sections.
Definition module.cc:474
void AddExportedSymbol(ExportedSymbol name, Location symbol)
Adds an exported symbol.
Definition module.cc:207
std::shared_ptr< Section > FetchSection(std::string name, unsigned default_flags)
Searches or creates a section with a specific name, with the assigned flags.
Definition module.cc:497
void AddCommonSymbol(std::string name, CommonSymbol symbol)
Adds a common symbol.
Definition module.cc:194
void AddSection(std::shared_ptr< Section > section)
Adds a new section.
Definition module.cc:426
bool FindGlobalSymbol(std::string name, Location &location)
Searches for a global symbol.
Definition module.cc:417
void RemoveSections()
Removes all sections from internal list, without deleting them.
Definition module.cc:485
void AddImportedSymbol(SymbolName name)
Adds an imported symbol.
Definition module.cc:199
cpu_type
Supported CPU types.
Definition module.h:26
bool FindLocalSymbol(std::string name, Location &location)
Searches for a local symbol.
Definition module.cc:408
void ResolveRelocations()
Attempts to resolve the targets of all relocations.
Definition module.cc:508
void AddUndefinedSymbol(std::string symbol_name)
Processes undefined symbol for extended syntax.
Definition module.cc:212
void DeleteSection(size_t index)
Deletes a specific sections.
Definition module.cc:479
void AddLocalSymbol(std::string name, Location location)
Adds an internal symbol.
Definition module.cc:138
cpu_type cpu
Encodes the CPU for the target.
Definition module.h:51
const std::map< ExportedSymbol, Location > & GetExportedSymbols() const
Retrieves map of all exported symbols and their locations.
Definition module.cc:403
std::vector< Relocation > relocations
List of relocations within the module.
Definition module.h:64
void AddGlobalSymbol(std::string name, Location location)
Adds and processes exported symbol for extended syntax.
Definition module.cc:162
void AddRelocation(Relocation relocation)
Adds and processes relocation for extended syntax.
Definition module.cc:254
void AllocateSymbols()
All common symbols are converted to global symbols and assigned addresses within a "....
Definition module.cc:630
A representation of a value within some binary data that has to be fixed up once the exact position o...
Definition relocation.h:27
Represents an (imported or internal) symbol name, which can be more complex than a string.
Definition symbol.h:18