summaryrefslogtreecommitdiff
path: root/rts/linker/elf_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'rts/linker/elf_util.c')
-rw-r--r--rts/linker/elf_util.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/rts/linker/elf_util.c b/rts/linker/elf_util.c
new file mode 100644
index 0000000000..bdfab22ace
--- /dev/null
+++ b/rts/linker/elf_util.c
@@ -0,0 +1,24 @@
+#include "linker/elf_util.h"
+#include "ElfTypes.h"
+
+#if defined(OBJFORMAT_ELF)
+
+ElfSymbolTable *
+find_symbol_table(ObjectCode * oc, unsigned symolTableIndex) {
+ for(ElfSymbolTable * t=oc->info->symbolTables; t != NULL; t = t->next)
+ if(t->index == symolTableIndex)
+ return t;
+ return NULL;
+}
+
+ElfSymbol *
+find_symbol(ObjectCode * oc, unsigned symbolTableIndex, unsigned long
+symbolIndex) {
+ ElfSymbolTable * t = find_symbol_table(oc, symbolTableIndex);
+ if(NULL != t && symbolIndex < t->n_symbols) {
+ return &t->symbols[symbolIndex];
+ }
+ return NULL;
+}
+
+#endif