summaryrefslogtreecommitdiff
path: root/common.h
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2023-06-04 21:58:39 +0300
committerOxore <oxore@protonmail.com>2023-06-04 23:26:13 +0300
commita3f3fb052678b9cf1f80bbdc72c42afc3705ac0b (patch)
treef45953c256f4e463f073afcdc920c916afc4c0d1 /common.h
parentb5c24afbc10a36f65e73d5ef2100da4ff173a109 (diff)
Add initial support of ELF files
Diffstat (limited to 'common.h')
-rw-r--r--common.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/common.h b/common.h
index 97dfe7c..dddde52 100644
--- a/common.h
+++ b/common.h
@@ -1,7 +1,16 @@
+#pragma once
+
/* SPDX-License-Identifier: Unlicense
*/
-#pragma once
+#include <cstddef>
+#include <cstdint>
+
+enum class BFDTarget {
+ kAuto,
+ kBinary,
+ kELF,
+};
struct Settings {
bool raw_data_comment{};
@@ -16,6 +25,7 @@ struct Settings {
bool xrefs_to{};
bool xrefs_from{};
bool imm_hex{};
+ BFDTarget bfd{};
const char *indent{"\t"};
};
@@ -54,17 +64,17 @@ constexpr size_t kDisasmMapSizeElements = kRomSizeBytes / kInstructionSizeStepBy
static inline constexpr size_t Min(size_t a, size_t b) { return a < b ? a : b; }
-static inline constexpr uint16_t GetU16BE(uint8_t *buffer)
+static inline constexpr uint16_t GetU16BE(const uint8_t *buffer)
{
return (static_cast<uint16_t>(buffer[0]) << 8) | static_cast<uint16_t>(buffer[1]);
}
-static inline constexpr int16_t GetI16BE(uint8_t *buffer)
+static inline constexpr int16_t GetI16BE(const uint8_t *buffer)
{
return (static_cast<uint16_t>(buffer[0]) << 8) | static_cast<uint16_t>(buffer[1]);
}
-static inline constexpr int32_t GetI32BE(uint8_t *buffer)
+static inline constexpr int32_t GetI32BE(const uint8_t *buffer)
{
return (static_cast<uint32_t>(buffer[0]) << 24) |
(static_cast<uint32_t>(buffer[1]) << 16) |