12typedef uint64_t offset_t;
13typedef int64_t relative_offset_t;
14typedef size_t number_t;
25extern EndianType DefaultEndianType;
30size_t GetOffset(EndianType endiantype,
size_t bytes,
size_t index);
35offset_t AlignTo(offset_t value, offset_t align);
40uint16_t Swap16(uint16_t value);
45uint16_t FromLittleEndian16(uint16_t value);
50uint16_t FromBigEndian16(uint16_t value);
55uint32_t Swap32(uint32_t value);
60uint32_t Swap32words(uint32_t value);
65uint32_t FromLittleEndian32(uint32_t value);
70uint32_t FromBigEndian32(uint32_t value);
75uint32_t FromPDP11Endian32(uint32_t value);
80uint64_t Swap64(uint64_t value);
85uint64_t Swap64words(uint64_t value);
90uint64_t FromLittleEndian64(uint64_t value);
92uint64_t FromBigEndian64(uint64_t value);
94uint64_t FromPDP11Endian64(uint64_t value);
99uint64_t ReadUnsigned(
size_t bytes,
size_t maximum, uint8_t
const * data, EndianType endiantype);
104int64_t SignExtend(
size_t bytes, int64_t value);
109int64_t ReadSigned(
size_t bytes,
size_t maximum, uint8_t
const * data, EndianType endiantype);
114void WriteWord(
size_t bytes,
size_t maximum, uint8_t * data, uint64_t value, EndianType endiantype);
116bool LookupOption(std::map<std::string, std::string>& options, std::string key, std::string& value);
120 inline bool operator()(
const std::string& first,
const std::string& second)
const
122 return std::lexicographical_compare(first.begin(), first.end(), second.begin(), second.end(),
123 [](
char c1,
char c2) ->
bool { return std::tolower(static_cast<unsigned char>(c1)) < std::tolower(static_cast<unsigned char>(c2)); });
132bool starts_with(std::string str, std::string start);
139bool ends_with(std::string str, std::string end);
147 Exception(std::string message) : message(message)
153 extern std::ostream Debug;
154 extern std::ostream Warning;
155 extern std::ostream Error;
157 [[noreturn]]
void FatalError(std::string message);
161 typedef std::map<std::shared_ptr<Section>,
Location> Displacement;
Represents a single offset within a section, or an absolute location in memory if the section is null...
Definition location.h:17
A section of data as read from an object file.
Definition section.h:28