From 5cf65bed5e3112e72bb4619d8372c9c649ca8753 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Fri, 19 Jul 2024 14:25:27 +0200 Subject: Separate ELF dump function --- bxgen.c | 11 ++--------- 1 file 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, }, }; -- cgit v1.2.3