summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2024-07-19 14:25:27 +0200
committerMitya Selivanov <automainint@guattari.tech>2024-07-19 14:25:27 +0200
commit5cf65bed5e3112e72bb4619d8372c9c649ca8753 (patch)
tree8bd5dd8608dab86753d505da1a4f298a28e8ce5d
parentd37f496059bba635eeb4ecd4262b9a05f088d09d (diff)
downloadbxgen-5cf65bed5e3112e72bb4619d8372c9c649ca8753.zip
Separate ELF dump function
-rwxr-xr-xbxgen.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/bxgen.c b/bxgen.c
index f2fafe2..a300627 100755
--- a/bxgen.c
+++ b/bxgen.c
@@ -1706,13 +1706,6 @@ Symbol_Entry elf_symbol(
i64 sym_value = read_i64(LE, begin + 8, end);
i64 sym_size = read_i64(LE, begin + 16, end);
- Offset_Size dst =
- sym_shndx >= 0 &&
- sym_shndx < elf_section_headers(b).num ? elf_section(b, sym_shndx).data
- : (Offset_Size) {0};
-
- BX_CHECK(dst.size == 0 || sym_value + sym_size <= dst.size, "Buffer overflow", (Symbol_Entry) {0});
-
u8 type = (sym_info & 0xf) == 0 ? SYM_NONE :
(sym_info & 0xf) == 1 ? SYM_DATA :
(sym_info & 0xf) == 2 ? SYM_PROC :
@@ -1721,7 +1714,7 @@ Symbol_Entry elf_symbol(
(sym_info & 0xf) == 6 ? SYM_TLS :
SYM_SPECIFIC;
- BX_CHECK(type != SYM_NONE || (sym_info & 0xf) == 0, "Unknown symbol type", (Symbol_Entry) {0});
+ BX_CHECK(type == SYM_SPECIFIC, "Unknown symbol type", (Symbol_Entry) {0});
u8 bind = (sym_info >> 4) == 1 ? BIND_GLOBAL :
(sym_info >> 4) == 2 ? BIND_WEAK :
@@ -1732,7 +1725,7 @@ Symbol_Entry elf_symbol(
.type = type,
.bind = bind,
.value = {
- .offset = dst.offset + sym_value,
+ .offset = sym_value,
.size = sym_size,
},
};