From 5868bb32246367139f0d17a989650964f90a7958 Mon Sep 17 00:00:00 2001 From: norly Date: Sat, 15 Jun 2013 16:27:28 +0100 Subject: Merge symbol tables. (Not fully ELF conformant) Also, remove that nameptr member from symbols. It just *had* to cause trouble. Symbols are simply appended to the target's symbol table, which means that LOCAL symbols are not inserted at the beginning and we are thus ignoring an ELF spec. Might change that in the future, it's good enough for now and it's sure not to break anything with the old symbols. The code currently assumes that the target *has* a symbol table. We'll have to fix that, and also remove undefined and duplicate symbols. --- src/modelops/fromFile.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'src/modelops/fromFile.c') diff --git a/src/modelops/fromFile.c b/src/modelops/fromFile.c index c46dd6c..28ecb85 100644 --- a/src/modelops/fromFile.c +++ b/src/modelops/fromFile.c @@ -5,17 +5,6 @@ #include -static char* symstr(ElfuScn *symtab, size_t off) -{ - assert(symtab); - assert(symtab->linkptr); - assert(symtab->linkptr->data.d_buf); - assert(off < symtab->linkptr->data.d_size); - - return &(((char*)symtab->linkptr->data.d_buf)[off]); -} - - static void parseSymtab32(ElfuScn *ms, ElfuScn**origScnArr) { size_t i; @@ -31,19 +20,18 @@ static void parseSymtab32(ElfuScn *ms, ElfuScn**origScnArr) assert(sym); sym->name = cursym->st_name; - sym->nameptr = symstr(ms, cursym->st_name); sym->value = cursym->st_value; sym->size = cursym->st_size; sym->bind = ELF32_ST_BIND(cursym->st_info); sym->type = ELF32_ST_TYPE(cursym->st_info); sym->other = cursym->st_other; + sym->shndx = cursym->st_shndx; switch (cursym->st_shndx) { case SHN_UNDEF: case SHN_ABS: case SHN_COMMON: sym->scnptr = NULL; - sym->shndx = cursym->st_shndx; break; default: sym->scnptr = origScnArr[cursym->st_shndx - 1]; -- cgit v1.2.3