RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
reference.h
1#ifndef REFERENCE_H
2#define REFERENCE_H
3
4#include <fstream>
5#include <optional>
6#include <string>
7#include <variant>
8#include "module.h"
9#include "writer.h"
10
11namespace Linker
12{
19 {
20 public:
21 std::optional<std::string> segment;
22 std::variant<std::string, offset_t> offset;
23
24 Reference(std::variant<std::string, offset_t> offset = offset_t(0))
25 : segment(), offset(offset)
26 {
27 }
28
29 Reference(std::string segment, std::variant<std::string, offset_t> offset = offset_t(0))
30 : segment(segment), offset(offset)
31 {
32 }
33
37 Location ToLocation(Module& module) const;
38 };
39
40 std::ostream& operator<<(std::ostream& out, const Reference& ref);
41}
42
43#endif /* REFERENCE_H */
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
Represents a reference stored in a linker script.
Definition reference.h:19
Location ToLocation(Module &module) const
Converts to location, resolving the symbol if it is a symbol.
Definition reference.cc:14