diff options
author | Freya Murphy <freya@freyacat.org> | 2024-09-12 08:37:46 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-09-12 08:37:46 -0400 |
commit | 0c8ad22d45ea74b1687cc3b6f452c5a0939873a5 (patch) | |
tree | 8ab44b1048e73f52ee9e597f85fff38e277801b9 /masm/symtab.c | |
parent | add ascii and asciiz directives, fix symtab bug (diff) | |
download | mips-0c8ad22d45ea74b1687cc3b6f452c5a0939873a5.tar.gz mips-0c8ad22d45ea74b1687cc3b6f452c5a0939873a5.tar.bz2 mips-0c8ad22d45ea74b1687cc3b6f452c5a0939873a5.zip |
big endian
Diffstat (limited to 'masm/symtab.c')
-rw-r--r-- | masm/symtab.c | 7 |
1 files changed, 6 insertions, 1 deletions
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 <elf.h> #include <merror.h> +#include <netinet/in.h> #include <stddef.h> #include <stdio.h> #include <stdlib.h> @@ -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; |