remove redundant code and prepare sections for symbol parsing
This commit is contained in:
parent
fe31879dd6
commit
1abe051db0
2 changed files with 18 additions and 5 deletions
|
|
@ -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);
|
return RELF_ERROR(RELF_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,11 +75,6 @@ typedef struct {
|
||||||
uint64_t entsize;
|
uint64_t entsize;
|
||||||
} relf_section_t;
|
} relf_section_t;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
const char** strings;
|
|
||||||
unsigned string_num;
|
|
||||||
} relf_string_table_t;
|
|
||||||
|
|
||||||
// relf instance
|
// relf instance
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void* image;
|
void* image;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue