summaryrefslogtreecommitdiff
path: root/bxgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'bxgen.c')
-rwxr-xr-xbxgen.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/bxgen.c b/bxgen.c
index a300627..9e6e92b 100755
--- a/bxgen.c
+++ b/bxgen.c
@@ -1461,6 +1461,7 @@ typedef struct {
Offset_Size name;
u8 type;
u8 bind;
+ i64 section;
Offset_Size value;
} Symbol_Entry;
@@ -1714,8 +1715,6 @@ Symbol_Entry elf_symbol(
(sym_info & 0xf) == 6 ? SYM_TLS :
SYM_SPECIFIC;
- 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 :
BIND_LOCAL;
@@ -1724,6 +1723,7 @@ Symbol_Entry elf_symbol(
.name = elf_name_in_string_table(b, string_table, sym_name),
.type = type,
.bind = bind,
+ .section = sym_shndx,
.value = {
.offset = sym_value,
.size = sym_size,
@@ -1903,14 +1903,14 @@ void elf_dump(u32 log_level, Buffer_Context b) {
rela.dst,
rela.addent,
rela.symbol.bind == BIND_WEAK ? "\x1b[33m" : "\x1b[32m",
- rela.symbol.value.offset,
- rela.symbol.type == SYM_DATA ||
- rela.symbol.type == SYM_COMMON ||
- rela.symbol.type == SYM_TLS ? " \x1b[34mdata" :
- rela.symbol.type == SYM_PROC ? " \x1b[34mproc" :
- rela.symbol.type == SYM_SECTION ? " \x1b[36msect" :
- rela.symbol.type == SYM_SPECIFIC ? " \x1b[34mspec" :
- " \x1b[33mnone",
+ rela.symbol.value.offset + elf_section(b, rela.symbol.section).data.offset,
+ rela.symbol.type == SYM_DATA ? " \x1b[34mdata" :
+ rela.symbol.type == SYM_COMMON ? " \x1b[32mdata" :
+ rela.symbol.type == SYM_TLS ? " \x1b[34mdata" :
+ rela.symbol.type == SYM_PROC ? " \x1b[34mproc" :
+ rela.symbol.type == SYM_SECTION ? " \x1b[36msect" :
+ rela.symbol.type == SYM_SPECIFIC ? " \x1b[34mspec" :
+ " \x1b[33mnone",
elf_name_from_offset(b, rela.symbol.name)
);
}
@@ -1937,14 +1937,14 @@ void elf_dump(u32 log_level, Buffer_Context b) {
REL_NAMES[rel.type],
rel.dst,
rel.symbol.bind == BIND_WEAK ? "\x1b[33m" : "\x1b[32m",
- rel.symbol.value.offset,
- rel.symbol.type == SYM_DATA ||
- rel.symbol.type == SYM_COMMON ||
- rel.symbol.type == SYM_TLS ? " \x1b[34mdata" :
- rel.symbol.type == SYM_PROC ? " \x1b[34mproc" :
- rel.symbol.type == SYM_SECTION ? " \x1b[36msect" :
- rel.symbol.type == SYM_SPECIFIC ? " \x1b[34mspec" :
- " \x1b[33mnone",
+ rel.symbol.value.offset + elf_section(b, rel.symbol.section).data.offset,
+ rel.symbol.type == SYM_DATA ? " \x1b[34mdata" :
+ rel.symbol.type == SYM_COMMON ? " \x1b[32mdata" :
+ rel.symbol.type == SYM_TLS ? " \x1b[35mdata" :
+ rel.symbol.type == SYM_PROC ? " \x1b[34mproc" :
+ rel.symbol.type == SYM_SECTION ? " \x1b[36msect" :
+ rel.symbol.type == SYM_SPECIFIC ? " \x1b[34mspec" :
+ " \x1b[33mnone",
elf_name_from_offset(b, rel.symbol.name)
);
}