0e5d903817511b5691553ba3a330e2e217d88a75
[centaur.git] / src / model / section-name.c
1 #include <assert.h>
2 #include <stdlib.h>
3
4 #include <libelf.h>
5 #include <gelf.h>
6
7 #include <libelfu/libelfu.h>
8
9
10
11 char* elfu_modelScnName(ElfuElf *me, ElfuScn *ms)
12 {
13   assert(me);
14   assert(ms);
15
16   if (!me->shstrtab) {
17     return NULL;
18   }
19
20   if (CIRCLEQ_EMPTY(&me->shstrtab->dataList)) {
21     return NULL;
22   }
23
24   /* Don't take multiple data parts into account. */
25   ElfuData *md = me->shstrtab->dataList.cqh_first;
26   return &((char*)md->data.d_buf)[ms->shdr.sh_name];
27 }