12typedef uint64_t offset_t;
13typedef int64_t relative_offset_t;
14typedef size_t number_t;
25static constexpr EndianType ByteSwapped(EndianType endian_type)
30 return UndefinedEndian;
36 return AntiPDP11Endian;
43extern EndianType DefaultEndianType;
48size_t GetOffset(EndianType endiantype,
size_t bytes,
size_t index);
53offset_t AlignTo(offset_t value, offset_t align);
58uint16_t Swap16(uint16_t value);
63uint16_t FromLittleEndian16(uint16_t value);
68uint16_t FromBigEndian16(uint16_t value);
73uint32_t Swap32(uint32_t value);
78uint32_t Swap32words(uint32_t value);
83uint32_t FromLittleEndian32(uint32_t value);
88uint32_t FromBigEndian32(uint32_t value);
93uint32_t FromPDP11Endian32(uint32_t value);
98uint64_t Swap64(uint64_t value);
103uint64_t Swap64words(uint64_t value);
108uint64_t FromLittleEndian64(uint64_t value);
110uint64_t FromBigEndian64(uint64_t value);
112uint64_t FromPDP11Endian64(uint64_t value);
117uint64_t ReadUnsigned(
size_t bytes,
size_t maximum, uint8_t
const * data, EndianType endiantype);
122int64_t SignExtend(
size_t bytes, int64_t value);
127int64_t ReadSigned(
size_t bytes,
size_t maximum, uint8_t
const * data, EndianType endiantype);
132void WriteWord(
size_t bytes,
size_t maximum, uint8_t * data, uint64_t value, EndianType endiantype);
134bool LookupOption(std::map<std::string, std::string>& options, std::string key, std::string& value);
138 inline bool operator()(
const std::string& first,
const std::string& second)
const
140 return std::lexicographical_compare(first.begin(), first.end(), second.begin(), second.end(),
141 [](
char c1,
char c2) ->
bool { return std::tolower(static_cast<unsigned char>(c1)) < std::tolower(static_cast<unsigned char>(c2)); });
150bool starts_with(std::string str, std::string start);
157bool ends_with(std::string str, std::string end);
165 Exception(std::string message) : message(message)
171 extern std::ostream Debug;
172 extern std::ostream Warning;
173 extern std::ostream Error;
175 [[noreturn]]
void FatalError(std::string message);
179 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