From 58b6f8de8862c9ccba763d3607afb5495727e4d6 Mon Sep 17 00:00:00 2001 From: norly Date: Sat, 23 Feb 2013 01:46:32 +0000 Subject: Add run-time sanity checks --- include/libelfu/lookup.h | 4 ++++ include/libelfu/model.h | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'include/libelfu') diff --git a/include/libelfu/lookup.h b/include/libelfu/lookup.h index 2cca5df..2506512 100644 --- a/include/libelfu/lookup.h +++ b/include/libelfu/lookup.h @@ -7,8 +7,12 @@ #include char* elfu_sectionName(Elf *e, Elf_Scn *scn); + Elf_Scn* elfu_sectionByName(Elf *e, char *name); + Elf_Scn* elfu_firstSectionInSegment(Elf *e, GElf_Phdr *phdr); Elf_Scn* elfu_lastSectionInSegment(Elf *e, GElf_Phdr *phdr); +size_t elfu_scnSizeFile(const GElf_Shdr *shdr); + #endif diff --git a/include/libelfu/model.h b/include/libelfu/model.h index 1b5f6b6..588d57a 100644 --- a/include/libelfu/model.h +++ b/include/libelfu/model.h @@ -37,8 +37,7 @@ typedef struct { CIRCLEQ_HEAD(ScnList, ElfuScn) scnList; CIRCLEQ_HEAD(PhdrList, ElfuPhdr) phdrList; - ElfuPhdr *entryBase; - GElf_Addr *entryOffs; + ElfuScn *shstrtab; } ElfuElf; @@ -46,6 +45,10 @@ typedef struct { size_t elfu_countSections(ElfuElf *me); size_t elfu_countPHDRs(ElfuElf *me); +char* elfu_modelScnName(ElfuElf *me, ElfuScn *ms); + +int elfu_modelCheck(ElfuElf *me); + ElfuPhdr* elfu_modelFromPhdr(GElf_Phdr *phdr); ElfuScn* elfu_modelFromSection(Elf_Scn *scn); ElfuElf* elfu_modelFromElf(Elf *e); -- cgit v1.2.3