summaryrefslogtreecommitdiff
path: root/src/model/section-name.c
blob: 0e5d903817511b5691553ba3a330e2e217d88a75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <assert.h>
#include <stdlib.h>

#include <libelf.h>
#include <gelf.h>

#include <libelfu/libelfu.h>



char* elfu_modelScnName(ElfuElf *me, ElfuScn *ms)
{
  assert(me);
  assert(ms);

  if (!me->shstrtab) {
    return NULL;
  }

  if (CIRCLEQ_EMPTY(&me->shstrtab->dataList)) {
    return NULL;
  }

  /* Don't take multiple data parts into account. */
  ElfuData *md = me->shstrtab->dataList.cqh_first;
  return &((char*)md->data.d_buf)[ms->shdr.sh_name];
}