diff options
| -rw-r--r-- | main.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -125,6 +125,8 @@ getsection(const char* name) static void initsections(void) { + Elf64_Sym elfsym; + shstrtab = newsection(); secaddbyte(shstrtab, 0); shstrtab->hdr.sh_name = elfstr(shstrtab, ".shstrtab"); @@ -140,6 +142,8 @@ initsections(void) symtab->hdr.sh_type = SHT_SYMTAB; symtab->hdr.sh_link = strtab->idx; symtab->hdr.sh_entsize = sizeof(Elf64_Sym); + memset(&elfsym, 0, sizeof(elfsym)); + secaddbytes(symtab, &elfsym, sizeof(Elf64_Sym)); bss = newsection(); bss->hdr.sh_name = elfstr(shstrtab, ".bss"); @@ -827,7 +831,7 @@ relaxreset(void) for (i = 0; i < nsections; i++) { sec = §ions[i]; - if (sec == shstrtab) + if (sec == shstrtab || sec == strtab || sec == symtab) continue; sec->hdr.sh_size = 0; } @@ -871,13 +875,9 @@ addtosymtab(Symbol* sym) static void fillsymtab(void) { - Elf64_Sym elfsym; Symbol* sym; size_t i; - memset(&elfsym, 0, sizeof(elfsym)); - secaddbytes(symtab, &elfsym, sizeof(Elf64_Sym)); - // Local symbols for (i = 0; i < symbols->cap; i++) { if (!symbols->keys[i].str) |
