remove redundant code and prepare sections for symbol parsing

This commit is contained in:
mykola2312 2024-08-25 20:23:11 +03:00
parent fe31879dd6
commit 1abe051db0
2 changed files with 18 additions and 5 deletions

View file

@ -235,6 +235,24 @@ relf_value_t relf_open(relf_t* relf, const char* path)
}
}
// find section we're gonna use later
const relf_section_t* strtab = NULL, *symtab = NULL;
for (unsigned i = 0; i < relf->section_num; i++)
{
const relf_section_t* section = &relf->sections[i];
switch (section->type)
{
case SHT_STRTAB:
// we need symbol string table
if (i != e_shstrndx)
strtab = section;
break;
case SHT_SYMTAB:
symtab = section;
break;
}
}
return RELF_ERROR(RELF_OK);
}

View file

@ -75,11 +75,6 @@ typedef struct {
uint64_t entsize;
} relf_section_t;
typedef struct {
const char** strings;
unsigned string_num;
} relf_string_table_t;
// relf instance
typedef struct {
void* image;