From 0c8ad22d45ea74b1687cc3b6f452c5a0939873a5 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Thu, 12 Sep 2024 08:37:46 -0400 Subject: big endian --- masm/symtab.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'masm/symtab.c') diff --git a/masm/symtab.c b/masm/symtab.c index 897c4f9..c6f9aac 100644 --- a/masm/symtab.c +++ b/masm/symtab.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -21,6 +22,10 @@ int symtab_init(struct symbol_table *symtab) return M_ERROR; } + Elf32_Sym null = {0}; + if (symtab_push(symtab, null, -1)) + return M_ERROR; + return M_SUCCESS; } @@ -54,7 +59,7 @@ int symtab_find(struct symbol_table *symtab, Elf32_Sym **ptr, { for (uint32_t i = 0; i < symtab->len; i++) { Elf32_Sym *sym = &symtab->symbols[i]; - const char *str = &symtab->strtab->ptr[sym->st_name]; + const char *str = &symtab->strtab->ptr[ntohl(sym->st_name)]; if (strcmp(str, name) == 0) { if (ptr != NULL) *ptr = sym; -- cgit v1.2.3-freya