summaryrefslogtreecommitdiff
path: root/rts/linker/elf_util.c
blob: 052b2d9caed2ec0e0222b934e9d1b36d4c9372bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "linker/elf_util.h"

#if defined(OBJFORMAT_ELF)

ElfSymbolTable *
findSymbolTable(ObjectCode * oc, unsigned symbolTableIndex) {
    for(ElfSymbolTable * t=oc->info->symbolTables; t != NULL; t = t->next)
        if(t->index == symbolTableIndex)
            return t;
    return NULL;
}

ElfSymbol *
findSymbol(ObjectCode * oc, unsigned symbolTableIndex,
           unsigned long symbolIndex) {
    ElfSymbolTable * t = findSymbolTable(oc, symbolTableIndex);
    if(NULL != t && symbolIndex < t->n_symbols) {
        return &t->symbols[symbolIndex];
    }
    return NULL;
}

#endif